/* ===================================================
   MSIT 111 Advanced Algorithms: Research Presentation
   Sidebar + Topbar + Footer Dashboard Layout
   Light Theme · Philippine Education Data
   =================================================== */

:root {
    --primary: #0038A8;
    --primary-light: #1a5cc8;
    --primary-soft: #e8f0fe;
    --primary-bg: #f0f5ff;
    --accent: #FCD116;
    --accent-soft: #fff8e1;
    --accent-dark: #d4a800;
    --deped-red: #CE1126;
    --red-soft: #ffeef0;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-subtle: #f1f5f9;
    --text-dark: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --gradient-hero: linear-gradient(135deg, #0038A8 0%, #1a5cc8 50%, #2563eb 100%);
    --gradient-accent: linear-gradient(135deg, #FCD116, #f59e0b);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 24px rgba(0,0,0,0.1);
    --shadow-xl: 0 24px 48px rgba(0,0,0,0.12);
    --radius: 20px;
    --radius-sm: 12px;
    --radius-lg: 28px;
    --sidebar-width: 260px;
    --sidebar-collapsed: 68px;
    --topbar-height: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    background: var(--bg-light);
    color: var(--text-body);
    line-height: 1.75;
    overflow-x: hidden;
    font-size: 15px;
    margin: 0; padding: 0;
}

/* ============= SCROLLBAR ============= */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ============= SIDEBAR ============= */
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 1040;
  background: rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden;
  transition: all 0.3s;
}
.sidebar-overlay.show { opacity: 1; visibility: visible; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #001233 0%, #001845 50%, #00143a 100%);
  border-right: 1px solid rgba(255,255,255,0.06);
  z-index: 1050;
  display: flex; flex-direction: column;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), width 0.3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto; overflow-x: hidden;
}

.sidebar-brand {
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-brand a {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.brand-logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), #0050d4);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,56,168,0.3);
}
.brand-name {
  display: block; font-weight: 800; font-size: 0.95rem;
  color: var(--accent); letter-spacing: 0.02em;
}
.brand-sub {
  display: block; font-size: 0.65rem; color: #64748b; font-weight: 500;
}
.sidebar-toggle-btn {
  width: 28px; height: 28px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: #94a3b8; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; transition: all 0.2s;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.08); color: #e2e8f0; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }

/* Sidebar section labels */
.sidebar-section-label {
  display: flex; align-items: center;
  padding: 8px 14px 6px; margin: 12px 0 4px;
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: #64748b; font-family: 'Outfit', sans-serif;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-section-label:first-child { border-top: none; margin-top: 0; }

/* Collapsible nav groups */
.nav-group { margin-bottom: 4px; }
.nav-group-toggle {
  display: flex; align-items: center; gap: 10px;
  width: 100%; border: none; background: none;
  padding: 12px 12px; border-radius: 8px;
  color: #cbd5e1; font-size: 0.92rem; font-weight: 700;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase; letter-spacing: 0.06em;
  cursor: pointer; transition: all 0.2s;
}
.nav-group-toggle:hover { background: rgba(255,255,255,0.06); color: #f1f5f9; }
.nav-group-toggle.open { color: #f1f5f9; }
.nav-group-toggle > i:first-child { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; opacity: 0.7; }
.nav-group-label { flex: 1; text-align: left; }
.nav-group-arrow {
  font-size: 0.7rem; transition: transform 0.3s; opacity: 0.5;
}
.nav-group-arrow.open { transform: rotate(180deg); opacity: 0.8; }
.nav-group-items {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s ease;
}
.nav-group-items.open { max-height: 800px; }

.sidebar .nav-item { margin-bottom: 2px; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: #94a3b8; text-decoration: none;
  font-size: 0.82rem; font-weight: 500;
  transition: all 0.2s; cursor: pointer;
  border: none; background: none; width: 100%;
  font-family: 'Outfit', sans-serif;
}
.sidebar .nav-link i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar .nav-link:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.sidebar .nav-link.active {
  background: rgba(0,56,168,0.2);
  color: var(--accent); font-weight: 600;
}
.sidebar .nav-link.active i { color: var(--accent); }

.sidebar-bottom {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-bottom a {
  display: flex; align-items: center; gap: 8px;
  color: #64748b; text-decoration: none;
  font-size: 0.78rem; font-weight: 500;
  padding: 8px 10px; border-radius: 8px;
  transition: all 0.2s;
}
.sidebar-bottom a:hover { color: #e2e8f0; background: rgba(255,255,255,0.05); }

/* ============= TOPBAR ============= */
.topbar {
  position: fixed; top: 0; right: 0;
  left: var(--sidebar-width);
  height: var(--topbar-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 1030;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  transition: left 0.3s cubic-bezier(.4,0,.2,1);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-toggle {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px; background: transparent;
  color: var(--text-muted); cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
  font-size: 1.2rem; transition: all 0.2s;
}
.topbar-toggle:hover { background: var(--bg-subtle); color: var(--text-dark); }
.topbar-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700; font-size: 0.92rem; color: var(--text-dark);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 8px;
  background: var(--primary-soft);
  border: 1px solid rgba(0,56,168,0.15);
  font-size: 0.72rem; font-weight: 600; color: var(--primary);
  font-family: 'Outfit', sans-serif;
}
.topbar-stat {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 8px;
  font-size: 0.72rem; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.topbar-stat.ner { background: rgba(34,197,94,0.1); color: #16a34a; border: 1px solid rgba(34,197,94,0.2); }
.topbar-stat.comp { background: rgba(59,130,246,0.1); color: #2563eb; border: 1px solid rgba(59,130,246,0.2); }
.topbar-stat.drop { background: rgba(239,68,68,0.1); color: #dc2626; border: 1px solid rgba(239,68,68,0.2); }

/* ============= MAIN CONTENT ============= */
.main-content {
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
  background: var(--bg-light);
}
.page-content { flex: 1; padding: 24px; }

/* ============= PAGE FOOTER ============= */
.page-footer {
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-white);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  font-size: 0.75rem; color: var(--text-muted);
}
.page-footer a { color: var(--primary); text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }

/* ============= HERO ============= */
.hero-section {
    background: var(--gradient-hero);
    border-radius: 16px;
    padding: 40px 36px;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    scroll-margin-top: calc(var(--topbar-height) + 16px);
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 160%;
    background: radial-gradient(ellipse, rgba(252,209,22,0.1) 0%, transparent 70%);
    animation: heroGlow 8s ease-in-out infinite alternate;
}
@keyframes heroGlow {
    0% { transform: translate(0,0) scale(1); opacity: 0.5; }
    100% { transform: translate(-5%,5%) scale(1.1); opacity: 0.8; }
}
.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 6s ease-in-out infinite;
}
@keyframes particleFloat {
    0% { opacity: 0; transform: translateY(100vh) scale(0); }
    20% { opacity: 0.6; }
    80% { opacity: 0.3; }
    100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}
.hero-badge-tag {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.4rem 1.2rem;
    border-radius: 30px;
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    position: relative;
}
.hero-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    color: #fff;
    line-height: 1.15;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
    position: relative;
}
.hero-title .highlight {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-subtitle {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.8);
    max-width: 600px;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    position: relative;
}
.hero-meta-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(255,255,255,0.75);
    font-size: 0.82rem;
    margin-bottom: 0.4rem;
    position: relative;
}
.hero-meta-item i { color: var(--accent); font-size: 0.95rem; }
.hero-scroll-hint {
    color: rgba(255,255,255,0.5);
    font-size: 0.72rem;
    text-align: center;
    margin-top: 1.5rem;
    position: relative;
}

/* ============= STAT COUNTERS ============= */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.2rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.stat-number {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}
.stat-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: 0.4rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
}

/* ============= SECTIONS ============= */
.section-block {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    scroll-margin-top: calc(var(--topbar-height) + 16px);
}
.section-tag {
    display: inline-block;
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 0.8rem;
    padding: 0.35rem 1rem;
    border-radius: 30px;
    background: var(--primary-soft);
}
.section-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}
.section-lead {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 700px;
    line-height: 1.8;
}
.divider-accent {
    width: 50px;
    height: 4px;
    background: var(--gradient-accent);
    border-radius: 2px;
    margin-bottom: 1.5rem;
}

/* ============= CARDS ============= */
.glass-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.glass-card-light {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.glass-card-light:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ============= ALGO CARDS ============= */
.algo-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    height: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.algo-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.algo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
}
.algo-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
}
.algo-icon i {
    font-size: 1.5rem;
    color: var(--primary);
}
.algo-card h4 {
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 0.8rem;
}
.algo-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
}
.complexity-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(0,56,168,0.15);
    margin-top: 0.5rem;
    font-weight: 500;
}
.math-block {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-light);
    border-left: 3px solid var(--primary);
    padding: 1rem 1.2rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 1rem 0;
    font-size: 0.85rem;
    overflow-x: auto;
    color: var(--primary);
}

/* ============= CHART CONTAINERS ============= */
.chart-container {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.chart-container.dark {
    background: var(--bg-white);
    border-color: var(--border);
}
.chart-container h5 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}
.chart-container.dark h5 { color: var(--text-dark); }

/* ============= DATA TABLE ============= */
.table-container {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow-x: auto;
}
.table-container table.dataTable {
    font-size: 0.88rem;
}
.table-container table.dataTable thead th {
    background: var(--primary);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    white-space: nowrap;
}
.table-container table.dataTable tbody td {
    vertical-align: middle;
    padding: 0.75rem;
    color: var(--text-body);
}

/* ============= RESULT CARDS ============= */
.result-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.8rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.result-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
}
.result-card.trend-down::after { background: linear-gradient(90deg, #ef4444, #f97316); }
.result-card.trend-up::after { background: linear-gradient(90deg, #22c55e, #16a34a); }
.result-card.trend-volatile::after { background: linear-gradient(90deg, #f59e0b, #eab308); }
.result-card.trend-moderate::after { background: linear-gradient(90deg, #3b82f6, #6366f1); }

.result-card .indicator-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.result-card .slope-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
}
.result-card .slope-val.negative { color: #ef4444; }
.result-card .slope-val.positive { color: #22c55e; }
.result-card .r-squared {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============= CORRELATION ============= */
.corr-cell {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
}
.corr-strong-neg { background: var(--red-soft); color: #dc2626; }
.corr-moderate-neg { background: #fff3e0; color: #ea580c; }
.corr-weak { background: var(--bg-subtle); color: var(--text-muted); }
.corr-weak-pos { background: #f0fdf4; color: #4ade80; }
.corr-moderate-pos { background: #f0fdf4; color: #16a34a; }
.corr-strong-pos { background: #dcfce7; color: #15803d; }

/* ============= TIMELINE ============= */
.timeline-wrap {
    position: relative;
    padding-left: 2rem;
}
.timeline-wrap::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}
.timeline-item {
    position: relative;
    padding-bottom: 1.8rem;
    padding-left: 1.5rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.55rem;
    top: 0.35rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--primary-soft);
}
.timeline-year {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
}
.timeline-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* ============= BUTTONS ============= */
.btn-accent {
    background: var(--gradient-accent);
    color: var(--text-dark);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 0.7rem 1.8rem;
    border: none;
    border-radius: var(--radius-sm);
    letter-spacing: 0.3px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(252,209,22,0.35);
    color: var(--text-dark);
}
.btn-outline-light-custom {
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}
.btn-outline-light-custom:hover {
    border-color: #fff;
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ============= REFERENCES ============= */
.ref-item {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-body);
}
.ref-item:last-child { border-bottom: none; }
.ref-item a { color: var(--primary); }

/* ============= COLLAPSED SIDEBAR (desktop) ============= */
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .nav-link span,
body.sidebar-collapsed .sidebar .nav-group-toggle span,
body.sidebar-collapsed .sidebar .nav-group-arrow,
body.sidebar-collapsed .sidebar .nav-group-label,
body.sidebar-collapsed .sidebar-bottom span { display: none; }
body.sidebar-collapsed .sidebar .sidebar-brand a { justify-content: center; }
body.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: 10px 0; }
body.sidebar-collapsed .sidebar .nav-link i { font-size: 1.15rem; }
body.sidebar-collapsed .sidebar .nav-group-toggle { display: none; }
body.sidebar-collapsed .sidebar .nav-group-items { max-height: 800px; }
body.sidebar-collapsed .sidebar .sidebar-section-label { display: none; }
body.sidebar-collapsed .sidebar-toggle-btn i { transform: rotate(180deg); }
body.sidebar-collapsed .sidebar-bottom a { justify-content: center; padding: 10px 0; }
body.sidebar-collapsed .topbar { left: var(--sidebar-collapsed); }
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }

/* ============= MOBILE ============= */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .topbar { left: 0; }
  .topbar-toggle { display: flex; }
  .main-content { margin-left: 0; }
  body.sidebar-collapsed .topbar { left: 0; }
  body.sidebar-collapsed .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .hero-section { padding: 28px 20px; }
  .topbar-stat { display: none; }
}

/* Mobile sidebar FAB */
.mobile-sidebar-fab {
  display: none;
  position: fixed; bottom: 24px; right: 24px;
  z-index: 1060; width: 52px; height: 52px;
  border-radius: 50%; border: none;
  background: var(--primary, #0038A8);
  color: #fff; font-size: 1.3rem;
  box-shadow: 0 4px 16px rgba(0,56,168,0.3);
  cursor: pointer; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.mobile-sidebar-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(0,56,168,0.4); }
@media (max-width: 991px) {
  .mobile-sidebar-fab { display: flex; }
}

@media (max-width: 768px) {
    .hero-title { font-size: 1.6rem; }
    .section-title { font-size: 1.4rem; }
    .stat-number { font-size: 1.5rem; }
    .section-block { padding: 1.5rem 1.2rem; }
    .stats-bar { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

@media (max-width: 576px) {
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .page-footer { flex-direction: column; text-align: center; }
}

/* ============= SIDEBAR SCROLLBAR ============= */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* ============= ACRONYM TOOLTIPS ============= */
.acr-tip {
  position: relative;
  border-bottom: 1.5px dotted var(--primary, #0038A8);
  cursor: help;
}
.acr-tip::after {
  content: attr(data-acr-full) "\A" attr(data-acr-desc);
  white-space: pre-wrap;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #f1f5f9;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.5;
  width: max-content;
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  text-align: left;
  font-family: 'Outfit', sans-serif;
}
.acr-tip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #0f172a;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 9999;
}
.acr-tip:hover::after,
.acr-tip:hover::before {
  opacity: 1;
  visibility: visible;
}

/* ============= GLOBAL SEARCH ============= */
.topbar-search-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-light); color: var(--text-muted);
  cursor: pointer; font-size: 0.82rem;
  font-family: 'Outfit', sans-serif;
  transition: all 0.2s;
}
.topbar-search-btn:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
.topbar-search-btn i { font-size: 0.85rem; }
.topbar-search-hint { font-weight: 500; }
.topbar-search-btn kbd {
  font-size: 0.65rem; padding: 2px 6px;
  border-radius: 4px; background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.1);
  font-family: system-ui, sans-serif;
  color: var(--text-muted); line-height: 1;
}

.search-overlay {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: min(20vh, 120px);
  animation: searchFadeIn 0.15s ease;
}
@keyframes searchFadeIn { from { opacity: 0; } to { opacity: 1; } }

.search-panel {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: searchSlide 0.2s ease;
}
@keyframes searchSlide { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.search-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-input-icon { font-size: 1.1rem; color: var(--primary); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; outline: none;
  font-size: 1rem; font-family: 'Outfit', sans-serif;
  color: var(--text-dark); background: transparent;
}
.search-input::placeholder { color: var(--text-muted); }
.search-kbd {
  font-size: 0.65rem; padding: 3px 8px;
  border-radius: 4px; background: var(--bg-light);
  border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  font-family: system-ui, sans-serif;
}

.search-results {
  max-height: 420px; overflow-y: auto;
  padding: 8px;
}

.search-acr-card {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid rgba(0,56,168,0.15);
  border-radius: 12px; padding: 16px 20px;
  margin: 8px 4px 12px;
}
.search-acr-key {
  display: inline-block;
  font-family: var(--mono, monospace);
  font-weight: 800; font-size: 1.1rem;
  color: var(--primary);
  background: rgba(0,56,168,0.1);
  padding: 2px 12px; border-radius: 6px;
  margin-bottom: 8px;
}
.search-acr-full {
  font-weight: 700; font-size: 0.92rem;
  color: var(--text-dark); margin-bottom: 4px;
}
.search-acr-desc {
  font-size: 0.82rem; color: var(--muted);
  line-height: 1.6;
}

.search-section-header {
  font-size: 0.72rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px 4px;
}

.search-result-item {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent;
  padding: 10px 12px; border-radius: 8px;
  cursor: pointer; transition: background 0.15s;
  font-family: 'Outfit', sans-serif;
}
.search-result-item:hover { background: var(--bg-light); }
.search-result-top {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 4px;
}
.search-result-top span:first-child {
  font-weight: 600; font-size: 0.85rem;
  color: var(--text-dark);
}
.search-result-count {
  font-size: 0.7rem; font-weight: 600;
  color: var(--primary); background: rgba(0,56,168,0.08);
  padding: 2px 8px; border-radius: 10px;
}
.search-result-snippet {
  font-size: 0.78rem; color: var(--muted);
  line-height: 1.5; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.search-empty {
  text-align: center; padding: 32px 20px;
  font-size: 0.88rem; color: var(--text-muted);
}

@media (max-width: 768px) {
  .topbar-search-hint, .topbar-search-btn kbd { display: none; }
  .topbar-search-btn { padding: 6px 10px; }
  .search-panel { margin: 0 12px; border-radius: 12px; }
}

/* ============= ABOUT MODAL ============= */
.about-modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  padding: 20px;
}
.about-modal-overlay.show { opacity: 1; visibility: visible; }
.about-modal-content {
  background: #fff; border-radius: 16px;
  padding: 32px; max-width: 520px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
}
.about-modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 1.1rem;
  color: var(--muted); cursor: pointer; padding: 4px 8px;
  border-radius: 6px; transition: background 0.2s;
}
.about-modal-close:hover { background: var(--bg-subtle); color: var(--text-dark); }

/* ============= DOWNLOAD BAR ============= */
.download-bar {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.download-bar-label {
  font-size: 0.75rem; font-weight: 600;
  color: var(--muted); white-space: nowrap;
}
.download-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 600;
  border: 1px solid var(--border);
  background: #fff; color: var(--text);
  cursor: pointer; transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
  white-space: nowrap;
}
.download-btn:hover {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
}

/* ============= PRINT / PDF ============= */
@media print {
    .sidebar, .topbar, .sidebar-overlay,
    .hero-particles, .particle,
    .btn-accent, .btn-outline-light-custom,
    .dataTables_filter, .dataTables_info {
        display: none !important;
    }
    .main-content { margin-left: 0 !important; padding-top: 0 !important; }
    body {
        background: #fff !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .hero-section {
        border-radius: 0 !important;
        padding: 20px !important;
    }
    .section-block {
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        padding: 20px 0 !important;
        margin-bottom: 0 !important;
        break-inside: avoid !important;
    }
    .glass-card, .glass-card-light, .result-card,
    .algo-card, .chart-container, .table-container {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        box-shadow: none !important;
    }
    .page-footer { page-break-before: avoid !important; padding: 10px 0 !important; }
    @page { margin: 12mm 10mm 18mm 10mm; size: A4 portrait; }
}

/* =====================================================
   K-MEANS CLUSTERING STYLES
   ===================================================== */

/* Step rows for algorithm explanation */
.step-row {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
  align-items: flex-start;
}
.step-num {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--primary, #0038A8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: var(--mono, monospace);
}
.step-text h6 {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.9rem;
}
.step-text p {
  color: var(--muted, #64748b);
  font-size: 0.82rem;
  margin-bottom: 0;
}

/* Code box for pseudocode */
.code-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 20px 24px;
  font-family: var(--mono, monospace);
  font-size: 0.78rem;
  line-height: 1.8;
  overflow-x: auto;
}
.code-box .kw { color: #c084fc; font-weight: 600; }
.code-box .fn { color: #60a5fa; }
.code-box .cm { color: #64748b; font-style: italic; }
.code-box .num { color: #fbbf24; }

/* Cluster tags */
.cluster-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--mono, monospace);
  color: #fff;
}
.cluster-0 { background: #22c55e; }
.cluster-1 { background: #3b82f6; }
.cluster-2 { background: #f59e0b; }
.cluster-3 { background: #ef4444; }
.cluster-4 { background: #a855f7; }
.cluster-5 { background: #06b6d4; }
.cluster-6 { background: #ec4899; }

/* K-Means card */
.km-card {
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-left: 4px solid var(--primary, #0038A8);
  border-radius: 10px;
  padding: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.km-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* K-Means stat block */
.km-stat-block {
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.km-stat-block .stat-val {
  font-family: var(--mono, monospace);
  font-weight: 800;
  font-size: 1.5rem;
}
.km-stat-block .stat-label {
  font-size: 0.72rem;
  color: var(--muted, #64748b);
  margin-top: 4px;
  font-weight: 600;
}

/* K-control toolbar */
.k-control {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.k-btn {
  padding: 6px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--text, #1e293b);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--mono, monospace);
  cursor: pointer;
  transition: all 0.2s;
}
.k-btn:hover { background: #f1f5f9; }
.k-btn.active {
  background: var(--primary, #0038A8);
  color: #fff;
  border-color: var(--primary, #0038A8);
}

/* Iteration bar */
.iter-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.iter-bar button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text, #1e293b);
  transition: background 0.2s;
}
.iter-bar button:hover { background: #f1f5f9; }
.iter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text, #1e293b);
  margin-left: 8px;
}
.iter-info {
  font-size: 0.72rem;
  color: var(--muted, #64748b);
  margin-left: auto;
  font-family: var(--mono, monospace);
}

/* Callout boxes */
.callout {
  background: #f8fafc;
  border-left: 4px solid var(--primary, #0038A8);
  border-radius: 8px;
  padding: 16px 20px;
}
.callout h6 {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.88rem;
}
.callout p {
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}
.callout-blue { border-left-color: #3b82f6; background: #eff6ff; }
.callout-yellow { border-left-color: #f59e0b; background: #fffbeb; }
.callout-red { border-left-color: #ef4444; background: #fef2f2; }
.callout-green { border-left-color: #22c55e; background: #f0fdf4; }

/* =====================================================
   RESEARCH PAPER STYLES
   ===================================================== */

/* Section number badge */
.section-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary, #0038A8);
  color: #fff;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.85rem;
  margin-right: 12px;
  font-family: var(--mono, monospace);
}

/* Paper cover section */
.paper-cover-section {
  background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%) !important;
  border-bottom: 4px solid var(--primary, #0038A8) !important;
}

/* Conditional coloring for cells */
.cell-danger { background: rgba(239, 68, 68, 0.08); color: #dc2626; font-weight: 600; }
.cell-warn { background: rgba(245, 158, 11, 0.08); color: #d97706; font-weight: 600; }
.cell-ok { background: rgba(34, 197, 94, 0.06); color: #16a34a; }

/* Paper table styling */
.paper-table-styled {
  font-size: 0.82rem;
}
.paper-table-styled th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* Region selector buttons */
.region-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.region-btn {
  padding: 6px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 20px;
  background: #fff;
  color: var(--text, #1e293b);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.region-btn:hover { background: #f1f5f9; }
.region-btn.active {
  background: var(--primary, #0038A8);
  color: #fff;
  border-color: var(--primary, #0038A8);
}

/* QA Accordion */
.qa-item {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  background: #fff;
}
.qa-question {
  width: 100%;
  border: none;
  background: transparent;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #1e293b);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}
.qa-question:hover { background: #f8fafc; }
.qa-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 18px;
  font-size: 0.88rem;
  color: var(--muted, #64748b);
  line-height: 1.7;
  transition: max-height 0.4s ease, padding 0.3s ease;
}
.qa-answer.open {
  max-height: 500px;
  padding: 0 18px 16px;
}

/* Reference entries */
.ref-entry {
  padding: 10px 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text, #1e293b);
}
.ref-entry:last-child { border-bottom: none; }
.ref-entry em { color: var(--primary, #0038A8); }

/* ===== REGION IX DATASETS ===== */
.ds-table {
  border-collapse: collapse;
  width: 100%;
}
.ds-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: none;
}
.ds-table tbody tr {
  transition: background 0.15s ease;
}
.ds-table tbody tr:hover {
  background: rgba(0, 98, 177, 0.04) !important;
}
.ds-table tbody tr:nth-child(even) {
  background: #f8fafc;
}
.ds-table tbody tr.ds-highlight {
  background: rgba(239, 68, 68, 0.06) !important;
}
.ds-table tbody tr.ds-highlight td {
  color: #ef4444;
  font-weight: 600;
}
.ds-table tbody td {
  font-family: var(--mono, 'JetBrains Mono', monospace);
  font-size: 0.78rem;
  color: var(--text, #1e293b);
}
.ds-acronyms {
  border-top: 1px solid var(--border, #e2e8f0);
  padding-top: 16px;
  margin-top: 20px;
}
.ds-acronyms ul {
  list-style: none;
  padding-left: 0;
}
.ds-acronyms li::before {
  content: "•";
  color: var(--primary, #0038A8);
  font-weight: bold;
  display: inline-block;
  width: 1em;
  margin-left: 0;
}
