/* ============================================================
   TrendWriter Dashboard — Base CSS (Shared Variables + Layout)
   يُستورد في كل صفحة
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

/* ── CSS Variables ───────────────────────────────────────────── */
:root {
  --em:       #34d399;
  --green:    #22c55e;
  --amber:    #f59e0b;
  --red:      #ef4444;
  --purple:   #a78bfa;
  --blue:     #60a5fa;
  --accent:   #10b981;

  --bg:       #020617;
  --bg2:      #0b1322;
  --bg3:      #0f172a;
  --surface:  #1e293b;
  --surface2: #0d1117;

  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.04);

  --tx1:      #f1f5f9;
  --tx2:      #cbd5e1;
  --tx3:      #64748b;
  --tx4:      #475569;

  --sidebar-w: 240px;
  --font-sans: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
  --font-mono: 'Inter', ui-monospace, monospace;
  --radius:    10px;
  --radius-lg: 14px;
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--tx2);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ── App Shell Layout ────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg3);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  overflow-y: auto;
}

.brand { padding: 6px 8px 18px; border-bottom: 1px solid var(--border2); margin-bottom: 14px; }
.brand-logo {
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: 22px;
  background: linear-gradient(135deg, #34d399, #10b981 55%, #059669);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub   { font-size: 11px; color: var(--tx3); margin-top: 4px; }
.version-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25);
  color: #34d399; font-size: 10px; font-weight: 600;
}
.version-badge::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: #10b981; box-shadow: 0 0 6px #10b981;
}

/* ── Nav ─────────────────────────────────────────────────────── */
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-label {
  font-size: 10px; color: var(--tx3); text-transform: uppercase;
  letter-spacing: .12em; font-weight: 600;
  padding: 8px 10px 6px; font-family: 'Inter', sans-serif;
}
.nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; background: transparent; border: 1px solid transparent;
  color: #94a3b8; font: inherit; font-size: 13.5px; font-weight: 500;
  border-radius: 8px; cursor: pointer; text-align: right;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-btn .nav-ico { font-size: 15px; width: 20px; text-align: center; }
.nav-btn:hover  { background: rgba(255,255,255,.03); color: var(--tx1); }
.nav-btn.active { background: rgba(16,185,129,.13); color: #34d399; border-color: rgba(16,185,129,.25); }

/* ── Sidebar Footer ──────────────────────────────────────────── */
.sidebar-foot { padding-top: 12px; border-top: 1px solid var(--border2); display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.02); }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg,#10b981,#059669);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Inter',sans-serif; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.user-chip .who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-chip .name { color: var(--tx1); font-size: 12.5px; font-weight: 600; }
.user-chip .role { color: var(--tx3); font-size: 10.5px; }
.logout-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.18);
  color: #f87171; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500;
  text-align: right; transition: background .15s; width: 100%;
}
.logout-btn:hover { background: rgba(239,68,68,.12); }

/* ── Main Content ────────────────────────────────────────────── */
.main {
  flex: 1; overflow-y: auto; padding: 32px 36px 48px;
  background: radial-gradient(800px 400px at 20% -10%, rgba(16,185,129,.04), transparent 60%), var(--bg);
}
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: rgba(255,255,255,.06); border-radius: 8px; }
.main::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.1); }

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--border2);
}
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--tx3); }
.breadcrumb .sep { opacity: .4; }
.breadcrumb .crumb-active { color: #94a3b8; }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* ── Section Head ────────────────────────────────────────────── */
.section-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
h2.section-title { font-size: 22px; font-weight: 700; color: var(--tx1); letter-spacing: -.01em; }
.section-subtitle { color: #94a3b8; font-size: 13.5px; line-height: 1.55; max-width: 720px; }

/* ── Loading Screen ──────────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; flex-direction: column; gap: 16px;
}
#loading-screen .spin {
  width: 36px; height: 36px; border: 3px solid rgba(16,185,129,.2);
  border-top-color: #10b981; border-radius: 50%; animation: spin .8s linear infinite;
}
#loading-screen p { color: var(--tx3); font-size: 13px; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.fade-in { animation: fadeIn .2s ease; }
