/* ============================================================
   SIRHATIC QUANTUM — Design System CSS
   Dark theme, OHADA Africa-inspired
   ============================================================ */

:root {
  --q-bg:        #0a0e1a;
  --q-bg2:       #0f1929;
  --q-surface:   #141e2e;
  --q-surface2:  #1a2540;
  --q-border:    rgba(255,255,255,0.08);
  --q-text:      #e2e8f0;
  --q-muted:     #64748b;
  --q-accent:    #f59e0b;
  --q-sidebar-w: 272px;
  --q-topbar-h:  56px;
  --q-radius:    12px;
  --q-shadow:    0 4px 24px rgba(0,0,0,0.4);
}

/* BASE */
* { box-sizing: border-box; }

body.quantum-body {
  background: var(--q-bg);
  color: var(--q-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.quantum-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--q-sidebar-w);
  background: linear-gradient(180deg, #0d1520 0%, #0a1018 100%);
  border-right: 1px solid var(--q-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--q-border);
  min-height: 70px;
  flex-shrink: 0;
}

.sidebar-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
}

.sidebar-user { border-bottom: 1px solid var(--q-border); }

.user-avatar { opacity: 0.7; }

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--q-muted);
  padding: 0.5rem 0.75rem 0.25rem;
  margin-top: 0.25rem;
}

.sidebar-nav { margin: 0.5rem 0; flex: 1; }

.sidebar-item { margin-bottom: 2px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 450;
  transition: all 0.15s ease;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar-item.active .sidebar-link {
  background: linear-gradient(90deg, rgba(245,158,11,0.18), rgba(245,158,11,0.06));
  color: var(--q-accent);
  border-left: 3px solid var(--q-accent);
}

.sidebar-link i { font-size: 1rem; flex-shrink: 0; width: 18px; text-align: center; }

.sidebar-footer { border-top: 1px solid var(--q-border); flex-shrink: 0; }

/* ── Nav Groups (collapsible sections) ─────────────────────── */
.nav-group { margin-bottom: 2px; }

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
  text-align: left;
}

.nav-group-toggle:hover {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.7);
}

.nav-group-toggle.expanded,
.nav-group-toggle[aria-expanded="true"] {
  color: rgba(255,255,255,0.75);
}

.nav-group-toggle .toggle-arrow {
  font-size: 0.6rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-group-toggle[aria-expanded="true"] .toggle-arrow,
.nav-group-toggle.expanded .toggle-arrow {
  transform: rotate(180deg);
}

.nav-group-toggle i:first-child {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.nav-group-items {
  padding: 2px 0 4px 8px;
  margin: 0;
  border-left: 1px solid rgba(255,255,255,0.05);
  margin-left: 16px;
}

.sidebar-item.disabled .sidebar-link {
  opacity: 0.35;
  cursor: not-allowed;
}

.sidebar-item.disabled .sidebar-link:hover {
  background: transparent;
  color: rgba(255,255,255,0.6);
}

.soon-badge {
  margin-left: auto;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(100,116,139,0.3);
  color: #94a3b8;
  border-radius: 3px;
  padding: 1px 4px;
  flex-shrink: 0;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.quantum-main {
  margin-left: var(--q-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.quantum-topbar {
  height: var(--q-topbar-h);
  background: rgba(10,14,26,0.95);
  border-bottom: 1px solid var(--q-border);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.quantum-content { flex: 1; padding-bottom: 3rem; }

/* ============================================================
   CARDS
   ============================================================ */
.quantum-card {
  background: var(--q-surface);
  border: 1px solid var(--q-border);
  border-radius: var(--q-radius);
  padding: 1.25rem;
  box-shadow: var(--q-shadow);
}

.kpi-card { transition: transform 0.15s, box-shadow 0.15s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.5); }

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.kpi-value { font-size: 1.1rem; line-height: 1.2; }
.kpi-label { line-height: 1.2; }

/* ============================================================
   TABLES
   ============================================================ */
.quantum-table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: rgba(255,255,255,0.04);
  font-size: 0.875rem;
}

.quantum-table thead th {
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--q-border);
  color: var(--q-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  white-space: nowrap;
}

.quantum-table tbody td {
  border-color: var(--q-border);
  padding: 0.7rem 1rem;
  vertical-align: middle;
}

.quantum-table tfoot td {
  border-top: 2px solid var(--q-border);
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.02);
}

.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: rgba(245,158,11,0.04); }

/* ============================================================
   FORMS
   ============================================================ */
.form-control-dark,
select.form-control-dark,
textarea.form-control-dark {
  background: rgba(255,255,255,0.05) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: #fff !important;
  border-radius: 8px;
}

.form-control-dark:focus,
select.form-control-dark:focus {
  background: rgba(255,255,255,0.08) !important;
  border-color: var(--q-accent) !important;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12) !important;
  color: #fff !important;
}

.form-control-dark::placeholder { color: rgba(255,255,255,0.3) !important; }
.form-control-dark option { background: var(--q-surface2); color: #fff; }
select.form-select.form-control-dark { padding-right: 2rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 6px;
  line-height: 1.4;
}

.btn-warning { color: #000 !important; }
.btn-warning:hover { color: #000 !important; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { font-weight: 500; }

/* ============================================================
   MOBILE TOGGLE
   ============================================================ */
.sidebar-toggle-btn {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 1100;
  display: none;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 999;
  display: none;
}

.sidebar-overlay.active { display: block; }

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */
@media (max-width: 767.98px) {
  .quantum-sidebar {
    transform: translateX(-100%);
  }
  .quantum-sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.6);
  }
  .quantum-main {
    margin-left: 0;
  }
  .sidebar-toggle-btn {
    display: flex !important;
  }
  .quantum-topbar {
    padding-left: 3.5rem;
  }
  .kpi-value { font-size: 0.95rem; }
  .quantum-card { padding: 1rem; }
}

@media (max-width: 575.98px) {
  .quantum-table { font-size: 0.8rem; }
  .quantum-table thead th,
  .quantum-table tbody td { padding: 0.5rem 0.65rem; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .quantum-sidebar, .quantum-topbar { display: none !important; }
  .quantum-main { margin-left: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .quantum-card { border: 1px solid #ddd !important; background: #fff !important; }
}
