* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  background: #f5f5f5;
  color: #333;
  direction: rtl;
  line-height: 1.7;
  font-size: 15px;
}

a { color: #00509d; text-decoration: none; transition: all 0.3s; }
a:hover { color: #003d7a; }
img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 12px;
  width: 100%;
}

/* TOP BAR */
.top-bar {
  background: linear-gradient(135deg, #003d7a, #00509d);
  color: #fff;
  padding: 8px 0;
  font-size: 13px;
}

.top-bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.top-bar .social a {
  color: #fff;
  margin-right: 10px;
  font-size: 14px;
}

.top-bar .social a:hover { color: #F39C12; }

/* HEADER */
.site-header {
  background: #fff;
  padding: 12px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 900;
  color: #00509d;
}

.logo-icon {
  background: linear-gradient(135deg, #00509d, #0077cc);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
}

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 500px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 40px 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 25px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background: #f9f9f9;
}

.search-box input:focus { border-color: #00509d; background: #fff; }

.search-box button {
  position: absolute;
  left: 4px;
  top: 4px;
  bottom: 4px;
  background: #00509d;
  color: #fff;
  border: none;
  padding: 0 15px;
  border-radius: 22px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

/* NAVIGATION */
.main-nav {
  background: #00509d;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-menu {
  display: none;
  flex-direction: column;
  list-style: none;
  width: 100%;
}

.nav-menu.active { display: flex; }

.nav-menu li a {
  display: block;
  color: #fff;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-menu li a:hover {
  background: #003d7a;
  color: #F39C12;
}

.menu-toggle {
  display: block;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 12px 16px;
}

/* MAIN LAYOUT */
.main-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 0;
}

.content-area { width: 100%; min-width: 0; }

.page-title {
  background: #fff;
  padding: 15px 18px;
  border-radius: 10px;
  margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title h1 {
  font-size: 18px;
  color: #00509d;
}

.sort-select {
  padding: 8px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* DEVICE CARDS */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.device-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: all 0.3s;
  position: relative;
  display: flex;
  flex-direction: column;
}

.device-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.device-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #E74C3C;
  color: #fff;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  z-index: 2;
}

.device-image {
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.device-image img {
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s;
}

.device-card:hover .device-image img { transform: scale(1.05); }

.device-info {
  padding: 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.device-title {
  font-size: 13px;
  font-weight: 700;
  color: #333;
  margin-bottom: 6px;
  line-height: 1.4;
  min-height: 36px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.device-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.device-labels span {
  background: #f0f6ff;
  color: #00509d;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.device-rating {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 8px;
  color: #F39C12;
  font-size: 11px;
}

.device-rating .count {
  color: #666;
  font-size: 10px;
  margin-right: 4px;
}

.device-specs {
  background: #f9f9f9;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 11px;
  color: #555;
}

.device-specs div {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px dashed #e0e0e0;
}

.device-specs div:last-child { border-bottom: none; }
.device-specs strong { color: #333; font-weight: 600; }

.device-price {
  color: #E74C3C;
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 8px;
}

.device-btn {
  display: block;
  text-align: center;
  background: #00509d;
  color: #fff !important;
  padding: 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  margin-top: auto;
}

.device-btn:hover { background: #003d7a; color: #fff; }

/* SIDEBAR */
.sidebar .widget {
  background: #fff;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.widget h3 {
  font-size: 15px;
  color: #00509d;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 2px solid #00509d;
  position: relative;
}

.widget h3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 30px;
  height: 2px;
  background: #F39C12;
}

.sidebar-search input {
  width: 100%;
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 25px;
  font-family: inherit;
  outline: none;
}

.brand-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.brand-list li a {
  display: block;
  padding: 6px 8px;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 11px;
  color: #333;
  text-align: center;
}

.brand-list li a:hover {
  background: #00509d;
  color: #fff;
}

.popular-list { list-style: none; }

.popular-list li {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed #e0e0e0;
  align-items: flex-start;
}

.popular-list li:last-child { border-bottom: none; }

.popular-list .num {
  background: #00509d;
  color: #fff;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.popular-list .title {
  font-size: 12px;
  color: #333;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}

/* FOOTER */
.site-footer {
  background: #1a1a1a;
  color: #ccc;
  padding: 30px 0 0;
  margin-top: 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.footer-col h4 {
  color: #fff;
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #00509d;
  display: inline-block;
}

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 6px; }
.footer-col ul li a { color: #ccc; font-size: 13px; }
.footer-col ul li a:hover { color: #F39C12; }

.footer-col p {
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 12px;
}

.footer-social {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-social a {
  width: 34px;
  height: 34px;
  background: #333;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.footer-social a:hover {
  background: #00509d;
  transform: translateY(-2px);
}

.footer-bottom {
  background: #000;
  padding: 15px 0;
  text-align: center;
  font-size: 12px;
  border-top: 1px solid #333;
}

.footer-bottom a { color: #F39C12; }

/* BACK TO TOP */
.back-to-top {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 42px;
  height: 42px;
  background: #00509d;
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  border: none;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(0,80,157,0.4);
}

.back-to-top.show { display: flex; }

/* TABLET */
@media (min-width: 768px) {
  .devices-grid { grid-template-columns: repeat(3, 1fr); gap: 15px; }
  .device-image { height: 180px; }
  
  .nav-menu {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1;
  }
  .nav-menu li { width: auto; }
  .nav-menu li a {
    border-bottom: none;
    padding: 12px 14px;
  }
  .menu-toggle { display: none; }
  
  .main-wrapper {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
  }
  
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

/* DESKTOP */
@media (min-width: 992px) {
  .devices-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
  .device-image { height: 200px; }
  .container { padding: 0 15px; }
  .footer-grid { grid-template-columns: repeat(4, 1fr); }
  
  .logo { font-size: 22px; }
  .logo-icon { width: 45px; height: 45px; font-size: 14px; }
  .page-title h1 { font-size: 22px; }
}

/* SMALL MOBILE */
@media (max-width: 360px) {
  .devices-grid { grid-template-columns: 1fr; }
  .device-image { height: 180px; }
}