/* ==========================================================================
   DESIGN SYSTEM & CSS VARIABLES
   ========================================================================== */
:root {
  /* MNU Color Palette */
  --mnu-red: #981010;
  --mnu-red-hover: #7b0c0c;
  --mnu-red-light: rgba(152, 16, 16, 0.08);
  --mnu-gold: #c5a059;
  --mnu-gold-light: rgba(197, 160, 89, 0.12);
  --mnu-blue: #1e3a8a;
  --mnu-blue-light: rgba(30, 58, 138, 0.08);
  
  /* Neutral Palette */
  --bg-page: #f4f6f9;
  --bg-card: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.9);
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-inverse: #ffffff;
  --border: #e5e7eb;
  --border-focus: #981010;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Font Stack */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Layout */
  --header-height: 70px;
  --drawer-width: 320px;
}

/* ==========================================================================
   BASE STYLES & RESET
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: #111827;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-header);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: background-color 0.2s, color 0.2s;
}

.icon-btn:hover {
  background-color: var(--border);
  color: var(--mnu-red);
}

.logo-container {
  display: flex;
  align-items: center;
  height: 44px;
}

.mnu-logo {
  height: 100%;
  max-height: 44px;
  object-fit: contain;
}

.title-container h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  color: var(--mnu-red);
  line-height: 1.2;
}

.title-container .subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tab Switcher */
.tab-switcher {
  display: flex;
  background-color: #f3f4f6;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.tab-btn i {
  width: 16px;
  height: 16px;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background-color: var(--bg-card);
  color: var(--mnu-red);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   FILTER DRAWER
   ========================================================================== */
.filter-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--drawer-width);
  background-color: var(--bg-card);
  border-right: 1px solid var(--border);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.filter-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  height: var(--header-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mnu-red);
}

.drawer-title h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.drawer-title i {
  width: 20px;
  height: 20px;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

/* Checkbox group styling */
.checkbox-group {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
  border: 1px solid #f3f4f6;
  border-radius: 6px;
  padding: 8px;
  background-color: #f9fafb;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background-color 0.15s;
}

.checkbox-label:hover {
  background-color: #f3f4f6;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--mnu-red);
}

.filter-search-container {
  position: relative;
  width: 100%;
}

.filter-search-container input {
  width: 100%;
  padding: 8px 12px;
  padding-left: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.filter-search-container input:focus {
  border-color: var(--border-focus);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Double-Range Slicer Styling */
.range-slider-container {
  padding: 8px 0;
}

.slider-track-container {
  position: relative;
  width: 100%;
  height: 24px;
  margin-bottom: 8px;
}

.slider-track {
  position: absolute;
  height: 6px;
  border-radius: 3px;
  background-color: #e5e7eb;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  z-index: 1;
}

.slider-thumb {
  position: absolute;
  pointer-events: none;
  -webkit-appearance: none;
  z-index: 2;
  height: 100%;
  width: 100%;
  background: none;
  outline: none;
  top: 0;
  left: 0;
}

.slider-thumb::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--mnu-red);
  border: 2px solid white;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s;
}

.slider-thumb::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-thumb::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--mnu-red);
  border: 2px solid white;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s;
}

.slider-thumb::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.slider-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: #f3f4f6;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--border);
}

.btn-block {
  width: 100%;
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   DASHBOARD CONTAINER & LAYOUT
   ========================================================================== */
.dashboard-container {
  flex: 1;
  margin-top: var(--header-height);
  padding: 24px;
  width: 100%;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 24px;
}

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

/* Active Filters Banner */
.active-filters-banner {
  background-color: #fef2f2;
  border: 1px solid #fee2e2;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.875rem;
  animation: fadeIn 0.2s ease-out;
}

.active-filters-banner.hidden {
  display: none;
}

.banner-title {
  font-weight: 600;
  color: var(--mnu-red);
  display: flex;
  align-items: center;
  gap: 6px;
}

.banner-title i {
  width: 16px;
  height: 16px;
}

.active-filters-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.filter-tag {
  background-color: #fff;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: #ef4444;
  display: flex;
  align-items: center;
}

.filter-tag button:hover {
  color: #b91c1c;
}

.banner-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
}

.banner-clear-btn:hover {
  color: var(--mnu-red);
}

/* ==========================================================================
   KPI SUMMARY CARDS
   ========================================================================== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.kpi-card {
  background-color: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon-container {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon-container i {
  width: 26px;
  height: 26px;
}

.bg-red-light { background-color: var(--mnu-red-light); }
.bg-gold-light { background-color: var(--mnu-gold-light); }
.bg-blue-light { background-color: var(--mnu-blue-light); }

.text-red { color: var(--mnu-red); }
.text-gold { color: #d97706; } /* darker gold for icon readability */
.text-blue { color: var(--mnu-blue); }

.kpi-info {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
}

.kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* ==========================================================================
   VISUALS GRID & CHARTS
   ========================================================================== */
.visuals-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.chart-card {
  background-color: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

/* Column sizes */
.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }

.chart-header {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}

.chart-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.chart-body {
  flex: 1;
  min-height: 350px;
  width: 100%;
}

/* Drilldown Title Header styling */
.title-with-drilldown {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.drilldown-status {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s ease-out;
}

.drilldown-badge {
  background-color: var(--mnu-red-light);
  color: var(--mnu-red);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-back {
  background-color: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-back:hover {
  background-color: var(--border);
  color: var(--mnu-red);
}

.btn-back i {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   SCATTER PLOT & MISSING DATA LAYOUT
   ========================================================================== */
.missing-bach-gpa-container {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background-color: #f9fafb;
}

.warning-banner {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.banner-info-icon {
  width: 16px;
  height: 16px;
  color: var(--mnu-red);
  flex-shrink: 0;
}

.btn-link {
  background: none;
  border: none;
  color: var(--mnu-red);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0 4px;
}

.btn-link:hover {
  color: var(--mnu-red-hover);
}

.missing-students-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.missing-students-list.open {
  max-height: 200px;
}

.table-scroll-container {
  overflow-y: auto;
  max-height: 200px;
}

/* Tables */
.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.simple-table th {
  background-color: #f3f4f6;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.simple-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
  color: var(--text-main);
}

.simple-table tr:hover {
  background-color: #f9fafb;
}

/* ==========================================================================
   INSIGHTS SECTION
   ========================================================================== */
.insight-card {
  border-left: 4px solid var(--mnu-red);
}

.insight-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mnu-red);
}

.insight-title i {
  width: 20px;
  height: 20px;
}

.insight-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.insight-item {
  padding: 16px;
  border-radius: 8px;
  background-color: #f9fafb;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insight-item-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mnu-red);
  display: flex;
  align-items: center;
  gap: 8px;
}

.insight-item-header i {
  width: 16px;
  height: 16px;
}

.insight-text {
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* ==========================================================================
   APP FOOTER
   ========================================================================== */
.app-footer {
  margin-top: auto;
  background-color: #1e293b;
  color: #94a3b8;
  text-align: center;
  padding: 20px;
  font-size: 0.78rem;
  border-top: 1px solid #334155;
}

/* ==========================================================================
   ANIMATIONS & TRANSITIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 1200px) {
  .col-8 { grid-column: span 12; }
  .col-4 { grid-column: span 12; }
  .col-6 { grid-column: span 12; }
}

@media (max-width: 768px) {
  .app-header {
    padding: 0 12px;
  }
  
  .title-container h1 {
    font-size: 0.95rem;
  }
  
  .title-container .subtitle {
    font-size: 0.65rem;
  }
  
  .tab-switcher {
    padding: 2px;
  }
  
  .tab-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
    gap: 4px;
  }
  
  .tab-btn i {
    width: 14px;
    height: 14px;
  }
  
  .dashboard-container {
    padding: 16px;
  }
  
  .chart-card {
    padding: 16px;
  }
  
  .chart-body {
    min-height: 300px;
  }
}

/* Grades Toggle Switch */
.grades-toggle {
  display: flex;
  background-color: #f3f4f6;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  width: fit-content;
  margin-top: 8px;
}

.grades-toggle-btn {
  background: none;
  border: none;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.grades-toggle-btn:hover {
  color: var(--text-main);
}

.grades-toggle-btn.active {
  background-color: var(--bg-card);
  color: var(--mnu-red);
  box-shadow: var(--shadow-sm);
}

.chart-footer-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Fullscreen Overlay Chart Card */
.chart-card.fullscreen {
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  width: calc(100% - 40px) !important;
  height: calc(100% - 40px) !important;
  z-index: 99999;
  background-color: #fff;
  border: 2px solid var(--mnu-red);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 24px !important;
  display: flex;
  flex-direction: column;
}

.chart-card.fullscreen .chart-header {
  margin-bottom: 16px;
}

.chart-card.fullscreen .chart-body {
  flex-grow: 1;
  height: calc(100% - 80px) !important;
}

/* Fullscreen Backdrop overlay behind the card */
.fullscreen-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 99998;
  display: none;
}

.fullscreen-backdrop.active {
  display: block;
}

/* Fullscreen Toggle Button */
.btn-fullscreen {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-fullscreen:hover {
  background-color: var(--light-gray);
  color: var(--mnu-red);
}

.chart-header-title-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}
