/* ═══════════════════════════════════════════════════════
   DESIGN SYSTEM & GLOBAL VARIABLES (style.css)
   ═══════════════════════════════════════════════════════ */
:root {
  --c-bg: #0b0f19;
  --c-surface: #111827;
  --c-surface-2: #1e293b;
  --c-surface-3: #334155;
  --c-border: #1e293b;
  --c-border-hover: #334155;
  --c-border-accent: rgba(6, 182, 212, 0.4);
  --c-accent: #06b6d4;
  --c-accent-hover: #22d3ee;
  --c-accent-dim: rgba(6, 182, 212, 0.1);
  --c-text: #f8fafc;
  --c-text-dim: #cbd5e1;
  --c-text-muted: #64748b;
  --c-green: #10b981;
  --c-green-dim: rgba(16, 185, 129, 0.1);
  --c-red: #ef4444;
  --c-red-dim: rgba(239, 68, 68, 0.1);
  --c-amber: #f59e0b;
  --c-amber-dim: rgba(245, 158, 11, 0.1);
  --c-purple: #8b5cf6;
  --c-purple-dim: rgba(139, 92, 246, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ═══════════════════════════════════════════════════════
   BASE STYLES
   ═══════════════════════════════════════════════════════ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background-color: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--c-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--c-surface-3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--c-accent);
}

/* ═══════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════ */
.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
#sidebar {
  width: 280px;
  background-color: #090d16;
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
}

#sidebar.collapsed {
  transform: translateX(-280px);
}

.sidebar-header {
  padding: 16px 20px 20px 20px;
  border-bottom: 1px solid var(--c-border);
  text-align: center;
}

.sidebar-logo {
  display: flex;
  justify-content: center;
  align-items: center;
}

.sidebar-logo-img {
  width: 100%;
  max-width: 180px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.25));
}

.hero-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  background: white;
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

.sidebar-subtitle {
  font-size: 0.7rem;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 8px;
}

.nav-menu {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
}

.nav-group-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--c-text-muted);
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 12px 24px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  font-size: 0.85rem;
  color: var(--c-text-dim);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: var(--transition);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--c-text);
  border-left-color: var(--c-border-hover);
}

.nav-item.active {
  background: var(--c-accent-dim);
  color: var(--c-accent);
  border-left-color: var(--c-accent);
  font-weight: 600;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--c-surface-3);
  color: var(--c-text-dim);
}

.nav-badge.alert {
  background: var(--c-red-dim);
  color: var(--c-red);
}

/* Main Content Area */
#main {
  flex: 1;
  margin-left: 280px;
  padding: 40px;
  transition: var(--transition);
  max-width: calc(100vw - 280px);
}

#main.expanded {
  margin-left: 0;
  max-width: 100vw;
}

/* Header bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--c-border);
}

#sidebar-toggle {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: var(--transition);
}

#sidebar-toggle:hover {
  background: var(--c-surface-2);
  border-color: var(--c-accent);
}

/* ═══════════════════════════════════════════════════════
   TYPOGRAPHY & CARD COMPONENTS
   ═══════════════════════════════════════════════════════ */
h1, h2, h3, h4, h5 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-text);
  margin-bottom: 0.5em;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; border-bottom: 1px solid var(--c-border); padding-bottom: 8px; margin-top: 30px; }
h3 { font-size: 1.2rem; margin-top: 20px; color: var(--c-accent); }
p { margin-bottom: 15px; color: var(--c-text-dim); }

.card {
  background-color: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--c-border-hover);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.card.accent {
  border-left: 4px solid var(--c-accent);
}

.card.glowing {
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
  border-color: var(--c-border-accent);
}

.hero-card {
  background: linear-gradient(135deg, #090f1e 0%, #16223f 100%);
  border: 1px solid var(--c-border-accent);
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.1);
}

.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}

/* ═══════════════════════════════════════════════════════
   DASHBOARD CAROUSEL & VISUAL COMPONENT
   ═══════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--c-accent);
  line-height: 1.1;
  background: linear-gradient(135deg, var(--c-accent), var(--c-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--c-text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════ */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

th {
  background-color: var(--c-surface-2);
  color: var(--c-text);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-dim);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

/* ═══════════════════════════════════════════════════════
   UI COMPONENTS & ALERTS
   ═══════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge.success { background: var(--c-green-dim); color: var(--c-green); }
.badge.warning { background: var(--c-amber-dim); color: var(--c-amber); }
.badge.danger { background: var(--c-red-dim); color: var(--c-red); }
.badge.info { background: var(--c-accent-dim); color: var(--c-accent); }
.badge.purple { background: var(--c-purple-dim); color: var(--c-purple); }

.alert {
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border-left: 4px solid transparent;
  font-size: 0.9rem;
}

.alert.info { background: var(--c-accent-dim); border-left-color: var(--c-accent); color: var(--c-text); }
.alert.warning { background: var(--c-amber-dim); border-left-color: var(--c-amber); color: var(--c-text); }
.alert.danger { background: var(--c-red-dim); border-left-color: var(--c-red); color: var(--c-text); }
.alert.success { background: var(--c-green-dim); border-left-color: var(--c-green); color: var(--c-text); }

.alert-title {
  font-weight: 700;
  margin-bottom: 4px;
}

/* Code blocks */
code {
  font-family: var(--font-mono);
  background-color: var(--c-surface-2);
  color: var(--c-accent-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

pre {
  font-family: var(--font-mono);
  background-color: var(--c-surface-2);
  border: 1px solid var(--c-border);
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.85rem;
  color: var(--c-text-dim);
  margin-bottom: 20px;
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background-color: var(--c-surface-3);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
  text-decoration: none;
}

.btn:hover {
  background-color: var(--c-surface-2);
  border-color: var(--c-border-hover);
}

.btn-primary {
  background-color: var(--c-accent);
  color: var(--c-bg);
  border: none;
}

.btn-primary:hover {
  background-color: var(--c-accent-hover);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.btn-danger {
  background-color: var(--c-red);
  color: white;
  border: none;
}

.btn-danger:hover {
  background-color: #f87171;
}

/* ═══════════════════════════════════════════════════════
   AUDIT READY BINDER STYLING (FOR FORMS AND PRINTING)
   ═══════════════════════════════════════════════════════ */
.print-sheet {
  background: white;
  color: #1e293b;
  border: 2px solid #0f172a;
  border-radius: var(--radius-xs);
  padding: 30px;
  font-family: var(--font);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.print-sheet h1, .print-sheet h2, .print-sheet h3 {
  color: #0f172a;
}

.print-sheet table {
  color: #1e293b;
  border: 1px solid #94a3b8;
}

.print-sheet th {
  background-color: #f1f5f9;
  color: #0f172a;
  border-bottom: 2px solid #64748b;
  border-right: 1px solid #cbd5e1;
}

.print-sheet td {
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  color: #334155;
  background-color: transparent !important;
}

.print-sheet tr:hover td {
  background-color: transparent !important;
}

.print-sheet .form-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  border: 1px solid #cbd5e1;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: var(--radius-xs);
}

.print-sheet .form-meta-item {
  font-size: 0.8rem;
}

.print-sheet .form-meta-item strong {
  display: block;
  color: #475569;
  text-transform: uppercase;
  font-size: 0.65rem;
}

.fill-line {
  border-bottom: 1px dotted #0f172a;
  display: inline-block;
  min-width: 150px;
  height: 20px;
}

/* Tab container */
.tab-container {
  margin-bottom: 24px;
}

.tab-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--c-border);
  padding-bottom: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--c-text-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--c-text);
  background: var(--c-surface-2);
}

.tab-btn.active {
  background: var(--c-accent-dim);
  color: var(--c-accent);
  border-color: var(--c-border-accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE DESIGN & PRINT MEDIA OVERRIDES
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  #sidebar {
    transform: translateX(-280px);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  #main {
    margin-left: 0;
    max-width: 100vw;
  }
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background-color: white !important;
    color: black !important;
    font-size: 10pt;
  }
  #sidebar, #sidebar-toggle, .top-bar, .no-print, .btn, .tab-nav {
    display: none !important;
  }
  #main {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .card {
    background: white !important;
    color: black !important;
    border: 1px solid #94a3b8 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  h1, h2, h3, h4, h5, p, span, td, th {
    color: black !important;
  }
  table {
    page-break-inside: auto;
  }
  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
  thead {
    display: table-header-group;
  }
  .print-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    page-break-after: always;
  }
}
