/* =========================================================================
   دليل — توفير المنتجات (B2B ⇄ السبلاي)
   Design tokens مأخوذة من هوية منصة دليل (Fire Opal + Cetacean Blue)
   ========================================================================= */
:root {
  --ds-primary: #ea5849;
  --ds-primary-active: #ea8070;
  --fire-opal-200: #f4a8a0;

  --ds-success: #10924b;
  --ds-success-light: #e8fff3;

  --card-radius: 0.75rem;

  /* LIGHT theme */
  --app-bg: #f5f8fa;
  --content-bg: #ffffff;
  --card-border: #f1f1f2;
  --separator: #e4e6ef;
  --text-strong: #181c32;
  --text-body: #3f4254;
  --text-muted: #7e8299;
  --text-faint: #b5b5c3;
  --surface-hover: #f9f9f9;
  --pill-bg: #fff0ee;
  --card-shadow: 0 0 30px 0 rgba(82, 63, 105, 0.05);
}

[data-theme="dark"] {
  --app-bg: #0d0d1d;
  --content-bg: #1e1e2d;
  --card-border: #2b2b40;
  --separator: #323248;
  --text-strong: #ffffff;
  --text-body: #cdcdde;
  --text-muted: #9a9cae;
  --text-faint: #565674;
  --surface-hover: #2b2b40;
  --pill-bg: rgba(234, 88, 73, 0.15);
  --card-shadow: none;
  --ds-success-light: rgba(16, 146, 75, 0.15);
}

* { box-sizing: border-box; font-family: "IBM Plex Sans Arabic", sans-serif; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--app-bg);
  color: var(--text-body);
  font-size: 0.95rem;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}
a { text-decoration: none; color: inherit; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 100;
  height: 70px; background: var(--content-bg);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.03);
}
.header-inner {
  height: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; gap: 1rem;
}
.header-start { display: flex; align-items: center; gap: 1rem; }
.header-end { display: flex; align-items: center; gap: 0.75rem; }
.logo-img { height: 38px; display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

.icon-btn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 0.5rem; background: transparent; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--ds-primary); }

.header-search { position: relative; align-items: center; width: 300px; display: flex; }
.header-search svg { position: absolute; inset-inline-start: 0.9rem; color: var(--text-faint); pointer-events: none; }
.header-search input {
  width: 100%; height: 44px; border: none; background: var(--surface-hover);
  color: var(--text-body); border-radius: 0.75rem; padding-inline: 2.8rem 1rem;
  font-size: 0.9rem; outline: none;
}
.header-search input::placeholder { color: var(--text-muted); }

/* Body layout */
.app-body { display: flex; align-items: flex-start; }
.app-sidebar {
  width: 255px; flex: none; position: sticky; top: 70px;
  height: calc(100vh - 70px); overflow-y: auto; padding: 1.25rem 0.9rem;
}
.app-content { flex-grow: 1; min-width: 0; padding: 1.5rem; }
.content-container { max-width: 1100px; margin: 0 auto; }

/* Sidebar nav */
.side-label { font-size: 0.72rem; font-weight: 700; color: var(--text-faint); padding: 0.5rem 0.9rem; letter-spacing: .3px; }
.side-link {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.8rem 0.9rem;
  border-radius: 0.6rem; color: var(--text-body); font-weight: 500; font-size: 0.92rem;
  cursor: pointer; transition: all 0.12s ease; margin-bottom: 3px;
}
.side-link:hover { background: var(--surface-hover); }
.side-link.active { background: var(--pill-bg); color: var(--ds-primary); font-weight: 700; }
.side-link .count {
  margin-inline-start: auto; font-size: 0.78rem; font-weight: 700;
  background: var(--surface-hover); color: var(--text-muted); min-width: 26px; text-align: center;
  padding: 2px 8px; border-radius: 50px;
}
.side-link.active .count { background: var(--ds-primary); color: #fff; }

/* Page head */
.page-head { margin-bottom: 1.25rem; }
.page-title { display: flex; align-items: center; gap: 0.55rem; font-size: 1.4rem; font-weight: 700; color: var(--text-strong); margin: 0; }
.page-title svg { color: var(--ds-primary); }
.page-sub { color: var(--text-muted); font-size: 0.9rem; margin: 0.4rem 0 0; }

/* Table card */
.card {
  background: var(--content-bg); border: 1px solid var(--card-border); border-radius: var(--card-radius);
  box-shadow: var(--card-shadow); overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
thead th {
  color: var(--text-faint); font-size: 0.75rem; font-weight: 700;
  text-align: right; padding: 0.9rem 1.25rem; white-space: nowrap; border-bottom: 1px solid var(--separator);
  text-transform: uppercase; letter-spacing: .3px;
}
tbody td { padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--separator); vertical-align: middle; font-size: 0.9rem; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }
.prod-name { font-weight: 600; color: var(--text-strong); }
.prod-sku { color: var(--text-faint); font-size: 0.75rem; margin-top: 2px; direction: ltr; text-align: right; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.7rem;
  border-radius: 50px; font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }

/* on/off switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 50px; background: var(--separator);
  transition: 0.2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; inset-block: 3px; inset-inline-end: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--ds-success); }
.switch input:checked + .slider::before { transform: translateX(-20px); }

.empty { padding: 4rem 1rem; text-align: center; color: var(--text-muted); }
.empty svg { opacity: 0.35; margin-bottom: 0.75rem; }

/* Mobile */
.menu-btn { display: none; }
@media (max-width: 991px) {
  .app-sidebar { display: none; }
  .header-search { width: 190px; }
  .menu-btn { display: flex; }
}
@media (max-width: 600px) {
  .header-search { display: none; }
  .app-content { padding: 1rem; }
}

/* Mobile sidebar drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(9,15,48,.5); z-index: 200; display: none; }
.drawer-overlay.show { display: block; }
.drawer {
  position: fixed; inset-block: 0; inset-inline-end: 0; width: 260px; background: var(--content-bg);
  z-index: 201; padding: 1rem 0.9rem; transform: translateX(-100%); transition: transform .2s ease; overflow-y: auto;
}
.drawer.show { transform: translateX(0); }
/* على سطح المكتب لا يظهر الـ drawer نهائيًا — القائمة في الشريط الجانبي فقط */
@media (min-width: 992px) { .drawer, .drawer-overlay { display: none !important; } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background-color: var(--separator); border-radius: 10px; }
::-webkit-scrollbar-track { background-color: transparent; }
