/* SoloX — shared design system */
:root {
  --lime: #C8FF00;
  --lime-soft: #d6ff3a;
  --teal: #00F5C4;
  --red: #FF5050;
  --amber: #FFB347;

  --bg: #0A0A0C;
  --bg-1: #101013;
  --bg-2: #16161B;
  --bg-3: #1D1D24;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.16);
  --text: #F2F2F4;
  --text-2: #A8A8B3;
  --text-3: #6B6B78;

  --glass: rgba(255,255,255,0.04);
  --glass-2: rgba(255,255,255,0.06);

  --r-card: 16px;
  --r-btn: 10px;
  --r-pill: 999px;

  --shadow-lime: 0 12px 40px -12px rgba(200,255,0,0.35);
  --shadow-card: 0 30px 60px -30px rgba(0,0,0,0.6);

  --font-h: "Clash Display", "Syne", "Inter", system-ui, sans-serif;
  --font-b: "DM Sans", "Inter", system-ui, sans-serif;
  --font-m: "Space Mono", ui-monospace, monospace;
  --font-h-ar: "Noto Kufi Arabic", "Cairo", system-ui, sans-serif;
  --font-b-ar: "Cairo", system-ui, sans-serif;
}

[data-theme="light"] {
  --bg: #F4F4F1;
  --bg-1: #FAFAF7;
  --bg-2: #FFFFFF;
  --bg-3: #EFEFEA;
  --line: rgba(10,10,12,0.08);
  --line-strong: rgba(10,10,12,0.16);
  --text: #0A0A0C;
  --text-2: #4A4A55;
  --text-3: #8A8A95;
  --glass: rgba(10,10,12,0.03);
  --glass-2: rgba(10,10,12,0.05);
  --shadow-card: 0 30px 60px -30px rgba(0,0,0,0.18);
  --lime: #7AAA00;
  --lime-soft: #8BBB00;
  --shadow-lime: 0 12px 40px -12px rgba(122,170,0,0.4);
}

[data-theme="light"] .pill.lime { color: #5A8200; background: rgba(122,170,0,0.10); border-color: rgba(122,170,0,0.3); }
[data-theme="light"] .btn-primary { background: var(--lime); color: #fff; }
[data-theme="light"] .kpi.lime .val { color: #5A8200; }
[data-theme="light"] .feat:hover::before { background: #7AAA00; }
[data-theme="light"] .sidebar .nav-item.active { background: rgba(122,170,0,0.12); color: #5A8200; }

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[lang="ar"] { font-family: var(--font-b-ar); }
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3, [lang="ar"] h4, [lang="ar"] .logo-text { font-family: var(--font-h-ar); font-weight: 800; }
[lang="ar"] .mono, [lang="ar"] .num, [lang="ar"] [class*="mono"] { font-family: var(--font-m); }

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

h1, h2, h3, h4 { font-family: var(--font-h); font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.05; }
.mono { font-family: var(--font-m); font-feature-settings: "tnum"; }

/* ── Logo ── */
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-h); font-weight: 900; font-size: 22px; letter-spacing: -0.02em;
}
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  display: grid; place-items: center;
  position: relative; overflow: hidden;
}
.logo-mark::before, .logo-mark::after {
  content: ""; position: absolute; width: 6px; height: 26px; border-radius: 2px; top: 3px;
  transform-origin: center;
}
.logo-mark::before { background: var(--lime); transform: rotate(28deg); left: 13px; box-shadow: 0 0 14px rgba(200,255,0,0.7); }
.logo-mark::after  { background: var(--text); transform: rotate(-28deg); left: 13px; }
.logo-text { display: inline-flex; }
.logo-text .x { color: var(--lime); font-style: italic; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--r-btn);
  font-weight: 600; font-size: 14px; letter-spacing: -0.01em;
  transition: transform .2s ease-out, background .2s, box-shadow .2s, border-color .2s;
  white-space: nowrap;
}
.btn-primary { background: var(--lime); color: #0A0A0C; box-shadow: var(--shadow-lime); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 50px -10px rgba(200,255,0,0.55); }
.btn-ghost { background: var(--glass); border: 1px solid var(--line-strong); color: var(--text); backdrop-filter: blur(20px); }
.btn-ghost:hover { background: var(--glass-2); border-color: var(--text-2); }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 10px; background: var(--glass); border: 1px solid var(--line); }
.btn-icon:hover { background: var(--glass-2); }

/* ── Cards ── */
.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  backdrop-filter: blur(20px);
}

/* ── Pills / Badges ── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  background: var(--glass); border: 1px solid var(--line); color: var(--text-2);
}
.pill.lime { background: rgba(200,255,0,0.12); color: var(--lime); border-color: rgba(200,255,0,0.3); }
.pill.teal { background: rgba(0,245,196,0.12); color: var(--teal); border-color: rgba(0,245,196,0.3); }
.pill.red  { background: rgba(255,80,80,0.12); color: var(--red); border-color: rgba(255,80,80,0.3); }
.pill.amber{ background: rgba(255,179,71,0.14); color: var(--amber); border-color: rgba(255,179,71,0.3); }
.pill.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Topbar shared (utility nav) ── */
.global-topbar {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; gap: 6px; padding: 6px;
  background: rgba(20,20,25,0.7); backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px;
}
[data-theme="light"] .global-topbar { background: rgba(255,255,255,0.7); }
.global-topbar a {
  padding: 8px 14px; border-radius: 999px; color: var(--text-2);
  transition: background .2s, color .2s;
}
.global-topbar a:hover { color: var(--text); background: var(--glass); }
.global-topbar a.active { background: var(--lime); color: #0A0A0C; font-weight: 600; }

/* ── Theme + lang toggles (floating) ── */
.float-controls {
  position: fixed; top: 16px; right: 16px; z-index: 60;
  display: flex; gap: 8px;
}
[dir="rtl"] .float-controls { right: auto; left: 16px; }
.float-controls button {
  height: 38px; min-width: 38px; padding: 0 12px; border-radius: 999px;
  background: rgba(20,20,25,0.7); backdrop-filter: blur(20px);
  border: 1px solid var(--line); color: var(--text);
  font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
[data-theme="light"] .float-controls button { background: rgba(255,255,255,0.8); }

/* ── Glow grid bg ── */
.bg-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.55; pointer-events: none;
}

@keyframes orbDrift {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(35px,-25px) scale(1.06); }
  66% { transform: translate(-25px,18px) scale(0.95); }
}
.orb { animation: orbDrift 14s ease-in-out infinite; }
.orb:nth-child(2) { animation-delay:-7s; animation-duration:18s; }
.orb:nth-child(3) { animation-delay:-3s; animation-duration:11s; }

/* ── Form fields ── */
.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--lime);
  box-shadow: 0 0 0 4px rgba(200,255,0,0.15);
}

/* skeleton */
.skel { background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%); background-size: 200% 100%; animation: skel 1.4s infinite; border-radius: 8px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }

/* utility */
.row { display: flex; gap: 16px; }
.col { display: flex; flex-direction: column; gap: 16px; }
.grow { flex: 1; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }

/* dashboard shell */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: var(--bg); }
[dir="rtl"] .app-shell { grid-template-columns: 1fr 240px; }
.sidebar {
  background: var(--bg-1); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--line); order: 2; }
.sidebar .nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 10px; color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background .2s, color .2s;
}
.sidebar .nav-item:hover { background: var(--glass); color: var(--text); }
.sidebar .nav-item.active { background: var(--lime); color: #0A0A0C; font-weight: 600; }
.sidebar .nav-item.active svg { stroke: #0A0A0C; }
.sidebar .nav-section { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; color: var(--text-3); padding: 18px 12px 6px; text-transform: uppercase; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px; padding: 0 28px; display: flex; align-items: center; gap: 16px;
  border-bottom: 1px solid var(--line); background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.topbar .search {
  flex: 1; max-width: 480px; height: 40px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 0 14px; color: var(--text-2);
}
.topbar .search input { background: none; border: none; outline: none; flex: 1; font-size: 14px; }

.page { padding: 28px; display: flex; flex-direction: column; gap: 24px; }

/* svg icon stroke uses currentColor */
svg.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── FIX 4 — Numbers always Latin ── */
input[type="number"], input[type="range"],
.mono, .num, .val, [class*="-val"], [class*="num-"] {
  font-family: var(--font-m) !important;
  font-feature-settings: "tnum" 1;
  -webkit-font-feature-settings: "tnum" 1;
}
[lang="ar"] .mono,
[lang="ar"] [class*="val"],
[lang="ar"] [class*="num"] {
  direction: ltr;
  unicode-bidi: embed;
}

/* ── FIX 10 — WhatsApp button ── */
.wa-btn {
  position:fixed; bottom:24px;
  width:56px; height:56px; border-radius:50%;
  background:#25D366; display:grid; place-items:center;
  box-shadow:0 4px 24px rgba(37,211,102,0.4);
  transition:transform .25s, box-shadow .25s; z-index:99;
}
[dir="ltr"] .wa-btn { right:24px; }
[dir="rtl"] .wa-btn { left:24px; }
.wa-btn:hover { transform:scale(1.1); box-shadow:0 8px 36px rgba(37,211,102,0.55); }
.wa-btn svg { width:28px; height:28px; fill:white; }

/* ── Bottom mobile nav ── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg-1); border-top: 1px solid var(--line);
  height: 64px; padding: 0 8px;
  display: none; align-items: center; justify-content: space-around;
}
.bottom-nav a {
  flex: 1; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 10px; font-weight: 600;
  text-decoration: none; transition: color .2s;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--lime); }
.bottom-nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── Page load fade-up animation ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .5s ease-out both; }
.fade-up:nth-child(1) { animation-delay: .05s; }
.fade-up:nth-child(2) { animation-delay: .10s; }
.fade-up:nth-child(3) { animation-delay: .15s; }
.fade-up:nth-child(4) { animation-delay: .20s; }
.fade-up:nth-child(5) { animation-delay: .25s; }
.fade-up:nth-child(6) { animation-delay: .30s; }

/* ── Button click scale ── */
.btn:active { transform: scale(0.97) !important; }

/* ── Card hover glow ── */
.card:hover, .kpi:hover, .chart-card:hover {
  border-color: rgba(200,255,0,0.2);
  box-shadow: 0 0 0 1px rgba(200,255,0,0.08), var(--shadow-card);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
  display: none; place-items: center;
}
.modal-overlay.open { display: grid; }
.modal {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 20px;
  padding: 32px; min-width: 420px; max-width: 90vw;
  animation: modalIn .2s ease-out both;
}
@keyframes modalIn {
  from { opacity:0; transform: scale(.94); }
  to   { opacity:1; transform: scale(1); }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-head h2 { font-size: 22px; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-3); color: var(--text-2); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr !important; }
  .sidebar { display: none !important; }
  .bottom-nav { display: flex !important; }
  .main { padding-bottom: 64px; }
  .kpis, .ministats, .charts-row, .stats-row, .alerts { grid-template-columns: 1fr 1fr !important; }
  .kanban { grid-template-columns: 1fr !important; }
  .calc-wrap { grid-template-columns: 1fr !important; }
  .comm-shell { grid-template-columns: 1fr !important; }
  .comm-left, .comm-right { display: none !important; }
  .page { padding: 16px !important; }
  .topbar { padding: 0 16px !important; }
  .float-controls { top: 8px; right: 8px; }
  [dir="rtl"] .float-controls { right: auto; left: 8px; }
  .wa-btn { bottom: 80px; }
}
@media (max-width: 480px) {
  .kpis, .ministats, .charts-row, .stats-row, .alerts { grid-template-columns: 1fr !important; }
}
