/* =========================================================
   CVIS Brand Theme – Official Color System
   Deep Teal · Light Blue · Lime Green
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* ── Official CVIS Brand Palette ── */
  --cvis-teal: #1A4A4A;
  --cvis-teal-light: #245858;
  --cvis-teal-dark: #0f3333;
  --cvis-blue: #A8C8D8;
  --cvis-blue-soft: #d4e6ee;
  --cvis-blue-pale: #eaf2f7;
  --cvis-lime: #AAEE44;
  --cvis-lime-dark: #8cd030;
  --cvis-lime-soft: #e8f9cc;
  --cvis-black: #000000;
  --cvis-white: #FFFFFF;

  /* ── Functional Semantic Colors ── */
  --bg-body: #f0f4f7;
  --bg-surface: var(--cvis-white);
  --bg-surface-2: var(--cvis-blue-pale);
  --border: #d0dce4;
  --border-light: #e4ecf0;

  --text-heading: var(--cvis-teal);
  --text-body: #2d4a4a;
  --text-secondary: #5a7a7a;
  --text-muted: #8aa0a0;

  /* ── Sidebar ── */
  --sidebar-bg: var(--cvis-teal);
  --sidebar-text: var(--cvis-blue);
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: var(--cvis-lime);

  /* ── Status Colors (within brand) ── */
  --status-success: #2e7d32;
  --status-warning: #e67e22;
  --status-danger: #c0392b;
  --status-info: var(--cvis-teal);

  /* ── Effects ── */
  --shadow-sm: 0 1px 3px rgba(26, 74, 74, 0.06);
  --shadow-md: 0 4px 14px rgba(26, 74, 74, 0.08);
  --shadow-lg: 0 10px 30px rgba(26, 74, 74, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: all 0.25s ease;
  --nav-height: 64px;
}

/* ── Global ── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6,
.display-font {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-heading);
}

a {
  color: var(--cvis-teal);
  text-decoration: none;
}

a:hover {
  color: var(--cvis-teal-dark);
}

/* =========================================================
   SIDEBAR
   ========================================================= */
#sidebar {
  background: var(--sidebar-bg);
  box-shadow: 2px 0 12px rgba(26, 74, 74, 0.2);
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  text-align: center;
  border-bottom: 1px solid rgba(168, 200, 216, 0.15);
}

.sidebar-logo-container {
  background: var(--cvis-white);
  padding: 8px;
  border-radius: var(--radius-md);
  display: inline-block;
  margin-bottom: .75rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.sidebar-logo-container img {
  height: 40px;
  width: auto;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--cvis-white);
  font-size: 1.15rem;
  margin: 0;
}

.brand-sub {
  color: var(--cvis-lime);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 700;
}

.nav-section-label {
  padding: 1.25rem 1.25rem .4rem;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(168, 200, 216, 0.5);
  font-weight: 700;
}

.nav-link {
  color: var(--sidebar-text);
  padding: .65rem 1.25rem;
  border-radius: var(--radius-sm);
  margin: 2px .75rem;
  transition: var(--transition);
  font-size: .875rem;
  font-weight: 500;
}

.nav-link i {
  width: 22px;
  margin-right: 10px;
  font-size: .9rem;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--cvis-white);
}

.nav-link.active {
  background: var(--cvis-lime) !important;
  color: var(--cvis-teal) !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(170, 238, 68, 0.25);
}

/* =========================================================
   TOP NAVBAR
   ========================================================= */
.navbar,
.top-navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.navbar-logo {
  height: 36px;
  transition: var(--transition);
}

.navbar-logo:hover {
  transform: scale(1.05);
}

/* =========================================================
   CARDS & PANELS
   ========================================================= */
.glass-panel,
.card-elevated {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.glass-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: var(--cvis-teal);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ── KPI Cards ── */
.kpi-card {
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.kpi-card .icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.kpi-card h2 {
  font-size: 2rem;
  font-weight: 800;
  margin: 0;
}

/* ── CVIS-branded icon boxes ── */
.icon-box.icon-primary {
  background: var(--cvis-blue-pale);
  color: var(--cvis-teal);
}

.icon-box.icon-success {
  background: var(--cvis-lime-soft);
  color: var(--status-success);
}

.icon-box.icon-warning {
  background: #fef3e2;
  color: var(--status-warning);
}

.icon-box.icon-danger {
  background: #fde8ea;
  color: var(--status-danger);
}

.icon-box.icon-info {
  background: var(--cvis-blue-soft);
  color: var(--cvis-teal);
}

/* =========================================================
   TABLES
   ========================================================= */
.table {
  color: var(--text-body);
}

.table thead th {
  background: var(--bg-surface-2);
  border-bottom: 2px solid var(--border);
  color: var(--cvis-teal);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
  padding: .9rem 1rem;
}

.table tbody tr:hover {
  background: var(--cvis-blue-pale);
}

.table td {
  padding: .9rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-light);
}

/* =========================================================
   FORMS
   ========================================================= */
.form-control,
.form-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-body);
  padding: .65rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--cvis-teal);
  box-shadow: 0 0 0 3px rgba(26, 74, 74, 0.12);
}

.form-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: .85rem;
  margin-bottom: .4rem;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-primary,
.btn-cvis {
  background: var(--cvis-lime) !important;
  border: none !important;
  color: var(--cvis-teal) !important;
  font-weight: 700;
  padding: .55rem 1.25rem;
  border-radius: var(--radius-sm);
}

.btn-primary:hover,
.btn-cvis:hover {
  background: var(--cvis-lime-dark) !important;
  box-shadow: 0 4px 12px rgba(170, 238, 68, 0.35);
}

/* =========================================================
   BADGES & ALERTS
   ========================================================= */
.badge {
  padding: .4rem .7rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .75rem;
  display: inline-flex;
  align-items: center;
}

.badge-primary {
  background: var(--cvis-blue-pale);
  color: var(--cvis-teal);
  border: 1px solid var(--cvis-blue);
}

.badge-success {
  background: var(--cvis-lime-soft);
  color: var(--status-success);
  border: 1px solid var(--cvis-lime);
}

.badge-warning {
  background: #fef3e2;
  color: var(--status-warning);
  border: 1px solid #fbd38d;
}

.badge-danger {
  background: #fde8ea;
  color: var(--status-danger);
  border: 1px solid #feb2b2;
}

.alert {
  border: none;
  border-radius: var(--radius-md);
  font-size: .9rem;
}

/* =========================================================
   RESPONSIVE DESIGN (CVIS Optimized)
   ========================================================= */

@media (min-width: 992px) {
  #content.with-sidebar {
    padding-left: var(--sidebar-w);
  }
}

@media (max-width: 991.98px) {
  :root {
    --sidebar-w: 240px;
  }

  main {
    padding-top: calc(var(--nav-height) + 1rem);
  }

  .glass-panel {
    padding: 1.25rem !important;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-card h2 {
    font-size: 1.5rem;
  }

  .kpi-card .icon-box {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  /* Sidebar handling already in base.html styles */
}

@media (max-width: 575.98px) {
  .top-navbar {
    padding: 0 1rem;
  }

  .kpi-card h2 {
    font-size: 1.25rem;
  }

  .table td,
  .table th {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.75rem;
  }

  .btn-lg {
    width: 100%;
    font-size: 1rem;
  }

  .glass-panel {
    padding: 1rem !important;
  }

  /* Hide non-critical columns in tables if needed */
  .hide-xs {
    display: none !important;
  }
}

/* =========================================================
   SCROLLBAR & FOOTER
   ========================================================= */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--cvis-blue);
  border-radius: 20px;
}

footer {
  color: var(--text-muted);
  font-size: .8rem;
  text-align: center;
  padding: 1.5rem 0;
}