/* ============================================================
   PAAUMENTOR — Global Stylesheet
   ============================================================ */

/* Self-hosted so fonts render offline (was Google Fonts CDN). */
@import url('../vendor/fonts/app-fonts.css');

/* ---------- CSS Variables ---------- */
:root {
  --bg:         #f4f6fb;
  --surface:    #ffffff;
  --surface-2:  #f0f4ff;
  --border:     #e2e8f0;
  --text:       #0f172a;
  --text-2:     #334155;
  --text-3:     #64748b;
  --blue-400:   #8fa3c8;
  --blue-500:   #1e3a8a;
  --blue-600:   #172554;
  --blue-700:   #0f1b33;
  --blue-100:   #e9edf5;
  --success:    #10b981;
  --danger:     #ef4444;
  --gold:       #f59e0b;
  --shadow:     0 1px 4px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
}

[data-theme="dark"] {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface-2: #253044;
  --border:    #334155;
  --text:      #f1f5f9;
  --text-2:    #cbd5e1;
  --text-3:    #94a3b8;
  --blue-100:  #263450;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
a { text-decoration: none; color: inherit; }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.app-layout { display: flex; height: calc(100vh - 64px); overflow: hidden; }

/* ---------- Navbar ---------- */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
}
.nav-inner {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 32px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  flex-shrink: 0;
}
.nav-logo {
  width: 36px; height: 36px;
  background: #1e3a8a;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.85rem; font-weight: 800;
}
.nav-brand-text span { color: var(--gold); }
.nav-links { display: flex; gap: 24px; flex: 1; }
.nav-links a {
  font-size: 0.88rem; font-weight: 500;
  color: var(--text-3);
  transition: color 0.2s;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav-links a.active,
.nav-links a:hover { color: var(--blue-500); border-bottom-color: var(--blue-500); }
.nav-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* ---------- Sidebar (dark navy — enterprise) ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #0f1b33;
  border-right: 1px solid #1c2a4a;
  padding: 20px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: calc(100vh - 80px);
  overflow: hidden;
}
.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  padding: 16px 12px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  color: #aab8d4;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  color: #ffffff;
}
.sidebar-link.active {
  background: rgba(90,120,220,0.22);
  color: #ffffff;
}
.sidebar-link .icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* old Edge/IE */
}
.sidebar-nav::-webkit-scrollbar { display: none; }  /* Chrome/Safari */
.sidebar-link svg { flex-shrink: 0; opacity: 0.8; }
.sidebar-link:hover svg, .sidebar-link.active svg { opacity: 1; }
.sidebar-link .count {
  margin-left: auto;
  background: rgba(255,255,255,0.12);
  color: #dbe4f5;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 7px;
}
/* Bottom padding reserves clearance for the floating AI chat button */
.main-content { flex: 1; padding: 28px 32px 110px; overflow-y: auto; overflow-x: hidden; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow);
}

/* ---------- Stat Cards ---------- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}
.stat-label { font-size: 0.78rem; color: var(--text-3); font-weight: 500; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 7px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary  { background: var(--blue-500); color: #fff; }
.btn-primary:hover  { background: var(--blue-600); }
.btn-outline  { background: transparent; color: var(--text-2); border: 1.5px solid var(--border); }
.btn-outline:hover  { border-color: var(--blue-500); color: var(--blue-500); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-gold     { background: var(--gold); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: 0.8rem; }

/* ---------- Forms ---------- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--text-2); }
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 0.88rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge-blue  { background: var(--blue-100); color: var(--blue-500); }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-gray  { background: var(--surface-2); color: var(--text-3); }
.badge-gold  { background: #fef3c7; color: #92400e; }

/* ---------- Avatars ---------- */
.avatar {
  border-radius: 50%;
  background: #1e3a8a;
  color: #fff;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.72rem; }
.avatar-md { width: 42px; height: 42px; font-size: 0.88rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.4rem; }

/* ---------- Progress bar ---------- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--blue-500);
  border-radius: 999px;
  transition: width 0.5s ease;
}
.progress-fill.green { background: var(--success); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th { background: var(--surface-2); padding: 10px 14px; text-align: left; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1;
  color: var(--text-2);
  transition: all 0.2s;
}
.theme-toggle:hover { background: var(--blue-100); }
/* Show moon in light mode, sun in dark mode (both icons live inside the button) */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Section headings ---------- */
.section-title { font-family: 'Sora', sans-serif; font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; }
.section-sub { font-size: 0.88rem; color: var(--text-3); }

/* ---------- Sidebar overlay (mobile) ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 64px 0 0 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ---------- Hamburger toggle button ---------- */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-2);
  flex-shrink: 0;
  transition: background 0.2s;
}
.sidebar-toggle:hover { background: var(--blue-100); color: var(--blue-500); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {

  /* Navbar */
  .nav-links { display: none; }
  .nav-inner { gap: 10px; }
  .sidebar-toggle { display: flex; }

  /* Sidebar — slide-in drawer */
  .app-layout { display: block; }
  .sidebar {
    position: fixed;
    top: 64px;
    left: -260px;
    width: 240px;
    min-height: calc(100vh - 64px);
    height: calc(100vh - 64px);
    overflow-y: auto;
    flex-direction: column;
    z-index: 200;
    transition: left 0.28s cubic-bezier(0.4,0,0.2,1);
    box-shadow: none;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 6px 0 32px rgba(0,0,0,0.18);
  }

  /* Main content */
  .main-content { padding: 16px; }

  /* Stat cards — 2 columns on mobile */
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.4rem; }

  /* Tables — force horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Cards */
  .card { padding: 16px; border-radius: 14px; }

  /* Buttons */
  .btn { padding: 9px 14px; font-size: 0.82rem; }
  .btn-sm { padding: 6px 11px; font-size: 0.76rem; }

  /* Section title */
  .section-title { font-size: 1.15rem; }
}

/* ---------- Grid collapse overrides (inline style targets) ---------- */
@media (max-width: 640px) {
  /* 3 and 4 column grids → 1 column */
  [style*="grid-template-columns:repeat(3"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: 1fr !important;
  }

  /* 2fr 1fr layouts → single column */
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Flex rows that should wrap */
  [style*="display:flex"][style*="gap"],
  [style*="display: flex"][style*="gap"] {
    flex-wrap: wrap;
  }

  /* Reduce excessive padding on hero/banner divs */
  [style*="padding:48px"],
  [style*="padding: 48px"] {
    padding: 24px 16px !important;
  }
  [style*="padding:36px"],
  [style*="padding: 36px"] {
    padding: 20px 16px !important;
  }
}

/* 2-column grids → still 2 on tablet, 1 on very small */
@media (max-width: 480px) {
  [style*="grid-template-columns:repeat(2"],
  [style*="grid-template-columns: repeat(2"] {
    grid-template-columns: 1fr !important;
  }
  .main-content { padding: 12px; }
}
