/*
 * NEXUS OS — Gorilla Clean Design System v1
 * Option B: Inter font · Indigo accent · Persistent sidebar
 * Extends themes.css (load after it)
 */
@import url('./fa.css');

/* ── Base font override ──────────────────────────────────────────────────── */
/* Inter font is injected as <link> by db.php — NOT @import (would block render) */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  transition: background 0.2s, color 0.2s;
}

/* ── Dark theme — Gorilla Clean ──────────────────────────────────────────── */
html[data-theme="dark"] {
  --bg:       #0f1117;
  --bg2:      #161b27;
  --s1:       #1c2233;
  --s2:       #212840;
  --s3:       #26304a;
  --surface:  #1c2233;
  --surface2: #212840;
  --surface3: #26304a;

  /* Indigo replaces cyan as primary accent */
  --accent:     #4f46e5;
  --accent-dim: rgba(79,70,229,.14);
  --accent-bg:  rgba(79,70,229,.09);
  --accent-bg2: rgba(79,70,229,.18);
  --accent-glow:rgba(79,70,229,.30);
  --cyan:       #4f46e5;
  --cyan-dim:   rgba(79,70,229,.14);
  --cyan-bg:    rgba(79,70,229,.09);
  --cyan-bg2:   rgba(79,70,229,.18);
  --border-cyan:rgba(79,70,229,.30);

  /* Keep semantic colors */
  --green:   #10b981;
  --amber:   #f59e0b;
  --red:     #ef4444;
  --purple:  #a78bfa;
  --blue:    #60a5fa;

  --text:        #e2e8f0;
  --text-dim:    #94a3b8;
  --text-muted:  #4a5568;
  --dim:         #94a3b8;
  --muted:       #4a5568;

  --border:      rgba(255,255,255,.07);
  --border2:     rgba(255,255,255,.04);

  --topbar-bg:     rgba(15,17,23,.97);
  --topbar-border: rgba(79,70,229,.15);
  --topbar-hover:  rgba(79,70,229,.08);

  --input-bg:     #1c2233;
  --input-border: rgba(79,70,229,.25);
  --input-focus:  rgba(79,70,229,.45);

  --scroll-track: #161b27;
  --scroll-thumb: #2a3250;

  --shadow:    0 4px 24px rgba(0,0,0,.5);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.65);

  /* Sidebar */
  --sidebar-bg:      #0c0e16;
  --sidebar-border:  rgba(79,70,229,.12);
  --sidebar-item:    rgba(79,70,229,.0);
  --sidebar-hover:   rgba(79,70,229,.10);
  --sidebar-active:  rgba(79,70,229,.18);
  --sidebar-text:    #64748b;
  --sidebar-label:   #334155;
  --sidebar-width:   220px;
}

/* ── Light theme — Gorilla Light ─────────────────────────────────────────── */
html[data-theme="light"] {
  --bg:       #f8fafc;
  --bg2:      #f1f5f9;
  --s1:       #ffffff;
  --s2:       #f8fafc;
  --s3:       #f1f5f9;
  --surface:  #ffffff;
  --surface2: #f8fafc;
  --surface3: #f1f5f9;

  --accent:     #4f46e5;
  --accent-dim: rgba(79,70,229,.10);
  --accent-bg:  rgba(79,70,229,.07);
  --accent-bg2: rgba(79,70,229,.14);
  --accent-glow:rgba(79,70,229,.20);
  --cyan:       #4f46e5;
  --cyan-dim:   rgba(79,70,229,.10);
  --cyan-bg:    rgba(79,70,229,.07);
  --cyan-bg2:   rgba(79,70,229,.14);
  --border-cyan:rgba(79,70,229,.25);

  --green:   #059669;
  --amber:   #d97706;
  --red:     #dc2626;
  --purple:  #7c3aed;
  --blue:    #2563eb;

  --text:        #0f172a;
  --text-dim:    #475569;
  --text-muted:  #94a3b8;
  --dim:         #475569;
  --muted:       #94a3b8;

  --border:      rgba(15,23,42,.08);
  --border2:     rgba(15,23,42,.05);

  --topbar-bg:     #ffffff;
  --topbar-border: rgba(15,23,42,.08);
  --topbar-hover:  rgba(79,70,229,.06);

  --input-bg:     #ffffff;
  --input-border: rgba(15,23,42,.15);
  --input-focus:  rgba(79,70,229,.35);

  --scroll-track: #f1f5f9;
  --scroll-thumb: #cbd5e1;

  --shadow:    0 1px 3px rgba(15,23,42,.07), 0 4px 16px rgba(15,23,42,.06);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow-lg: 0 8px 32px rgba(15,23,42,.12);

  /* Sidebar */
  --sidebar-bg:      #ffffff;
  --sidebar-border:  rgba(15,23,42,.07);
  --sidebar-hover:   rgba(79,70,229,.07);
  --sidebar-active:  rgba(79,70,229,.11);
  --sidebar-text:    #64748b;
  --sidebar-label:   #94a3b8;
  --sidebar-width:   220px;
}

/* ── Pro theme sidebar tokens ────────────────────────────────────────────── */
html[data-theme="pro"] {
  --accent:      #6366f1;
  --accent-dim:  rgba(99,102,241,.14);
  --accent-bg:   rgba(99,102,241,.10);
  --accent-bg2:  rgba(99,102,241,.18);
  --accent-glow: rgba(99,102,241,.30);

  --sidebar-bg:     #0a0c14;
  --sidebar-border: rgba(99,102,241,.14);
  --sidebar-hover:  rgba(99,102,241,.10);
  --sidebar-active: rgba(99,102,241,.18);
  --sidebar-text:   #4a5370;
  --sidebar-label:  #2a3050;
  --sidebar-width:  220px;
}

/* ── Sidebar layout ──────────────────────────────────────────────────────── */
.nx-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width, 220px);
  height: 100vh;
  background: var(--sidebar-bg, var(--bg));
  border-right: 1px solid var(--sidebar-border, var(--border));
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), background 0.2s;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
.nx-sidebar::-webkit-scrollbar { width: 3px; }
.nx-sidebar::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 2px; }

/* Logo section */
.nx-sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--sidebar-border, var(--border));
  flex-shrink: 0;
}
.nx-sb-logo-icon {
  width: 30px; height: 30px;
  background: var(--accent-bg2, rgba(79,70,229,.18));
  border: 1px solid var(--accent-bg2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent, #4f46e5);
  font-size: 14px;
  flex-shrink: 0;
}
.nx-sb-brand {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--text);
  line-height: 1.1;
}
.nx-sb-version {
  font-size: 9px;
  color: var(--sidebar-text);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* User pill */
.nx-sb-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sidebar-border, var(--border));
  flex-shrink: 0;
}
.nx-sb-avatar {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--accent-bg2);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.nx-sb-uname { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.2; }
.nx-sb-urole { font-size: 10px; color: var(--sidebar-text); }

/* Nav */
.nx-sb-nav { flex: 1; padding: 8px 0; }
.nx-sb-section {
  padding: 10px 16px 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sidebar-label, #334155);
}
.nx-sb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 16px;
  margin: 1px 6px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--sidebar-text, #64748b);
  font-size: 13px;
  font-weight: 500;
  transition: background .13s, color .13s;
  position: relative;
}
.nx-sb-item:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}
.nx-sb-item.active {
  background: var(--sidebar-active);
  color: var(--accent);
  font-weight: 600;
}
.nx-sb-item.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--accent);
  border-radius: 2px;
}
.nx-sb-icon {
  width: 16px;
  text-align: center;
  font-size: 12px;
  flex-shrink: 0;
  opacity: .7;
}
.nx-sb-item.active .nx-sb-icon,
.nx-sb-item:hover .nx-sb-icon { opacity: 1; }

/* Badge on sidebar item */
.nx-sb-badge {
  margin-left: auto;
  min-width: 18px; height: 18px;
  background: var(--red, #ef4444);
  border-radius: 9px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* Bottom section: theme + logout */
.nx-sb-footer {
  padding: 10px 10px 14px;
  border-top: 1px solid var(--sidebar-border, var(--border));
  flex-shrink: 0;
}
.nx-sb-themes {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.nx-sb-th {
  flex: 1;
  height: 28px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 11px;
  color: var(--sidebar-text);
  transition: all .13s;
}
.nx-sb-th:hover { background: var(--sidebar-hover); color: var(--text); }
.nx-sb-th.active { background: var(--accent-bg2); color: var(--accent); border-color: var(--accent-bg2); }

.nx-sb-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: rgba(239,68,68,.6);
  font-size: 12px;
  font-weight: 500;
  transition: all .13s;
}
.nx-sb-logout:hover { background: rgba(239,68,68,.08); color: var(--red, #ef4444); }

/* ── Body padding when sidebar is active ─────────────────────────────────── */
body.nx-has-sidebar {
  padding-left: var(--sidebar-width, 220px);
}

/* ── Topbar adjustments with sidebar ─────────────────────────────────────── */
body.nx-has-sidebar .topbar {
  /* topbar is sticky inside padded body — no adjustment needed */
}

/* ── Mobile: sidebar hidden, toggle button ───────────────────────────────── */
@media (max-width: 768px) {
  .nx-sidebar {
    transform: translateX(-100%);
  }
  .nx-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  body.nx-has-sidebar {
    padding-left: 0;
  }
  .nx-sb-toggle {
    display: flex !important;
  }
  .nx-overlay {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
  }
}

.nx-sb-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: var(--sidebar-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
}
.nx-overlay { display: none; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes nx-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes nx-slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes nx-pulse-badge {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15); }
}
@keyframes nx-skeleton {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.nx-animate { animation: nx-fade-in 0.15s ease-out; }
.nx-animate-slide { animation: nx-slide-in 0.15s ease-out; }

/* Skeleton loader */
.nx-skeleton {
  background: linear-gradient(90deg,
    var(--border2) 0%,
    var(--border) 50%,
    var(--border2) 100%
  );
  background-size: 200% 100%;
  animation: nx-skeleton 1.4s ease-in-out infinite;
  border-radius: 6px;
}

/* Ripple on click */
.nx-ripple {
  position: relative;
  overflow: hidden;
}
.nx-ripple::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(79,70,229,.25);
  transform: scale(0);
  animation: nx-ripple-anim 0.4s ease-out;
  pointer-events: none;
}
@keyframes nx-ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Toast notifications ─────────────────────────────────────────────────── */
#nx-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.nx-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  animation: nx-fade-in 0.18s ease-out;
  transition: opacity 0.2s, transform 0.2s;
}
.nx-toast.leaving {
  opacity: 0;
  transform: translateX(20px);
}
.nx-toast-icon { font-size: 14px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.nx-toast-body { flex: 1; }
.nx-toast-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.nx-toast-msg   { font-size: 12px; color: var(--dim); margin-top: 2px; line-height: 1.4; }
.nx-toast-close { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 13px; padding: 0; margin-left: 4px; }
.nx-toast-close:hover { color: var(--text); }

/* ── Common utility overrides with Inter ─────────────────────────────────── */
/* Override Orbitron/Rajdhani references in topbar to Inter */
.tb-brand     { font-family: 'Inter', sans-serif !important; font-weight: 800 !important; font-size: 13px !important; letter-spacing: .02em !important; }
.tb-mod       { font-family: 'Inter', sans-serif !important; font-size: 12px !important; letter-spacing: .04em !important; }
.tb-clock     { font-family: 'Inter', monospace !important; font-size: 12px !important; }
.tb-uname     { font-family: 'Inter', sans-serif !important; }
.tb-role-badge{ font-family: 'Inter', sans-serif !important; font-size: 9px !important; }
.tb-notif-title{ font-family: 'Inter', sans-serif !important; }
.tb-mark-all  { font-family: 'Inter', sans-serif !important; font-size: 11px !important; }
.tb-notif-msg { font-family: 'Inter', sans-serif !important; font-size: 12px !important; }
.tb-notif-time{ font-family: 'Inter', sans-serif !important; font-size: 10px !important; }

/* Accent color for topbar active items */
.tb-th.active {
  background: var(--accent-bg2, rgba(79,70,229,.18)) !important;
  color: var(--accent, #4f46e5) !important;
  border-color: var(--accent-bg2) !important;
}
.tb-brand { color: var(--accent, #4f46e5) !important; }
.tb-logo-icon { background: var(--accent-bg) !important; border-color: var(--accent-bg2) !important; color: var(--accent) !important; }
.tb-bell-badge { background: var(--red, #ef4444) !important; }
.tb-mark-all { color: var(--accent) !important; }

/* ── Cross-module topbar theme consistency ───────────────────────────────── */
/* Many modules have hardcoded background:rgba(5,5,8,.97) — override with theme var */
.topbar,
.wa-topbar,
.lc-topbar {
  background: var(--topbar-bg, rgba(5,5,8,.97)) !important;
  border-bottom-color: var(--topbar-border, rgba(255,255,255,.06)) !important;
  font-family: 'Inter', sans-serif !important;
}

/* Light theme: topbar white */
html[data-theme="light"] .topbar,
html[data-theme="light"] .wa-topbar,
html[data-theme="light"] .lc-topbar {
  background: var(--topbar-bg, #ffffff) !important;
  border-bottom: 1px solid var(--topbar-border, rgba(15,23,42,.08)) !important;
}

/* Force Inter on all logo/brand/nav text inside any topbar variant */
.topbar *,
.wa-topbar *,
.lc-topbar * {
  font-family: 'Inter', sans-serif;
}

/* body::before grid/glow — modules use this for decorative bg overlays */
/* Ensure it doesn't bleed hardcoded cyan on light/pro themes */
body::before {
  opacity: var(--bg-overlay-opacity, 1);
}
html[data-theme="light"] body::before { opacity: .4; }

/* ── Sidebar attendance warning banner ───────────────────────────────────── */
.nx-sb-warn {
  margin: 6px 8px 0;
  padding: 8px 10px;
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 11px;
  color: var(--amber, #f59e0b);
  line-height: 1.35;
  text-decoration: none;
  transition: background .15s;
  flex-shrink: 0;
}
.nx-sb-warn:hover {
  background: rgba(245,158,11,.14);
  color: var(--amber, #f59e0b);
}
.nx-sb-warn i { font-size: 12px; margin-top: 1px; flex-shrink: 0; }

/* ── Font Awesome override — prevent Inter from stomping FA font-family ── */
.fa-solid, .fas { font-family: "Font Awesome 6 Free" !important; font-weight: 900 !important; }
.fa-regular, .far { font-family: "Font Awesome 6 Free" !important; font-weight: 400 !important; }
.fa-brands, .fab { font-family: "Font Awesome 6 Brands" !important; font-weight: 400 !important; }
