/*
  FRIENDS Template - CSS
  ملاحظة: يمكنك تعديل الألوان والخطوط بسهولة من قسم المتغيرات.
*/
:root {
  /* هوية طبية حديثة وأنيقة مستوحاة من شعار FRIENDS الطبي */
  --primary: #074b8a;        /* أزرق رويال طبي عميق */
  --primary-dark: #072b61;   /* كحلي ملكي راقي */
  --primary-strong: #051c3d; /* كحلي داكن للنصوص والعناوين */
  --accent: #00a8cc;         /* تركواز وسماوي طبي كهربائي مشرق */
  --accent-strong: #00829f;  /* أزرق تركوازي داكن للتأثيرات */
  --accent-soft: #e3f6fa;    /* خلفيات ناعمة منعشة */
  --secondary: #38bdf8;      /* أزرق سماوي نقي */
  --secondary-soft: #edf8ff; /* ثلجي مريح للعين */
  --red: #e63946;
  --light: #f4f9fd;
  --ink: #07233d;
  --muted: #4e6b87;
  --card: #ffffff;
  --shadow: 0 18px 40px rgba(7, 43, 97, 0.08);
  --glass: rgba(255, 255, 255, 0.88);
  --glass-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(7, 75, 138, 0.12);
  --glow: 0 20px 48px rgba(0, 168, 204, 0.16);
  --font-body: "Harmattan", "Tajawal", sans-serif;
  --font-display: "Reem Kufi", "Changa", sans-serif;
}

/* أساسيات عامة */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(33, 183, 182, 0.15), transparent 30%),
    radial-gradient(circle at top right, rgba(15, 111, 191, 0.2) 0%, rgba(15, 111, 191, 0) 40%),
    linear-gradient(180deg, #f8fbff 0%, #edf5ff 100%);
}

::selection {
  background: rgba(15, 111, 191, 0.15);
  color: var(--ink);
}

.terms-page {
  padding-top: 24px;
}

.terms-hero {
  margin-bottom: 18px;
}

.terms-hero h2 {
  margin: 0 0 8px;
  font-size: 28px;
  color: var(--ink);
}

.terms-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.terms-lead {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.8;
}

.terms-note {
  margin: 0;
  background: var(--accent-soft);
  border: 1px dashed rgba(32, 80, 160, 0.25);
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.7;
}

.terms-card {
  background: var(--card);
  border-radius: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  line-height: 1.9;
  font-size: 15px;
  color: var(--ink);
}

.terms-card h3 {
  margin: 16px 0 8px;
  font-size: 18px;
}

.terms-card p {
  margin: 0 0 10px;
}

.terms-card .terms-list {
  margin: 0 0 10px;
  padding: 0 18px 0 0;
}

.terms-lang-en {
  display: none;
}

[data-lang="en"] .terms-lang-en {
  display: block;
}

[data-lang="en"] .terms-lang-ar {
  display: none;
}

@media (max-width: 600px) {
  .terms-hero h2 {
    font-size: 24px;
  }

  .terms-lead {
    font-size: 15px;
  }

  .terms-card {
    padding: 16px;
    font-size: 14px;
  }

  .lang-select {
    min-width: 120px;
    font-size: 12px;
  }
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-display);
  letter-spacing: 0.2px;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1200px, 92%);
  margin: 0 auto;
}

/* رأس الموقع والبار العلوي */
.announcement {
  background: linear-gradient(90deg, #041833 0%, #083363 45%, #072a54 80%, #041833 100%);
  border-bottom: 1px solid rgba(0, 168, 204, 0.22);
  font-size: 13.5px;
  color: #e2f1fc;
  position: relative;
  z-index: 25;
}

.announcement .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  color: inherit;
  gap: 16px;
}

.announcement-brand-slogan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.announcement-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00e5ff;
  box-shadow: 0 0 10px #00e5ff, 0 0 20px rgba(0, 229, 255, 0.5);
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}

.announcement strong.slogan-text {
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 14.5px;
  letter-spacing: 0.3px;
}

.announcement-sub {
  color: #a4cdec;
  font-size: 13px;
}

.announcement-quick-info {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.announcement-contact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  background: rgba(0, 168, 204, 0.16);
  border: 1px solid rgba(0, 168, 204, 0.3);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
  transition: all 0.2s ease;
}

.announcement-contact:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
}

.announcement-sep {
  opacity: 0.4;
}

.announcement-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #c9e4fb;
  font-size: 12.5px;
}

/* Header: البار العلوي الرئيسي */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  z-index: 22;
  box-shadow: 0 4px 20px rgba(7, 43, 97, 0.05);
  transition: all 0.25s ease;
}

.site-header.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 30px rgba(7, 43, 97, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  min-width: 0;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.brand:hover {
  transform: scale(1.02);
}

.logo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  border-radius: 14px;
  background: transparent;
  transition: all 0.2s ease;
}

.logo img {
  width: auto;
  height: 52px;
  max-width: 220px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(7, 43, 97, 0.08));
}

.brand-text {
  display: none; /* The vector logo now contains the brand wordmark, tagline & slogan crisply */
}

/* Navigation Links */
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(7, 43, 97, 0.04);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  background: var(--accent-soft);
  color: var(--primary-dark);
  font-weight: 700;
  transform: translateY(-1px);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-strong);
  font-size: 15px;
}

.nav-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fef2f2;
  color: #e63946;
  font-size: 12px;
  font-weight: 800;
}

/* Actions & Search */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  flex-direction: column;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(7, 43, 97, 0.04);
  transition: all 0.2s ease;
}

.search-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 168, 204, 0.16), 0 6px 20px rgba(7, 43, 97, 0.06);
  background: #ffffff;
}

.search-box input {
  border: none;
  min-width: 220px;
  max-width: 320px;
  width: 100%;
  font-family: inherit;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
}

.search-box input::placeholder {
  color: #8da2b5;
  font-size: 13px;
}

.search-icon {
  color: var(--accent-strong);
  font-size: 16px;
  display: flex;
  align-items: center;
}

.search-clear {
  border: none;
  background: #f1f5f9;
  color: #64748b;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  font-size: 11px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.search-clear:hover {
  background: #e2e8f0;
  color: var(--red);
}

.btn-filter-icon {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-filter-icon:hover {
  color: var(--primary);
  background: var(--accent-soft);
}

.search-filters {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 280px;
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  box-shadow: 0 16px 36px rgba(7, 43, 97, 0.14);
  z-index: 40;
}

.header-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(0, 168, 204, 0.2);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.header-cart-btn:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 168, 204, 0.25);
}

.cart-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.cart-count-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--red);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(230, 57, 70, 0.35);
}

.auth-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-user {
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 13.5px;
  background: var(--secondary-soft);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

/* Hero Slider */
.hero {
  padding: 26px 0 0;
}

.hero-swiper {
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--glow);
  border: 1px solid var(--line);
  background: #fff;
}

.hero-slide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: center;
  gap: 16px;
  padding: 32px;
  background: linear-gradient(135deg, #f5fbff 0%, #edf7ff 42%, #ecfbfa 100%);
}

.hero-slide h3 {
  margin: 0 0 10px;
  font-size: 24px;
  color: var(--primary-strong);
}

.hero-slide p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.8;
}

.hero-slide .badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 111, 191, 0.12), rgba(33, 183, 182, 0.14));
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 12px;
}

/* الأقسام العامة */
.section {
  padding: 60px 0;
}

.section.alt {
  background: var(--light);
}

.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  margin: 0 0 8px;
  font-size: 28px;
  color: var(--primary-dark);
}

.section-header p {
  margin: 0;
  color: var(--muted);
}

/* الشبكات */
.grid {
  display: grid;
  gap: 20px;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.categories {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.products {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* الكروت */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,249,255,0.98));
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 18px 36px rgba(11, 42, 90, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px rgba(11, 42, 90, 0.12);
  border-color: rgba(15, 111, 191, 0.2);
}

.card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-family: inherit;
}

.card img {
  border-radius: 14px;
  height: 160px;
  object-fit: cover;
  border: 1px solid rgba(15, 111, 191, 0.08);
}

.card h4 {
  margin: 0;
  font-size: 18px;
  color: var(--primary-strong);
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.card .price {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 1.05rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 700;
}

.rating span {
  color: var(--muted);
  font-weight: 600;
}

/* الأزرار */
.btn {
  border: none;
  border-radius: 14px;
  padding: 11px 18px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 14px 28px rgba(15, 111, 191, 0.22);
}

.btn.primary:hover {
  filter: brightness(1.03);
}

.btn.ghost {
  background: linear-gradient(135deg, rgba(15, 111, 191, 0.08), rgba(33, 183, 182, 0.08));
  color: var(--primary-dark);
  border: 1px solid rgba(15, 111, 191, 0.18);
}

.btn:hover {
  transform: translateY(-1px);
}

/* شارات */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 12px;
  width: fit-content;
}

/* أقسام (Pills) */
.category-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-strong);
  padding: 16px;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(11, 42, 90, 0.08);
  font-weight: 600;
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.category-pill span {
  color: var(--muted);
  font-size: 13px;
}

/* صفحة تفاصيل المنتج */
.product-details {
  background: var(--card);
  border-radius: 20px;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.product-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-details .product-main {
  border-radius: 16px;
  height: 320px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.product-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-thumbs .thumb {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-thumbs .thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(32, 80, 160, 0.16);
}

.product-thumbs .thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.product-details h3 {
  margin: 0 0 12px;
  font-size: 26px;
}

.product-details p {
  margin: 0 0 12px;
  color: var(--muted);
}

.product-meta {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 14px;
}

.product-meta strong {
  color: var(--ink);
}

.qty-selector {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  width: fit-content;
}

.qty-selector button {
  background: rgba(32, 80, 160, 0.12);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-weight: 700;
  cursor: pointer;
}

.related-grid {
  margin-top: 24px;
}

/* السلة */
.cart-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  font-size: 24px;
  box-shadow: 0 18px 36px rgba(32, 80, 160, 0.22);
  cursor: pointer;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-count {
  position: absolute;
  top: -6px;
  right: -4px;
  background: var(--primary-dark);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
}

.cart-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.cart-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 12px;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.remove-btn {
  border: none;
  background: rgba(216, 58, 58, 0.12);
  color: var(--red);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
}

.cart-summary {
  background: var(--card);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  height: fit-content;
  border: 1px solid var(--line);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.input-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.cart-summary input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 16px;
  font-family: inherit;
}

.select-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 16px;
  font-family: inherit;
  background: #fff;
}

.payment-box {
  border: 1px dashed rgba(32, 80, 160, 0.28);
  border-radius: 12px;
  background: var(--accent-soft);
  padding: 10px 12px;
  margin-bottom: 14px;
}

.payment-box p {
  margin: 6px 0;
}

.note {
  color: var(--muted);
  font-size: 13px;
}

.note[data-type="error"] {
  color: var(--red);
  font-weight: 600;
}

.note[data-type="success"] {
  color: #1e7a5a;
  font-weight: 600;
}

.footer {
  background: var(--primary-dark);
  color: #e8f0ff;
  padding: 36px 0;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

.footer h4 {
  margin: 0 0 12px;
  font-size: 18px;
}

.footer p,
.footer a {
  color: rgba(232, 240, 255, 0.82);
  font-size: 14px;
}

.footer .badge {
  background: rgba(64, 112, 192, 0.2);
  color: #d9f2ff;
}

.mobile-tabs {
  display: none;
}

.auth-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.auth-card h3 {
  margin: 0;
}

.admin-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.admin-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.admin-preview.is-empty {
  display: none;
}

.admin-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.admin-preview-list img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.admin-divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.admin-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-subheader h5 {
  margin: 0;
  font-size: 15px;
}

.admin-thumb-empty {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
  display: grid;
  place-items: center;
  text-align: center;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.admin-row img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
}

.admin-row-actions {
  display: flex;
  gap: 6px;
}

.user-row {
  grid-template-columns: 56px 1fr auto;
  align-items: start;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(32, 80, 160, 0.12);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
}

.user-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fff;
}

.order-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.status-chip {
  background: rgba(32, 80, 160, 0.14);
  color: var(--primary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.status-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

/* تجاوب الشاشات */
@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;
    justify-content: center;
  }

  .main-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .cart-layout {
    grid-template-columns: 1fr;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .search-box {
    width: 100%;
  }

  .search-shell input {
    min-width: 0;
    width: 100%;
  }

  .section {
    padding: 48px 0;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .brand {
    justify-content: center;
  }

  .main-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .header-actions {
    width: 100%;
  }

  .auth-links {
    width: 100%;
    justify-content: center;
  }

  .search-box {
    width: 100%;
  }

  .search-shell {
    width: 100%;
  }

  #toggleFilters {
    width: 100%;
  }

  .hero-slide {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 44px 0;
  }
}

@media (max-width: 600px) {
  body {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }

  .site-header.is-compact {
    box-shadow: 0 10px 22px rgba(16, 48, 96, 0.16);
  }

  .site-header.is-compact .header-inner {
    padding: 4px 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .site-header.is-compact .logo {
    opacity: 1;
    transform: none;
    max-width: 120px;
    padding: 4px 6px;
  }

  .site-header.is-compact .brand-text p {
    opacity: 0;
    max-height: 0;
  }

  .site-header.is-compact .brand-text h1 {
    font-size: 14px;
    letter-spacing: 0.4px;
  }

  .site-header.is-compact .header-actions {
    opacity: 1;
    max-height: 56px;
    transform: none;
    pointer-events: auto;
    display: flex;
    gap: 8px;
    align-items: center;
  }

  /* show only logo + compact cart on mobile */
  .site-header.is-compact .brand-text { display: none; }
  .site-header.is-compact .search-box { display: none; }
  .site-header.is-compact .main-nav { display: none; }
  .site-header.is-compact .auth-links { display: none; }

  /* keep only compact cart/button visible inside header-actions */
  .site-header.is-compact .header-actions :not(.btn.ghost) { display: none; }
  .site-header.is-compact .header-actions .btn.ghost {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .logo img {
    height: 40px;
    max-width: 120px;
  }

  .header-actions {
    max-height: 240px;
  }

  .auth-links {
    display: none;
  }

  .search-shell {
    padding: 10px 12px;
  }

  .search-box input {
    font-size: 15px;
  }

  #toggleFilters {
    width: 100%;
  }

  .hero-slide {
    padding: 22px 18px;
    text-align: center;
  }

  .hero-slide h3 {
    font-size: 20px;
  }

  .hero-slide p {
    font-size: 14px;
  }

  .section-header h2 {
    font-size: 24px;
  }

  .section-header p {
    font-size: 14px;
  }

  .grid {
    gap: 14px;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card {
    padding: 14px;
  }

  .card h4 {
    font-size: 16px;
  }

  .card p {
    font-size: 13px;
  }

  .btn {
    min-height: 44px;
    font-size: 14px;
  }

  .product-details {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .product-meta {
    font-size: 13px;
  }

  .cart-summary {
    padding: 16px;
  }

  .cart-summary input,
  .select-input {
    min-height: 44px;
  }

  .footer {
    text-align: center;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .cart-item {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .cart-item img {
    margin: 0 auto;
  }

  .product-details {
    padding: 18px;
  }

  .product-details .product-main {
    height: 240px;
  }

  .card img {
    height: 140px;
  }

  .announcement .container {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  .auth-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .admin-row {
    grid-template-columns: 1fr;
  }

  .site-header {
    top: 0;
  }
}

/* =========================================================
   DESKTOP STABILITY GUARANTEE (Screen width >= 768px)
   - Do NOT modify Desktop elements or layout
   - Hide mobile-only elements on desktop
   ========================================================= */
@media (min-width: 768px) {
  .mobile-only,
  .mobile-hamburger,
  .mobile-lang-wrap,
  .mobile-menu-drawer,
  .mobile-menu-backdrop,
  .mobile-bottom-nav,
  .mobile-tabs {
    display: none !important;
  }
}

/* =========================================================
   MOBILE ONLY UI (Max-width: 767px)
   - Scope strictly for mobile devices
   ========================================================= */
@media (max-width: 767px) {
  body {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  body.menu-open {
    overflow: hidden;
  }

  /* 1. Mobile Header (Compact: Hamburger + Logo + Language Icon) */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 119, 139, 0.1);
    box-shadow: 0 4px 16px rgba(7, 42, 44, 0.05);
    padding: 0;
  }

  .site-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    min-height: 56px;
    width: 100%;
  }

  /* Hide desktop-only nav and actions on mobile */
  .main-nav,
  .lang-switch,
  .auth-links,
  .cart-fab {
    display: none !important;
  }

  /* Mobile Hamburger Button */
  .mobile-hamburger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(0, 119, 139, 0.06);
    border: 1px solid rgba(0, 119, 139, 0.12);
    color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.15s ease, transform 0.15s ease;
  }

  .mobile-hamburger:active {
    background: rgba(0, 119, 139, 0.14);
    transform: scale(0.96);
  }

  /* Mobile Logo / Brand */
  .site-header .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    margin: 0 auto;
    text-align: center;
  }

  .site-header .brand .logo {
    padding: 2px 6px;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    border: none;
    max-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .site-header .brand .logo img {
    height: 38px;
    max-width: 130px;
    width: auto;
    object-fit: contain;
  }

  .site-header .brand .brand-text {
    display: none;
  }

  /* Mobile Language Button (Icon Only - Globe) */
  .mobile-lang-wrap {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-inline-start: 2px;
  }

  .mobile-lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(0, 119, 139, 0.06);
    border: 1px solid rgba(0, 119, 139, 0.12);
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, transform 0.15s ease;
  }

  .mobile-lang-btn:active {
    background: rgba(0, 119, 139, 0.14);
    transform: scale(0.96);
  }

  /* Language Dropdown Popover */
  .mobile-lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(7, 42, 44, 0.16);
    padding: 6px;
    min-width: 130px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: popupFade 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  }

  [dir="ltr"] .mobile-lang-dropdown {
    left: auto;
    right: 0;
  }

  .mobile-lang-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    text-align: start;
    transition: background 0.15s ease;
  }

  .mobile-lang-opt:hover,
  .mobile-lang-opt.active {
    background: var(--accent-soft);
    color: var(--primary-dark);
  }

  .mobile-lang-opt .lang-check {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
  }

  /* 2. Mobile Drawer Navigation */
  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(7, 42, 44, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .mobile-menu-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: min(300px, 82vw);
    background: #ffffff;
    z-index: 1060;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 28px rgba(7, 42, 44, 0.16);
  }

  [dir="ltr"] .mobile-menu-drawer {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 8px 0 28px rgba(7, 42, 44, 0.16);
  }

  .mobile-menu-drawer.is-open {
    transform: translateX(0) !important;
  }

  .mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(0, 119, 139, 0.06), rgba(0, 180, 196, 0.06));
  }

  .mobile-drawer-header .brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-drawer-header .logo img {
    height: 34px;
    width: auto;
  }

  .mobile-drawer-header .brand-text h2 {
    margin: 0;
    font-size: 16px;
    color: var(--primary-dark);
    font-family: var(--font-display);
  }

  .mobile-drawer-header .brand-text p {
    margin: 0;
    font-size: 10px;
    color: var(--muted);
  }

  .mobile-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .mobile-drawer-close:hover {
    background: var(--accent-soft);
    color: var(--primary-dark);
  }

  .mobile-drawer-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }

  .mobile-drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 10px;
  }

  .mobile-drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: var(--font-body);
  }

  .mobile-drawer-link:hover,
  .mobile-drawer-link.active {
    background: var(--accent-soft);
    color: var(--primary-dark);
  }

  .mobile-drawer-link .drawer-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: var(--primary);
    display: inline-flex;
    justify-content: center;
  }

  .mobile-drawer-footer {
    margin-top: auto;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
    background: var(--light);
  }

  .mobile-drawer-contact {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  /* 3. Mobile Bottom Navigation Bar (4 items: Icon top, Label bottom) */
  .mobile-bottom-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    height: 64px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 30px rgba(7, 42, 44, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 119, 139, 0.12);
    backdrop-filter: blur(16px);
    z-index: 999;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    padding: 4px 6px;
    gap: 2px;
  }

  .mobile-bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 4px 2px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--muted);
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
  }

  .mobile-bottom-item .bottom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 28px;
    border-radius: 10px;
    transition: all 0.2s ease;
  }

  .mobile-bottom-item .bottom-icon svg {
    width: 23px;
    height: 23px;
    stroke-width: 2;
    stroke: currentColor;
  }

  .mobile-bottom-item .bottom-label {
    font-size: 11px;
    line-height: 1.1;
    margin-top: 3px;
    font-weight: 600;
    white-space: nowrap;
    color: inherit;
    font-family: var(--font-body);
  }

  .mobile-bottom-item.active {
    color: var(--primary-dark);
  }

  .mobile-bottom-item.active .bottom-icon {
    background: var(--accent-soft);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 119, 139, 0.08);
  }

  .mobile-bottom-item.active .bottom-label {
    color: var(--primary-dark);
    font-weight: 700;
  }

  /* Responsive refinements for phones */
  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .card {
    padding: 12px !important;
    gap: 8px !important;
    border-radius: 16px !important;
  }

  .card img {
    height: 135px !important;
    border-radius: 10px !important;
  }

  .card h4 {
    font-size: 14px !important;
    line-height: 1.35 !important;
  }

  .card p {
    font-size: 12px !important;
  }

  .card .btn {
    padding: 8px 12px !important;
    font-size: 13px !important;
  }

  .cart-fab {
    bottom: calc(82px + env(safe-area-inset-bottom)) !important;
    right: 14px !important;
    width: 52px !important;
    height: 52px !important;
    font-size: 22px !important;
  }

  body {
    padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
  }
}

@keyframes popupFade {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Screen width <= 360px micro refinements */
@media (max-width: 360px) {
  .mobile-bottom-nav {
    left: 8px;
    right: 8px;
    height: 60px;
    padding: 2px 4px;
  }

  .mobile-bottom-item .bottom-icon svg {
    width: 21px;
    height: 21px;
  }

  .mobile-bottom-item .bottom-label {
    font-size: 10px;
  }

  .site-header .brand .logo img {
    height: 32px;
    max-width: 110px;
  }
}

@media (max-width: 480px) {
  .container {
    width: min(100%, calc(100% - 20px));
  }

  .section {
    padding: 40px 0;
  }

  .hero {
    padding-top: 18px;
  }

  .hero-slide {
    padding: 18px 14px;
  }

  .hero-slide h3 {
    font-size: 19px;
  }

  .brand {
    gap: 10px;
  }

  .brand-text h1 {
    font-size: 18px;
  }

  .logo {
    padding: 8px 10px;
  }

  .logo img {
    height: 48px;
    max-width: 150px;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .card,
  .category-pill,
  .cart-summary,
  .product-details,
  .order-card {
    border-radius: 18px;
  }

  .footer {
    padding: 28px 0 30px;
  }
}

/* ==========================
   UI Enhancements & Polish
   ========================== */

/* Desktop polish: subtle card lift and clearer CTA */
@media (min-width: 900px) {
  .card {
    border-radius: 16px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 28px 48px rgba(7, 43, 97, 0.08);
  }
}

/* Accessibility: ensure contrast for badges and buttons */
.badge, .btn.primary {
  color: #fff;
}

/* Category layout: sidebar filters + main products (Amazon-like) */
.category-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}

.filters {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(7, 85, 95, 0.04);
}

.filters h4 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--primary-dark);
}

.filter-group {
  margin-bottom: 12px;
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.products-main .products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

@media (max-width: 900px) {
  .category-layout {
    grid-template-columns: 1fr;
  }

  .filters {
    order: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .products-main {
    order: 1;
  }
}

/* Empty Catalog State */
.empty-catalog-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 16px;
  margin: 12px 0;
  box-shadow: 0 4px 16px rgba(10, 25, 47, 0.03);
}

.empty-catalog-state .empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.7;
}

.empty-catalog-state h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.empty-catalog-state p {
  color: var(--muted);
  font-size: 14px;
  max-width: 400px;
  margin: 0;
}

