@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  --black: #111;
  --white: #fff;
  --bg: #fafafa;
  --border: #f0f0f0;
  --muted: #999;
  --soft: #f4f4f4;
  --blue: #2563eb;
  --green: #15803d;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --purple: #7c3aed;
  --purple-bg: #f5f3ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Outfit', 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--black);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; }

/* ---- NAV ---- */
nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.nav-logo .dot { color: var(--blue); }
.nav-logo-img { height: 44px; width: auto; display: block; }
.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
  flex: 1;
}
.nav-links a {
  font-weight: 500;
  color: #555;
  transition: color 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--black); }
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.lang-toggle {
  display: flex;
  gap: 1px;
  background: var(--soft);
  border-radius: 20px;
  padding: 3px;
  font-size: 13px;
}
.lang-toggle span {
  padding: 3px 10px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 500;
  color: var(--muted);
}
.lang-toggle span.active {
  background: var(--black);
  color: var(--white);
}
.cart-btn {
  background: var(--black);
  color: var(--white);
  border-radius: 20px;
  padding: 8px 18px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.15s;
}
.cart-btn:hover { opacity: 0.85; }
.cart-count {
  background: var(--white);
  color: var(--black);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* ---- PAGE CONTAINER ---- */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ---- CATEGORY PILLS (image cards) ---- */
.category-pills {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 24px;
  scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }
.pill {
  flex: 0 0 auto;
  width: 150px;
  height: 100px;
  border-radius: 16px;
  background-color: var(--soft);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  display: flex;
  align-items: flex-end;
}
/* dark gradient overlay */
.pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.08) 60%, transparent 100%);
  border-radius: 13px;
  transition: background 0.18s;
}
/* "All Boxes" pill — no image, solid dark */
.pill[data-cat="All"] {
  background: linear-gradient(135deg, #1e1e2e, #2d2d44);
}
.pill[data-cat="All"]::before { background: none; }
.pill span {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  padding: 0 10px 8px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  width: 100%;
}
.pill:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.pill:hover::before { background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.06) 60%, transparent 100%); }
.pill.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}
.pill[data-cat="All"].active { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,0.2); }

/* ---- SUBCATEGORY PILLS — level 2 (text pills) ---- */
.subcategory-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  margin-top: -8px;
}
.sub-pill {
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--soft);
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.sub-pill:hover { background: #e8e8e8; color: var(--black); }
.sub-pill.active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

/* ---- SUBSUBCATEGORY PILLS — level 3 (text pills) ---- */
.subsubcategory-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  margin-top: -10px;
  padding-left: 4px;
}
.subsub-pill {
  padding: 4px 13px;
  border-radius: 14px;
  background: var(--white);
  border: 1.5px solid #ddd;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.subsub-pill:hover { border-color: var(--blue); color: var(--blue); }
.subsub-pill.active {
  background: #eff6ff;
  color: var(--blue);
  border-color: var(--blue);
  font-weight: 600;
}

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  gap: 6px;
  background: var(--soft);
  border-radius: 20px;
  padding: 4px;
}
.filter-btn {
  padding: 6px 16px;
  border-radius: 16px;
  background: transparent;
  color: #555;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.filter-btn.active {
  background: var(--white);
  color: var(--black);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.filter-sep { color: var(--border); font-size: 18px; align-self: center; }
.sort-select {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  cursor: pointer;
  margin-left: auto;
}

/* ---- BOX GRID ---- */
.box-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
@media (max-width: 1100px) { .box-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .box-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .box-grid { grid-template-columns: 1fr; } }

/* ---- BOX CARD ---- */
.box-card {
  background: var(--white);
  border-radius: 16px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}
.box-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.box-card-img {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  position: relative;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}
.box-card-cat-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.3s ease;
}
.box-card:hover .box-card-cat-img {
  transform: scale(1.04);
}
/* --- Collage (4-item preview) --- */
.box-card-collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 100%;
  height: 100%;
  gap: 2px;
}
.collage-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.box-card:hover .collage-img {
  transform: scale(1.04);
}
.badge-top-left {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  z-index: 1;
}
.badge-available { background: var(--green-bg); color: var(--green); }
.badge-sold { background: var(--red-bg); color: var(--red); }
.badge-discount {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--red);
  color: var(--white);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  z-index: 1;
}
.box-card-body {
  padding: 16px;
}
.box-card-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
  line-height: 1.3;
}
.box-card-cat {
  color: var(--blue);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}
.box-card-subcat {
  color: var(--muted);
  font-weight: 400;
}
.box-card-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.price-original {
  text-decoration: line-through;
  color: var(--muted);
  font-size: 13px;
}
.price-final {
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
}
.price-normal {
  font-size: 18px;
  font-weight: 700;
  color: var(--black);
}
.discount-source {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
.box-card-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.btn-add-cart {
  width: 100%;
  padding: 10px;
  background: var(--black);
  color: var(--white);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.15s;
}
.btn-add-cart:hover { opacity: 0.85; }
.btn-add-cart.in-cart {
  background: var(--soft);
  color: var(--black);
}
.btn-add-cart:disabled {
  background: var(--soft);
  color: var(--muted);
  cursor: not-allowed;
}

/* ---- BUTTONS ---- */
.btn {
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { opacity: 0.85; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--black); }
.btn-outline:hover { border-color: var(--black); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { opacity: 0.85; }
.btn-blue { background: var(--blue); color: var(--white); }
.btn-blue:hover { opacity: 0.85; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-full { width: 100%; justify-content: center; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #444;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  color: var(--black);
  background: var(--white);
  transition: border-color 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--black);
}
.form-input.error { border-color: var(--red); }
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  color: var(--black);
  background: var(--white);
  cursor: pointer;
}
.form-select:focus { outline: none; border-color: var(--black); }
.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
}

/* ---- ALERT BOXES ---- */
.alert {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
}
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-info { background: #eff6ff; color: var(--blue); }
.alert-warning { background: var(--orange-bg); color: var(--orange); }

/* ---- DISCLAIMER CARD ---- */
.disclaimer-card {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.7;
  color: #1e3a5f;
}
.disclaimer-card p { margin-bottom: 4px; }
.disclaimer-card p:last-child { margin-bottom: 0; }
.disclaimer-card a { color: #1d4ed8; text-decoration: underline; }

/* ---- STATUS PILLS ---- */
.status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.status-pending { background: var(--orange-bg); color: var(--orange); }
.status-confirmed { background: #ecfdf5; color: #059669; }
.status-processing { background: #eff6ff; color: var(--blue); }
.status-ready { background: #ecfdf5; color: #059669; }
.status-out_for_delivery { background: #fff7ed; color: #d97706; }
.status-fulfilled { background: var(--green-bg); color: var(--green); }
.status-available { background: var(--green-bg); color: var(--green); }
.status-sold { background: var(--red-bg); color: var(--red); }
.status-cancelled { background: #f3f4f6; color: #6b7280; }
.status-rejected { background: var(--red-bg); color: var(--red); }
.item-status-damaged { background: var(--orange-bg); color: var(--orange); border-color: #fed7aa; }

/* Sorting: direct action buttons */
.item-action-btns { display: flex; gap: 4px; }
.iab { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--white); cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center; transition: all 0.12s; flex-shrink: 0; }
.iab:hover { background: var(--soft); }
.iab-found.active  { background: #dcfce7; border-color: #86efac; color: #16a34a; }
.iab-missing.active { background: #fee2e2; border-color: #fca5a5; color: var(--red); }
.iab-damaged.active { background: #fff7ed; border-color: #fed7aa; color: var(--orange); }

/* Row highlight on SKU jump — stays until officer acts on the item */
.item-row-highlight { background: #fef08a !important; outline: 2px solid #ca8a04; outline-offset: -2px; }

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
html[dir="rtl"] th { text-align: right; }
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ---- PAGE HEADER ---- */
.page-header {
  margin-bottom: 28px;
}
.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.page-subtitle { color: var(--muted); }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}
.empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.empty-text { color: var(--muted); margin-bottom: 24px; }

/* ---- BREADCRUMB ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--blue); }
.breadcrumb span { color: var(--muted); }

/* ---- BOX DETAIL ---- */
.box-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
@media (max-width: 768px) { .box-detail-layout { grid-template-columns: 1fr; } }
.box-detail-img {
  height: 320px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 100px;
  border: 1.5px solid var(--border);
  overflow: hidden;
}
.box-detail-cat-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.box-img-name-overlay {
  position: absolute;
  top: 16px; left: 16px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 8px;
  letter-spacing: 0.01em;
  line-height: 1.3;
  max-width: calc(100% - 32px);
}
.box-detail-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  line-height: 1.2;
}
.box-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tag {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.tag-blue { background: #eff6ff; color: var(--blue); }
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-purple { background: var(--purple-bg); color: var(--purple); }
.tag-gray { background: var(--soft); color: #555; }

.price-breakdown-card {
  background: var(--soft);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
}
.price-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}
.price-breakdown-row.total {
  border-top: 1.5px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
  font-weight: 700;
  font-size: 18px;
}
.price-breakdown-row.total .price-final { font-size: 22px; }
.saving-text { color: var(--green); font-size: 13px; }

.box-stats { display: flex; gap: 20px; margin-bottom: 24px; }
.box-stat { text-align: center; }
.box-stat-val { font-size: 22px; font-weight: 800; }
.box-stat-label { font-size: 12px; color: var(--muted); }

/* ---- ITEMS TABLE ---- */
.items-section { margin-top: 40px; }
.items-section h2 { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.item-name-ar { direction: rtl; text-align: right; font-size: 14px; }
.item-thumb {
  width: 48px; height: 48px;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
  margin: 0 auto;
}
.item-thumb:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.item-thumb-placeholder {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--soft);
  border-radius: 6px;
  margin: 0 auto;
}
.item-thumb-placeholder img {
  width: 32px; height: 32px;
  object-fit: contain;
  opacity: 0.45;
}

/* ---- LIGHTBOX ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.82);
  cursor: pointer;
}
.lightbox-img {
  position: relative; z-index: 1;
  max-width: 90vw; max-height: 85vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 48px rgba(0,0,0,.5);
}
.lightbox-close {
  position: absolute; top: 18px; right: 22px; z-index: 2;
  background: rgba(255,255,255,.15);
  border: none; color: #fff;
  font-size: 22px; line-height: 1;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }

/* ---- CART ---- */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) { .cart-layout { grid-template-columns: 1fr; } }

.cart-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item-img {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 700; margin-bottom: 4px; }
.cart-item-meta { font-size: 13px; color: var(--muted); }
.cart-item-price { font-weight: 700; font-size: 16px; text-align: right; }
.cart-item-original { font-size: 12px; color: var(--muted); text-decoration: line-through; }
.cart-item-remove {
  background: none;
  color: var(--muted);
  font-size: 18px;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.15s;
}
.cart-item-remove:hover { background: var(--red-bg); color: var(--red); }

.order-summary {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  position: sticky;
  top: 88px;
}
.order-summary h3 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.summary-total {
  display: flex;
  justify-content: space-between;
  padding: 14px 0 0;
  font-size: 18px;
  font-weight: 800;
}
.summary-note {
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0;
  line-height: 1.5;
}

/* ---- AUTH ---- */
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) { .auth-layout { grid-template-columns: 1fr; } }
.auth-left {
  background: var(--black);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
@media (max-width: 768px) { .auth-left { display: none; } }
.auth-left-inner { max-width: 400px; }
.auth-left h1 { font-size: 36px; font-weight: 800; margin-bottom: 24px; letter-spacing: -1px; }
.auth-left .benefit {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 15px;
  opacity: 0.9;
}
.auth-left .benefit-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--bg);
}
.auth-form { width: 100%; max-width: 400px; }
.auth-logo { font-size: 24px; font-weight: 800; margin-bottom: 32px; }
.auth-logo .dot { color: var(--blue); }
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 28px;
}
.auth-tab {
  padding: 10px 0;
  margin-right: 24px;
  font-weight: 600;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.auth-tab.active { color: var(--black); border-bottom-color: var(--black); }

/* ---- CHECKOUT ---- */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) { .checkout-layout { grid-template-columns: 1fr; } }

/* ---- CONFIRMATION ---- */
.confirm-center {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  padding: 48px 24px;
}
.confirm-check {
  width: 80px;
  height: 80px;
  background: var(--green-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 24px;
}
.confirm-title { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.confirm-ref { font-size: 20px; color: var(--blue); font-weight: 700; margin-bottom: 16px; }
.confirm-boxes { text-align: left; margin: 28px 0; }
.confirm-box-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

/* ---- ORDERS PAGE ---- */
.orders-list { display: flex; flex-direction: column; gap: 16px; }
.order-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.order-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
}
.order-card-ref { font-weight: 700; font-size: 16px; }
.order-card-date { font-size: 13px; color: var(--muted); }
.order-card-total { font-weight: 700; margin-left: auto; }
.order-card-body {
  display: none;
  padding: 0 22px 18px;
  border-top: 1px solid var(--border);
}
.order-card-body.open { display: block; }

/* ---- LOADING SPINNER ---- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px;
}

/* ---- ADMIN SIDEBAR ---- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 240px;
  background: var(--black);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}
.admin-sidebar-logo {
  padding: 0 24px 24px;
  font-size: 18px;
  font-weight: 800;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}
.admin-sidebar-logo .dot { color: var(--blue); }
.admin-sidebar-logo .nav-logo-img { background: #fff; border-radius: 8px; padding: 6px 12px; width: 100%; box-sizing: border-box; }
.admin-sidebar-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 2px;
  font-weight: 400;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s;
  cursor: pointer;
}
.admin-nav-item:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.admin-nav-item.active { background: rgba(255,255,255,0.12); color: var(--white); }
.admin-nav-icon { font-size: 16px; width: 20px; text-align: center; }
.admin-content {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  max-width: calc(1280px + 240px);
}
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }
  .admin-sidebar.open {
    transform: translateX(0);
    visibility: visible !important;
  }
  .admin-content {
    margin-left: 0;
    padding-top: 68px;
  }
  .admin-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 199;
  }
  .admin-mobile-overlay.open { display: block; }
  .admin-hamburger {
    display: flex;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 201;
    background: var(--black);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
}
@media (min-width: 769px) {
  .admin-hamburger { display: none; }
}

/* ---- ADMIN STATS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---- IMPORT DRAG-DROP ---- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--blue);
  background: #eff6ff;
}
.drop-icon { font-size: 48px; margin-bottom: 12px; }
.drop-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.drop-sub { color: var(--muted); font-size: 14px; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 24px 0;
}
@media (max-width: 768px) { .preview-grid { grid-template-columns: repeat(2, 1fr); } }
.preview-stat {
  background: var(--soft);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.preview-stat-val { font-size: 28px; font-weight: 800; }
.preview-stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---- DISCOUNT PANEL ---- */
.discounts-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 1000px) { .discounts-layout { grid-template-columns: 1fr; } }

.discount-section { margin-bottom: 28px; }
.discount-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.discount-tag {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.discount-tag-global { background: var(--purple-bg); color: var(--purple); }
.discount-tag-category { background: #eff6ff; color: var(--blue); }
.discount-tag-subcategory { background: #f0fdf4; color: #16a34a; }
.discount-tag-brand { background: #fdf4ff; color: #9333ea; }
.discount-tag-box { background: var(--orange-bg); color: var(--orange); }

.discount-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--soft);
  border-radius: 10px;
  margin-bottom: 8px;
}
.discount-item-info { flex: 1; font-size: 14px; }
.discount-item-pct { font-weight: 700; font-size: 16px; }

/* ---- HAMBURGER BUTTON ---- */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 18px;
  color: var(--black);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--soft); }
.hamburger-btn.open { background: var(--soft); }

/* ---- MOBILE MENU ---- */
.mobile-menu {
  display: none;
  position: fixed;
  top: 54px;
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1.5px solid var(--border);
  z-index: 99;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  padding: 8px 0;
}
.mobile-menu.open { display: block; }
.mobile-menu-link {
  display: block;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--black);
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.mobile-menu-link:last-of-type { border-bottom: none; }
.mobile-menu-link:hover { background: var(--soft); }
.mobile-menu-link.active { color: var(--blue); }
.mobile-menu-lang {
  display: flex;
  gap: 4px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.mobile-menu-lang span {
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  background: var(--soft);
}
.mobile-menu-lang span.active {
  background: var(--black);
  color: var(--white);
}

/* ---- MOBILE RESPONSIVE ---- */
@media (max-width: 640px) {
  /* Nav — hide desktop items, show hamburger */
  .nav-inner { padding: 0 14px; gap: 8px; height: 54px; }
  .nav-links { display: none; }
  .lang-toggle { display: none; }
  #nav-auth-btn { display: none; }
  .hamburger-btn { display: flex; }
  .cart-btn { padding: 7px 12px; font-size: 13px; white-space: nowrap; }

  /* Page */
  .page { padding: 20px 14px; }
  .page-title { font-size: 22px; }
  .page-subtitle { font-size: 13px; }

  /* Category pills — smaller so more are visible */
  .pill { width: 104px; height: 76px; border-radius: 12px; }
  .pill span { font-size: 11px; padding: 0 8px 7px; }

  /* Filter bar */
  .filter-bar { gap: 8px; }
  .sort-select { margin-left: 0; width: 100%; }

  /* Box grid — 2 columns on mobile */
  .box-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .box-card-img { height: 130px; }
  .box-card-body { padding: 10px; }
  .box-card-name { font-size: 13px; margin-bottom: 3px; }
  .box-card-cat { font-size: 12px; margin-bottom: 6px; }
  .price-normal, .price-final { font-size: 15px; }
  .price-original { font-size: 12px; }
  .box-card-meta { font-size: 11px; margin-bottom: 10px; }
  .btn-add-cart { padding: 8px; font-size: 13px; }

  /* Box detail */
  .box-detail-title { font-size: 22px; }
  .box-stats { gap: 16px; flex-wrap: wrap; }
  .box-stat-val { font-size: 18px; }

  /* Cart */
  .cart-item { gap: 10px; }
  .cart-item-img { width: 56px; height: 56px; }

  /* Orders */
  .order-card-header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }
  .order-card-body { padding: 0 16px 14px; }

  /* Breadcrumb */
  .breadcrumb { font-size: 12px; gap: 5px; flex-wrap: wrap; }

  /* Items table — hide SKU (col3) and Store (col5) */
  .items-section th:nth-child(3),
  .items-section td:nth-child(3),
  .items-section th:nth-child(5),
  .items-section td:nth-child(5) { display: none; }
  .item-name-ar { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
}

/* Small phones (≤480px): keep 2-column grid */
@media (max-width: 480px) {
  .box-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- STAFF PAGE ---- */
.staff-grid { display: flex; flex-direction: column; gap: 12px; }
.staff-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.staff-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.staff-info { flex: 1; }
.staff-name { font-weight: 700; margin-bottom: 2px; }
.staff-email { font-size: 13px; color: var(--muted); }
.role-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.role-super_admin { background: var(--purple-bg); color: var(--purple); }
.role-fulfillment { background: var(--green-bg); color: var(--green); }
.role-sorting_officer { background: #eff6ff; color: var(--blue); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.modal {
  background: var(--white);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.15);
  margin: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-size: 20px; font-weight: 700; }
.modal-close {
  background: var(--soft);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

/* ---- UTILITIES ---- */
.text-muted { color: var(--muted); }
.text-blue { color: var(--blue); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ---- ADMIN LOGIN ---- */
.admin-login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.admin-login-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.admin-login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.admin-login-logo h1 { font-size: 26px; font-weight: 800; }
.admin-login-logo p { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---- RTL (Arabic) ---- */
/* NOTE: inherited direction:rtl from html[dir="rtl"] already reverses flex row order.
   Do NOT add flex-direction:row-reverse — it cancels out inherited rtl, producing LTR.
   Exception: .category-pills has explicit direction:ltr override so row-reverse works there. */
html[dir="rtl"] body { font-family: 'Cairo', 'Outfit', sans-serif; }
html[dir="rtl"] .category-pills { direction: ltr; flex-direction: row-reverse; }
html[dir="rtl"] .nav-right { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .sort-select { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .box-card-body { text-align: right; }
html[dir="rtl"] .box-card-price { justify-content: flex-start; }
html[dir="rtl"] .discount-source { text-align: right; }
html[dir="rtl"] .page-header { text-align: right; }
html[dir="rtl"] .saving-text { text-align: right; }
html[dir="rtl"] .cart-item-price { text-align: left; }
html[dir="rtl"] .cart-item-info { text-align: right; }
html[dir="rtl"] .summary-note { text-align: right; }
html[dir="rtl"] .order-summary h3 { text-align: right; }
html[dir="rtl"] .order-card-total { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .form-label { text-align: right; }
html[dir="rtl"] .form-input, html[dir="rtl"] .form-select, html[dir="rtl"] textarea.form-input { text-align: right; direction: rtl; }
/* Phone inputs always LTR so + prefix renders on the left */
html[dir="rtl"] input[type="tel"] { direction: ltr; text-align: left; }
html[dir="rtl"] .mobile-menu-link { text-align: right; }
html[dir="rtl"] .badge-top-left { left: auto; right: 12px; }
html[dir="rtl"] .badge-discount { right: auto; left: 12px; }
html[dir="rtl"] .auth-left h1, html[dir="rtl"] .auth-left p, html[dir="rtl"] .auth-left .benefit { text-align: right; direction: rtl; }
html[dir="rtl"] .box-stat { text-align: right; }
html[dir="rtl"] .items-section h2 { text-align: right; }
html[dir="rtl"] .confirm-center { direction: rtl; }
html[dir="rtl"] .order-card-ref, html[dir="rtl"] .order-card-date { text-align: right; }
@media (max-width: 640px) {
  html[dir="rtl"] .subcategory-pills { flex-direction: row; flex-wrap: nowrap; }
  html[dir="rtl"] .subsubcategory-pills { flex-direction: row; flex-wrap: nowrap; }
}

/* ---- SEARCH INPUT ---- */
.search-input-wrap {
  position: relative;
}
.search-input-wrap input {
  padding-left: 36px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
}

/* ── Site Footer ──────────────────────────────────────────────────────────── */
.site-footer {
  background: #1a1a2e;
  color: rgba(255,255,255,0.7);
  margin-top: 56px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.footer-middle {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.footer-terms {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.footer-logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.85;
  display: block;
  margin-bottom: 10px;
}
.footer-tagline {
  font-size: 13px;
  opacity: 0.65;
  margin: 0 0 4px;
}
.footer-hours {
  font-size: 12px;
  opacity: 0.4;
  margin: 0;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}
.footer-link:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.07);
  text-align: center;
  padding: 12px 24px;
  font-size: 11px;
  color: rgba(255,255,255,0.25);
}
@media (max-width: 540px) {
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .footer-middle, .footer-terms { align-items: flex-start; }
}
/* RTL: flex row reverses automatically — brand moves right, terms moves left */
html[dir="rtl"] .footer-inner { direction: rtl; }
html[dir="rtl"] .footer-terms { align-items: flex-start; }
html[dir="rtl"] .footer-brand { align-items: flex-start; }

