/* ============================================================
   ANOK.MA — Design System v2
   Dark / Light mode + RTL + Language Switcher
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Serif+Display:ital@0;1&family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap');

/* ── Theme Variables ─────────────────────────────────────── */
:root {
  /* Dark mode (default) */
  --bg:          #050d1a;
  --surface:     #0a1628;
  --surface2:    #0f1f35;
  --surface3:    #162540;
  --border:      #1a2e4a;
  --border-soft: rgba(26,46,74,0.6);

  --blue:        #2563eb;
  --blue-light:  #3b82f6;
  --blue-dim:    rgba(37,99,235,0.15);
  --blue-glow:   rgba(37,99,235,0.3);

  --green:       #10b981;
  --green-dim:   rgba(16,185,129,0.15);
  --red:         #ef4444;
  --red-dim:     rgba(239,68,68,0.15);
  --amber:       #f59e0b;
  --amber-dim:   rgba(245,158,11,0.15);
  --purple:      #a78bfa;
  --purple-dim:  rgba(167,139,250,0.15);

  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --text-dim:    #94a3b8;

  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.3);

  --navbar-h:    62px;
  --transition:  0.2s cubic-bezier(.4,0,.2,1);
}

/* Light mode overrides */
[data-theme="light"] {
  --bg:          #f0f4f8;
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --surface3:    #f1f5f9;
  --border:      #e2e8f0;
  --border-soft: rgba(226,232,240,0.8);

  --blue:        #1d4ed8;
  --blue-light:  #2563eb;
  --blue-dim:    rgba(37,99,235,0.08);
  --blue-glow:   rgba(37,99,235,0.15);

  --green-dim:   rgba(16,185,129,0.1);
  --red-dim:     rgba(239,68,68,0.1);
  --amber-dim:   rgba(245,158,11,0.1);
  --purple-dim:  rgba(167,139,250,0.1);

  --text:        #0f172a;
  --text-muted:  #64748b;
  --text-dim:    #475569;

  --shadow:      0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.06);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  font-family: 'Sora', sans-serif;
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

[lang="ar"] body,
[lang="ar"] .ar-font {
  font-family: 'Noto Naskh Arabic', 'Sora', sans-serif;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; }
::placeholder { color: var(--text-muted); }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--blue); border-radius: 4px; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeUp    { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn    { from { opacity:0; } to { opacity:1; } }
@keyframes pulse     { 0%,100%{opacity:1;} 50%{opacity:0.4;} }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes shimmer   { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
@keyframes slideDown { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:translateY(0)} }

.fade-up   { animation: fadeUp 0.5s cubic-bezier(.4,0,.2,1) both; }
.fade-up-1 { animation: fadeUp 0.5s 0.08s both; }
.fade-up-2 { animation: fadeUp 0.5s 0.16s both; }
.fade-up-3 { animation: fadeUp 0.5s 0.24s both; }
.fade-up-4 { animation: fadeUp 0.5s 0.32s both; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  position: fixed; top:0; left:0; right:0; z-index:100;
  height: var(--navbar-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

.navbar-brand { display:flex; align-items:center; gap:10px; flex-shrink:0; }

.navbar-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: white;
  box-shadow: 0 0 20px var(--blue-glow);
  flex-shrink: 0;
}

.navbar-name { font-weight: 800; font-size: 20px; letter-spacing: -0.5px; }
.navbar-name span { color: var(--blue-light); }

.navbar-right {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

/* ── Theme Toggle ────────────────────────────────────────── */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 17px; transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--blue); background: var(--blue-dim); }

/* ── Language Dropdown ───────────────────────────────────── */
.lang-dropdown {
  position: relative;
}

.lang-current {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 12px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text); transition: all var(--transition);
  white-space: nowrap;
}
.lang-current:hover { border-color: var(--blue); background: var(--blue-dim); color: var(--blue-light); }

.lang-flag { font-size: 16px; line-height: 1; }
.lang-label { font-size: 12px; font-weight: 700; }
.lang-arrow { font-size: 9px; color: var(--text-muted); margin-left: 2px; transition: transform var(--transition); }
.lang-dropdown.open .lang-arrow { transform: rotate(180deg); }

.lang-menu {
  position: absolute; top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 150px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
  z-index: 200;
  animation: slideDown 0.15s ease;
}
[dir="rtl"] .lang-menu { right: auto; left: 0; }

.lang-dropdown.open .lang-menu { display: block; }

.lang-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-dim); transition: all 0.15s;
  cursor: pointer;
}
.lang-menu-item:hover { background: var(--surface2); color: var(--text); }
.lang-menu-item--active { color: var(--blue-light); background: var(--blue-dim); }
.lang-check { margin-left: auto; color: var(--blue-light); font-size: 12px; }
[dir="rtl"] .lang-check { margin-left: 0; margin-right: auto; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: all var(--transition); border: 1px solid transparent;
  padding: 10px 22px; white-space: nowrap; font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: white; box-shadow: 0 4px 16px var(--blue-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(37,99,235,0.5); }
.btn-ghost  { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--blue-light); color: var(--blue-light); background: var(--blue-dim); }
.btn-danger  { background: var(--red-dim);    color: var(--red);    border-color: rgba(239,68,68,0.3); }
.btn-success { background: var(--green-dim);  color: var(--green);  border-color: rgba(16,185,129,0.3); }
.btn-amber   { background: var(--amber-dim);  color: var(--amber);  border-color: rgba(245,158,11,0.3); }
.btn-lg  { padding: 14px 32px; font-size: 16px; border-radius: 12px; }
.btn-sm  { padding: 7px 14px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: background var(--transition), border-color var(--transition);
}
.card-header {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 18px;
}

/* ── Form Elements ───────────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
.form-label  { font-size: 12px; font-weight: 700; color: var(--text-muted); display: block; margin-bottom: 6px; }
.form-input  {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 16px; color: var(--text);
  font-size: 14px; width: 100%; transition: border var(--transition), background var(--transition);
  font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--blue); background: var(--surface3); }
.form-input.error { border-color: var(--red); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input   { cursor: pointer; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 700;
}
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-amber  { background: var(--amber-dim);  color: var(--amber); }
.badge-blue   { background: var(--blue-dim);   color: var(--blue-light); }
.badge-purple { background: var(--purple-dim); color: var(--purple); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: var(--green-dim);  border: 1px solid rgba(16,185,129,0.3); color: var(--green); }
.alert-error   { background: var(--red-dim);    border: 1px solid rgba(239,68,68,0.3);  color: var(--red); }
.alert-info    { background: var(--blue-dim);   border: 1px solid rgba(37,99,235,0.3);  color: var(--blue-light); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
[dir="rtl"] th { text-align: right; }
td { padding: 14px 16px; font-size: 13px; border-bottom: 1px solid var(--border-soft); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--blue-dim); }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 100px 24px 80px; text-align: center; position: relative; z-index: 1;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 28px;
  background: rgba(37,99,235,0.08); border: 1px solid rgba(37,99,235,0.2);
  border-radius: 30px; padding: 6px 16px;
}
.hero-badge-dot  { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
.hero-badge-text { font-size: 11px; font-weight: 700; color: #93c5fd; letter-spacing: 0.5px; }

.hero-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(34px, 5.5vw, 62px); line-height: 1.1; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text) 40%, #93c5fd);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
[lang="ar"] .hero-title {
  font-family: 'Noto Naskh Arabic', serif;
  font-size: clamp(28px, 4.5vw, 52px);
}

.hero-sub { font-size: 17px; color: var(--text-dim); line-height: 1.8; margin-bottom: 40px; max-width: 580px; }

/* ── Analyzer ────────────────────────────────────────────── */
.analyzer-box {
  display: flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; max-width: 620px; margin: 0 auto 14px;
  box-shadow: 0 0 50px rgba(37,99,235,0.06);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.analyzer-box:focus-within { border-color: var(--blue); box-shadow: 0 0 50px rgba(37,99,235,0.15); }
.analyzer-icon  { padding: 0 16px; display: flex; align-items: center; color: var(--text-muted); }
.analyzer-input {
  flex: 1; background: transparent; border: none; color: var(--text);
  font-size: 15px; padding: 15px 8px; font-family: inherit;
}
.analyzer-input:focus { outline: none; }
.analyzer-btn {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: white; border: none; padding: 0 28px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all var(--transition); font-family: inherit;
  display: flex; align-items: center; gap: 8px; min-width: 140px; justify-content: center;
}
.analyzer-btn:hover { background: linear-gradient(135deg, #1e40af, #1d4ed8); }

/* ── Stats / Trust ───────────────────────────────────────── */
.trust-badges { display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; margin-top: 52px; }
.trust-badge  { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; font-weight: 500; }

.hero-stats    { display: flex; justify-content: center; gap: 52px; margin-top: 60px; flex-wrap: wrap; }
.hero-stat-num { font-family: 'DM Serif Display', serif; font-size: 34px; color: var(--text); }
.hero-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Steps / Pricing cards ───────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }

/* ── Score Ring ──────────────────────────────────────────── */
.score-header { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.score-stats  { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.score-stat-num   { font-weight: 800; font-size: 22px; }
.score-stat-label { color: var(--text-muted); font-size: 12px; margin-left: 3px; }
[dir="rtl"] .score-stat-label { margin-left: 0; margin-right: 3px; }

/* ── Report Tabs ─────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }
.tab {
  padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; color: var(--text-muted);
  border: 1px solid transparent; background: transparent; font-family: inherit;
}
.tab.active { background: var(--blue-dim); color: var(--blue-light); border-color: rgba(37,99,235,0.3); }
.tab:hover:not(.active) { color: var(--text); background: var(--surface2); }

/* ── Check Rows ──────────────────────────────────────────── */
.check-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px;
  transition: border-color var(--transition);
}
.check-row:hover { border-color: var(--border-soft); }
[dir="rtl"] .check-row { flex-direction: row-reverse; }

.check-icon {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; margin-top: 2px;
}
.check-icon.pass { background: var(--green-dim); color: var(--green); }
.check-icon.fail { background: var(--red-dim);   color: var(--red); }
.check-title  { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.check-detail { font-size: 13px; color: var(--text-muted); }

/* ── AI Fix ──────────────────────────────────────────────── */
.ai-fix-box {
  margin-top: 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
}
.ai-fix-label { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ai-fix-code {
  background: #020810; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; font-family: monospace; font-size: 12px; color: #a5f3fc;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
[data-theme="light"] .ai-fix-code { background: #1e293b; }
.ai-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 20px; font-size: 10px; font-weight: 700;
  background: linear-gradient(135deg, var(--blue-dim), var(--purple-dim));
  border: 1px solid rgba(99,102,241,0.3); color: var(--purple);
}

/* ── Locked overlay ──────────────────────────────────────── */
.locked-overlay {
  position: absolute; inset: 0;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  border-radius: 14px;
}

/* ── Admin sidebar ───────────────────────────────────────── */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 230px; background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 3px;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; overflow-y: auto;
  transition: background var(--transition);
}
.admin-main { margin-left: 230px; padding: 32px; min-height: 100vh; flex: 1; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text-muted); transition: all 0.15s; border: 1px solid transparent;
  background: transparent; width: 100%; text-align: left; font-family: inherit;
}
.sidebar-item:hover { background: var(--surface2); color: var(--text); }
.sidebar-item.active { background: var(--blue-dim); color: var(--blue-light); border-color: rgba(37,99,235,0.3); }
.sidebar-icon  { font-size: 16px; width: 20px; text-align: center; }
.sidebar-badge { margin-left: auto; background: var(--amber); color: black; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 1px 6px; }

/* ── Stat cards ──────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px; position: relative; overflow: hidden;
  transition: background var(--transition);
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-color, var(--blue)), transparent);
}
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 10px; }
.stat-value { font-size: 30px; font-weight: 800; }
.stat-icon  { position: absolute; top: 16px; right: 16px; font-size: 22px; opacity: 0.4; }

/* ── Page headers ────────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title  { font-family: 'DM Serif Display', serif; font-size: 26px; margin-bottom: 4px; }
.page-sub    { color: var(--text-muted); font-size: 14px; }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--blue); border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}

/* ── Background decorations ──────────────────────────────── */
.bg-glow {
  position: fixed; top: -20%; left: 50%; transform: translateX(-50%);
  width: 80%; height: 60%; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse, rgba(37,99,235,0.08) 0%, transparent 70%);
  transition: opacity var(--transition);
}
[data-theme="light"] .bg-glow { opacity: 0.3; }

.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
                    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 50px 50px; opacity: 0.25;
}
[data-theme="light"] .bg-grid { opacity: 0.4; }

/* ── WhatsApp btn ────────────────────────────────────────── */
.whatsapp-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: #25d366; color: white; border-radius: 12px;
  padding: 14px 28px; font-weight: 700; font-size: 16px;
  box-shadow: 0 4px 20px rgba(37,211,102,0.3); transition: all var(--transition);
}
.whatsapp-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(37,211,102,0.5); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .navbar-name .long { display: none; }
  .hero { padding: 80px 16px 60px; }
  .hero-stats { gap: 28px; }
  .score-header { flex-direction: column; }
  .analyzer-box { flex-direction: column; }
  .analyzer-btn { border-radius: 0 0 13px 13px; padding: 14px; width: 100%; }
  .admin-sidebar { width: 100%; position: static; }
  .admin-main { margin-left: 0; padding: 16px; }
  .admin-wrap { flex-direction: column; }
  .lang-label { display: none; }
}
