/* ============================================================
   MOBILEDZ — Header, Footer & Layout
   ============================================================ */

/* ---------- Header ---------- */
#site-header,
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
}
.site-header {
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(10, 26, 47, 0.08);
}
.header-bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.brand__logo, .header-logo {
  width: 34px; height: 34px;
  max-width: 34px; max-height: 34px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--brand-navy);
  box-shadow: var(--shadow-sm);
}
.brand__wordmark {
  display: flex; flex-direction: column; line-height: 1;
}
.brand__name {
  font-weight: 900;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
  color: var(--brand-navy);
}
.brand__name b { color: var(--brand-cyan); }
.brand__tag {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* Nav */
.main-nav { display: none; margin-inline-start: 6px; }
.main-nav ul { display: flex; gap: 2px; }
.main-nav a {
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-2);
  transition: color var(--transition), background var(--transition);
}
.main-nav a:hover { color: var(--brand-cyan); background: var(--brand-cyan-light); }
.main-nav a.is-active { color: var(--brand-cyan); background: var(--brand-cyan-light); }
@media (min-width: 980px) { .main-nav { display: block; } }

/* Header search */
.header-search {
  flex: 1;
  max-width: 380px;
  margin-inline-start: auto;
  position: relative;
}
.header-search form { display: flex; }
.header-search .input {
  width: 100%;
  padding-inline-start: 36px;
  padding-top: 7px;
  padding-bottom: 7px;
  border-radius: var(--r-pill);
  background: var(--bg-alt);
  border-color: transparent;
  font-size: 0.85rem;
}
.header-search .icon-search {
  position: absolute;
  inset-inline-start: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted);
  pointer-events: none;
}
@media (max-width: 979px) { .header-search { display: none; } }

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
@media (min-width: 980px) { .header-actions { margin-inline-start: 0; } }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2);
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--brand-cyan-light); color: var(--brand-cyan); }
.icon-btn svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.icon-btn__count {
  position: absolute; top: 2px; inset-inline-end: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--brand-cyan); color: #fff;
  font-size: 0.6rem; font-weight: 800;
  border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.icon-btn__count.is-hidden { display: none; }

/* Language switch */
.lang-switch { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line);
  font-weight: 700; font-size: var(--fs-sm);
  color: var(--ink-2);
  transition: border-color var(--transition), color var(--transition);
}
.lang-btn:hover { border-color: var(--brand-cyan); color: var(--brand-cyan); }
.lang-btn .globe { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.lang-btn .chev { width: 12px; height: 12px; transition: transform var(--transition); }
.lang-switch.open .chev, .lang-menu.open ~ .lang-btn .chev { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); min-width: 160px; padding: 6px;
  display: none; z-index: 50;
}
.lang-switch.open .lang-menu, .lang-menu.open { display: block; }
.lang-menu button {
  width: 100%; text-align: start; padding: 10px 12px; border-radius: 8px;
  font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.lang-menu button:hover { background: var(--brand-cyan-light); }
.lang-menu button.is-active { color: var(--brand-cyan); font-weight: 800; }
.lang-menu .flag { font-size: 1.1rem; }

/* Mobile menu toggle */
.menu-toggle { display: grid; }
@media (min-width: 980px) { .menu-toggle { display: none; } }

/* Customer pill */
.customer-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-alt); padding: 4px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2);
}

/* ---------- Mobile drawer ---------- */
.drawer {
  position: fixed; inset: 0; z-index: 120;
  visibility: hidden;
  overflow: hidden;
  transition: visibility var(--transition);
}
.drawer__backdrop {
  position: absolute; inset: 0; background: rgba(10,26,47,0.5);
  opacity: 0; transition: opacity var(--transition);
}
.drawer__panel {
  position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: min(86vw, 340px); background: #fff;
  transform: translateX(-100%); transition: transform 0.28s ease;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
[dir="rtl"] .drawer__panel { inset-inline-start: auto; inset-inline-end: 0; transform: translateX(100%); }
.drawer.open, .drawer.is-open { visibility: visible; }
.drawer.open .drawer__backdrop, .drawer.is-open .drawer__backdrop { opacity: 1; }
.drawer.open .drawer__panel, .drawer.is-open .drawer__panel { transform: none; }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.drawer__nav { padding: 10px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.drawer__nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: var(--r-md);
  font-weight: 600; color: var(--ink-2);
}
.drawer__nav a:hover, .drawer__nav a.is-active { background: var(--brand-cyan-light); color: var(--brand-cyan); }
.drawer__nav svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.drawer__search { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer__search .input { border-radius: var(--r-md); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--brand-navy);
  color: #B9CADD;
  padding-block: 56px 0;
}
.footer-logo {
  width: 42px; height: 42px;
  max-width: 42px; max-height: 42px;
  border-radius: 10px;
  object-fit: cover;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.1fr; } }
.footer-brand .brand__name { color: #fff; }
.footer-brand p { margin-top: 14px; font-size: var(--fs-sm); color: #94B0C9; max-width: 36ch; line-height: 1.7; }
.footer-col h4 { color: #fff; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 16px; }
.footer-col ul { display: grid; gap: 10px; }
.footer-col a { font-size: var(--fs-sm); color: #B9CADD; transition: color var(--transition); }
.footer-col a:hover { color: var(--brand-cyan); }
.footer-contact li { display: flex; gap: 10px; font-size: var(--fs-sm); margin-bottom: 12px; }
.footer-contact svg { width: 18px; height: 18px; stroke: var(--brand-cyan); fill: none; stroke-width: 1.8; flex-shrink: 0; margin-top: 2px; }
.social-links a, .socials a {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.08); display: grid; place-items: center;
  color: #B9CADD; transition: background var(--transition), color var(--transition);
}
.social-links a:hover, .socials a:hover { background: var(--brand-cyan); color: #fff; }
.social-links svg, .socials svg { width: 18px; height: 18px; fill: currentColor; }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding-block: 22px; font-size: var(--fs-xs); color: #7E97AE;
}

/* WhatsApp Floating Button */
.whatsapp-float, .wa-float {
  position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 90;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(37,211,102,0.45); transition: transform var(--transition);
}
.whatsapp-float:hover, .wa-float:hover { transform: scale(1.08); }
.whatsapp-float svg, .wa-float svg { width: 28px; height: 28px; fill: currentColor; }

/* Auth forms */
.auth-container {
  display: grid; place-items: center;
  min-height: calc(100vh - 280px);
  padding-block: 40px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: clamp(28px, 6vw, 40px);
  box-shadow: var(--shadow-md);
}
.auth-card h1 { font-size: var(--fs-2xl); margin-bottom: 24px; text-align: center; }
.auth-switch { text-align: center; margin-top: 20px; font-size: var(--fs-sm); color: var(--muted); }
.auth-switch a { color: var(--brand-cyan); font-weight: 700; margin-inline-start: 4px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); }
.form-group input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: var(--fs-base); background: var(--bg-alt);
}
.form-group input:focus { border-color: var(--brand-cyan); outline: none; background: #fff; box-shadow: 0 0 0 3px rgba(0,168,232,0.14); }
.form-error { color: var(--danger); font-size: var(--fs-sm); font-weight: 600; margin-bottom: 12px; }

/* ---------- RTL comprehensive fixes ---------- */
html[dir="rtl"] { text-align: right; }
html[dir="rtl"] .header-actions { margin-inline-start: 0; margin-inline-end: auto; }
html[dir="rtl"] .catalog-toolbar .search-box .icon-search { inset-inline-start: auto; inset-inline-end: 14px; }
html[dir="rtl"] .catalog-toolbar .search-box .input { padding-inline-start: 12px; padding-inline-end: 40px; }
html[dir="rtl"] .breadcrumb { flex-direction: row-reverse; }
html[dir="rtl"] .footer-grid { direction: rtl; }
html[dir="rtl"] .pd-grid { direction: rtl; }
html[dir="rtl"] .spec-row { direction: rtl; }
html[dir="rtl"] .list-item { flex-direction: row-reverse; }
html[dir="rtl"] .eyebrow::before { order: 2; }

/* ---------- Toast (favorites & cart feedback) ---------- */
.toast {
  position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--brand-navy); color: #fff;
  padding: 12px 22px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: 600;
  opacity: 0; pointer-events: none; transition: all 0.3s ease; z-index: 200;
  display: flex; align-items: center; gap: 10px;
}
[dir="rtl"] .toast { transform: translateX(50%) translateY(20px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[dir="rtl"] .toast.show { transform: translateX(50%) translateY(0); }
.toast svg { width: 18px; height: 18px; fill: var(--brand-cyan); }

/* ---------- Cart Drawer & Floating Bar ---------- */
.cart-drawer {
  position: fixed; inset: 0; z-index: 2000;
  display: none;
  overflow: hidden;
}
.cart-drawer.is-open { display: block; }
.cart-drawer__backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}
.cart-drawer__panel {
  position: absolute; top: 0; bottom: 0; inset-inline-end: 0;
  width: min(440px, 100vw);
  background: #fff; box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column;
  animation: slideDrawer 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDrawer {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
[dir="rtl"] .cart-drawer__panel {
  animation: slideDrawerRTL 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDrawerRTL {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
.cart-drawer__head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.cart-drawer__head h3 { font-size: 1.15rem; font-weight: 800; color: var(--brand-navy); margin: 0; }
.cart-drawer__body {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.cart-drawer__foot {
  padding: 20px; border-top: 1px solid var(--line);
  background: var(--bg-alt);
}

.cart-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-md); position: relative;
}
.cart-item__img {
  width: 64px; height: 64px; border-radius: var(--r-sm);
  background: var(--bg-soft); overflow: hidden; flex-shrink: 0;
}
.cart-item__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item__details { flex: 1; min-width: 0; }
.cart-item__name {
  font-weight: 700; font-size: var(--fs-sm); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart-item__meta { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.cart-item__price { font-weight: 800; color: var(--brand-navy); margin-top: 4px; font-size: var(--fs-sm); }
.cart-item__actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qty-stepper {
  display: inline-flex; align-items: center; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--bg-alt); overflow: hidden;
}
.qty-stepper button {
  width: 26px; height: 26px; border: none; background: transparent;
  cursor: pointer; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.qty-stepper button:hover { background: var(--line); }
.qty-stepper span { min-width: 24px; text-align: center; font-size: var(--fs-xs); font-weight: 700; }
.cart-item__remove {
  border: none; background: none; color: var(--danger); cursor: pointer;
  padding: 4px; border-radius: 4px; font-size: var(--fs-xs);
}

/* ---------- Checkout Modal (Cash on Delivery) ---------- */
.checkout-modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.checkout-modal-overlay.is-open { display: flex; }
.checkout-modal {
  width: min(650px, 100%); max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column; margin: auto;
}
.checkout-modal__head {
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.checkout-modal__head h2 { font-size: 1.25rem; font-weight: 800; color: var(--brand-navy); margin: 0; }
.checkout-modal__body {
  padding: 24px;
}
.checkout-notice {
  background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: var(--r-md);
  padding: 14px 18px; color: #1E40AF; font-size: var(--fs-sm); font-weight: 600;
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
  line-height: 1.5;
}
.checkout-notice svg {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  flex-shrink: 0;
  color: #2563EB;
}
.checkout-notice span {
  flex: 1;
}
.form-grid-2 {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px;
}
.order-summary-box {
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px; margin-top: 20px;
}

/* Stock Alert Under Product Title */
.stock-alert-text {
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  margin-bottom: 4px;
}
.stock-alert-text.out {
  color: #DC2626;
  background: #FEE2E2;
  border: 1px solid #FECACA;
  padding: 3px 8px;
  border-radius: var(--r-sm);
}

/* Delivery Type Selector (Home vs Desk) */
.delivery-options-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand-navy);
  margin-bottom: 8px;
}
.delivery-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.delivery-choice {
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  cursor: pointer;
  background: #fff;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: start;
}
.delivery-choice:hover {
  border-color: var(--brand-cyan);
  background: var(--brand-cyan-light);
}
.delivery-choice.is-active {
  border-color: var(--brand-cyan);
  background: #F0F9FF;
  box-shadow: 0 0 0 1px var(--brand-cyan);
}
.delivery-choice .dc-title {
  font-weight: 800;
  font-size: var(--fs-sm);
  color: var(--brand-navy);
  display: flex;
  align-items: center;
  gap: 6px;
}
.delivery-choice .dc-price {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--brand-cyan);
}
.delivery-choice .dc-desc {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

/* Print Invoice Styles */
@media print {
  body * { visibility: hidden; }
  .modal.show, .modal.show *, #orderModalBody, #orderModalBody * {
    visibility: visible;
  }
  #orderModalBody {
    position: absolute; inset-inline-start: 0; top: 0; width: 100%;
  }
  .site-header, .site-footer, .admin-sidebar, .admin-topbar, .btn { display: none !important; }
}

