/* ========================================
   KJSSE Results Dashboard - Premium Styles
   Somaiya Vidyavihar University
   ======================================== */

/* CSS Variables */
:root {
  /* Primary Palette - Cyan Accents */
  --accent-primary: #00bcd4;
  --accent-primary-hover: #00acc1;
  --accent-secondary: #26c6da;
  --accent-tertiary: #4dd0e1;

  /* Status Colors */
  --status-success: #059669;
  --status-success-soft: #d1fae5;
  --status-danger: #dc2626;
  --status-danger-soft: #fee2e2;
  --status-warning: #d97706;
  --status-warning-soft: #fef3c7;

  /* Base Colors - Google Dark Mode Grey */
  --surface-base: #1f1f1f;
  --surface-raised: #2d2d2d;
  --surface-overlay: #3c3c3c;
  --surface-card: rgba(45, 45, 45, 0.95);

  /* Text Colors */
  --text-heading: #e8eaed;
  --text-body: #bdc1c6;
  --text-muted: #9aa0a6;
  --text-subtle: #5f6368;

  /* Borders & Dividers */
  --border-default: rgba(154, 160, 166, 0.2);
  --border-hover: rgba(154, 160, 166, 0.35);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(0, 188, 212, 0.15);

  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-base: 250ms var(--ease-out);
  --transition-slow: 400ms var(--ease-out);
}

/* Light Theme Override */
[data-theme="light"] {
  --surface-base: #f1f5f9;
  --surface-raised: #ffffff;
  --surface-overlay: #e2e8f0;
  --surface-card: rgba(255, 255, 255, 0.98);
  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border-default: rgba(15, 23, 42, 0.1);
  --border-hover: rgba(15, 23, 42, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

/* Global Hide Scrollbar */
::-webkit-scrollbar {
  display: none;
}

* {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

body {
  font-family: var(--font-sans);
  background: var(--surface-base);
  color: var(--text-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Allow selection in inputs and interactive elements */
input,
select,
.tab-btn,
.branch-btn,
.theme-toggle {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* Subtle Background Pattern */
.bg-gradient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse 80% 50% at 50% -20%,
      rgba(0, 188, 212, 0.15),
      transparent
    ),
    radial-gradient(
      ellipse 60% 40% at 100% 100%,
      rgba(13, 148, 136, 0.1),
      transparent
    ),
    var(--surface-base);
  z-index: -2;
}

.floating-shapes {
  display: none;
}

/* ========================================
   HEADER
   ======================================== */
.header {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  z-index: 200;
  padding: var(--space-5) var(--space-8);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex: 1;
}

/* Batch/Semester Selector */
.batch-semester-selector {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.batch-semester-selector .filter-select {
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  padding-right: var(--space-6);
  color: var(--text-heading);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-base);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.batch-semester-selector .filter-select:hover {
  border-color: var(--accent-primary);
}

.batch-semester-selector .filter-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.15);
}

.header-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-6);
}

@media (min-width: 769px) {
  .header-content {
    flex-direction: row;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-logo,
.login-logo {
  display: block;
  -webkit-mask: url("logo.png") no-repeat center / contain;
  mask: url("logo.png") no-repeat center / contain;
}

.nav-logo {
  width: 40px;
  height: 40px;
  background-color: var(--accent-primary);
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem auto; /* CENTERED */
  background-color: white;
}

.login-logo-img {
  width: 80px;
  height: 80px;
  display: block;
  margin: 0 auto 1rem auto;
  border-radius: 12px;
  filter: brightness(0) invert(1);
}

.logo-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-box input {
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-5);
  padding-left: 2.5rem;
  color: var(--text-heading);
  font-size: 0.875rem;
  width: 220px;
  transition: var(--transition-base);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--surface-raised);
  width: 280px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-base);
}

.theme-toggle:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Apps Menu Styles */
.apps-menu-container {
  position: relative;
}

.apps-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.2s;
  padding: 0;
  margin: 0;
}

.apps-toggle svg {
  width: 24px;
  height: 24px;
  display: block;
}

.apps-toggle:hover,
.apps-toggle.active {
  background: var(--surface-overlay);
  color: var(--text-heading);
  border: none;
}

.apps-dropdown {
  position: absolute;
  top: 130%;
  right: -50px;
  width: 320px;
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-xl); /* Increased shadow */
  z-index: 1000;
  display: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform-origin: top right;
}

.apps-dropdown.show {
  display: block;
  animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.apps-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: var(--space-4);
  padding-left: var(--space-2);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  row-gap: var(--space-6);
  column-gap: var(--space-2);
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-body);
  transition: var(--transition-base);
  gap: var(--space-2);
  cursor: pointer;
  background: transparent;
}

.app-card:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-heading);
}

.app-card.active {
  /* No special highlight for active app in menu, just subtle */
  background: transparent;
}
.app-card.active:hover {
  background: rgba(255, 255, 255, 0.05);
}

.app-icon-container {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: transparent;
  position: relative;
  overflow: hidden; /* Clip image corners */
  box-shadow: var(--shadow-sm); /* Subtle depth */
}

.app-card img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Prevent cropping */
  padding: 2px; /* Small safe zone */
  transition: transform 0.2s ease;
}

.app-card:hover img {
  transform: scale(1.05); /* Gentle zoom on hover */
}

.app-name {
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Specific styling removed as we are using logos now */

/* ========================================
   NAVIGATION
   ======================================== */
.nav-tabs {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-8);
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-default);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 150;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
  transition: var(--transition-base);
}

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

.tab-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 188, 212, 0.3);
}

.tab-btn i {
  font-size: 0.95rem;
  transition: var(--transition-base);
}

.tab-btn:hover i {
  transform: scale(1.1);
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-8);
}

.tab-content {
  display: none;
  animation: slideUp 0.4s var(--ease-out);
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   METRICS CARDS
   ======================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  overflow: hidden;
  transition: var(--transition-base);
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.metric-card.total::before {
  background: var(--accent-primary);
}
.metric-card.passed::before {
  background: var(--status-success);
}
.metric-card.failed::before {
  background: var(--status-danger);
}
.metric-card.sgpi::before {
  background: var(--accent-secondary);
}

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

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.metric-card.total .metric-icon {
  background: rgba(0, 188, 212, 0.15);
  color: var(--accent-primary);
}
.metric-card.passed .metric-icon {
  background: rgba(5, 150, 105, 0.15);
  color: var(--status-success);
}
.metric-card.failed .metric-icon {
  background: rgba(220, 38, 38, 0.15);
  color: var(--status-danger);
}
.metric-card.sgpi .metric-icon {
  background: rgba(13, 148, 136, 0.15);
  color: var(--accent-secondary);
}

.metric-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-value {
  font-size: 2.25rem;
  font-weight: 750;
  line-height: 1.1;
  color: var(--text-heading);
  letter-spacing: -0.03em;
}

.metric-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-trend {
  font-size: 0.8rem;
  color: var(--text-subtle);
  font-weight: 500;
}

.metric-trend.up {
  color: var(--status-success);
}
.metric-trend.down {
  color: var(--status-danger);
}

/* ========================================
   CHART CARDS
   ======================================== */
.charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

@media (max-width: 900px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-base);
}

.chart-card:hover {
  border-color: var(--border-hover);
}

.chart-card.full-width {
  margin-bottom: var(--space-8);
}

.chart-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-default);
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02),
    transparent
  );
}

.chart-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chart-header h3 i {
  color: var(--accent-primary);
  font-size: 0.9rem;
}

.chart-body {
  padding: var(--space-4);
  height: 350px;
}

.chart-body.compact {
  padding: 0;
}

.chart-body.large {
  height: 360px;
}

/* ========================================
   TOP PERFORMERS
   ======================================== */
.top-performers-preview {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.section-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-header h3 i {
  color: var(--status-warning);
}

.view-all-btn {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 550;
  cursor: pointer;
  transition: var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.view-all-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.performers-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}

.performer-card {
  background: var(--surface-overlay);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: var(--transition-base);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.performer-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-primary);
  opacity: 0;
  transition: var(--transition-base);
}

.performer-card:hover {
  background: var(--surface-raised);
  border-color: var(--border-default);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.performer-card:hover::before {
  opacity: 1;
}

.performer-card:active {
  transform: translateX(2px);
}

.performer-rank {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.performer-rank.gold {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a1a;
}
.performer-rank.silver {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  color: #1a1a1a;
}
.performer-rank.bronze {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1a1a1a;
}
.performer-rank.normal {
  background: var(--surface-overlay);
  color: var(--text-muted);
  border: 1px solid var(--border-default);
}

.performer-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.performer-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: var(--space-1);
}

.performer-branch {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.performer-sgpi {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-primary);
  flex-shrink: 0;
}

/* ========================================
   BRANCH SELECTOR
   ======================================== */
.branch-selector {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  padding: var(--space-2);
}

.branch-btn {
  padding: var(--space-2) var(--space-4);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 550;
  cursor: pointer;
  transition: var(--transition-base);
  white-space: nowrap;
}

.branch-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.branch-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* Branch Stats */
.branch-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 1000px) {
  .branch-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .branch-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.branch-stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  text-align: center;
}

.branch-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

.branch-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: var(--space-1);
}

/* ========================================
   COMPARISON TABLE
   ======================================== */
.comparison-table-container {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.comparison-table-container::-webkit-scrollbar {
  display: none;
}

.comparison-table {
  min-width: 100%;
  width: max-content;
  border-collapse: collapse;
  table-layout: auto;
}

.comparison-table th,
.comparison-table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  border-right: 1px solid var(--border-default);
  white-space: nowrap;
}

.comparison-table th:last-child,
.comparison-table td:last-child {
  border-right: none;
}

.comparison-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-overlay);
}

.comparison-table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.comparison-table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.comparison-table td {
  font-size: 0.875rem;
  color: var(--text-body);
}

.comparison-table tbody tr:hover {
  background: var(--surface-overlay);
}

.comparison-table tbody tr:last-child td {
  border-bottom: none;
}

/* ========================================
   SUBJECT ANALYSIS
   ======================================== */
.subject-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.subject-mini-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  transition: var(--transition-base);
}

.subject-mini-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.subject-mini-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.subject-mini-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
}

.subject-mini-value.high {
  color: var(--status-success);
}
.subject-mini-value.medium {
  color: var(--status-warning);
}
.subject-mini-value.low {
  color: var(--status-danger);
}

.subject-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-5);
}

.subject-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: var(--transition-base);
}

.subject-card:hover {
  border-color: var(--border-hover);
}

.subject-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.subject-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-heading);
}

.subject-code {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-mono);
}

.subject-pass-rate {
  font-size: 1.25rem;
  font-weight: 700;
}

.subject-pass-rate.high {
  color: var(--status-success);
}
.subject-pass-rate.medium {
  color: var(--status-warning);
}
.subject-pass-rate.low {
  color: var(--status-danger);
}

.subject-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.subject-stat {
  text-align: center;
  padding: var(--space-3);
  background: var(--surface-overlay);
  border-radius: var(--radius-sm);
}

.subject-stat-value {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-heading);
}

.subject-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.grade-distribution {
  display: flex;
  gap: 2px;
  margin-top: var(--space-3);
}

.grade-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-overlay);
  overflow: hidden;
}

.grade-bar-fill {
  height: 100%;
  border-radius: 3px;
}

/* ========================================
   LEADERBOARD
   ======================================== */
/* Leaderboard filters now use the .students-filters unified grid system */

.leaderboard-filters select {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--text-body);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition-base);
  min-width: 150px;
}

.leaderboard-filters select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--space-8);
  margin-bottom: var(--space-10);
  padding: var(--space-6);
  min-height: 280px;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: transform 0.3s ease;
}

.podium-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
  background: var(--surface-overlay);
  color: var(--text-muted);
}

.podium-item.first {
  order: 2;
  transform: translateY(-40px);
}

.podium-item.first .podium-avatar {
  width: 84px;
  height: 84px;
  background: linear-gradient(135deg, var(--accent-primary), #0891b2);
  color: white;
  font-size: 1.75rem;
  box-shadow: 0 10px 40px rgba(6, 182, 212, 0.3);
  border: 4px solid rgba(255, 255, 255, 0.1);
}

.podium-item.second {
  order: 1;
  transform: translateY(-10px);
}

.podium-item.third {
  order: 3;
  transform: translateY(10px);
}

.podium-rank-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  background: var(--surface-raised);
  border: 2px solid var(--border-default);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-heading);
  z-index: 2;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.podium-item.first .podium-rank-badge {
  background: var(--accent-primary);
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
  top: -12px;
  right: -12px;
}

.podium-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-heading);
  max-width: 160px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-branch {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  opacity: 0.8;
}

.podium-sgpi {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.02em;
}

.podium-item.second .podium-avatar {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  color: #1e293b;
}
.podium-item.third .podium-avatar {
  background: linear-gradient(135deg, #fce7f3, #fbcfe8);
  color: #831843;
}

.podium-item.first .podium-stand {
  height: 90px;
  background: linear-gradient(to top, rgba(251, 191, 36, 0.2), transparent);
}

.podium-item.second .podium-stand {
  height: 60px;
}

.podium-item.third .podium-stand {
  height: 40px;
}

.leaderboard-table-container {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  border-right: 1px solid var(--border-default);
}

.leaderboard-table th:last-child,
.leaderboard-table td:last-child {
  border-right: none;
}

.leaderboard-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-overlay);
}

.leaderboard-table td {
  font-size: 0.875rem;
}

.leaderboard-table tbody tr:hover {
  background: var(--surface-overlay);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.8rem;
}

.rank-badge.gold {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a1a;
}
.rank-badge.silver {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  color: #1a1a1a;
}
.rank-badge.bronze {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1a1a1a;
}
.rank-badge.normal {
  background: var(--surface-overlay);
  color: var(--text-muted);
}

/* ========================================
   STUDENTS TABLE
   ======================================== */
.students-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding: var(--space-5);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  align-items: end; /* Align items to bottom of their grid cells */
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

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

.filter-group select,
.filter-group input {
  background: var(--surface-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 var(--space-4);
  color: var(--text-body);
  font-size: 0.875rem;
  width: 100%;
  height: 44px; /* Standardize height */
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.filter-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  cursor: pointer;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.filter-group.search input {
  min-width: 200px;
}

.students-count {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.students-count strong {
  color: var(--text-heading);
}

.students-table-container {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.students-table {
  width: 100%;
  border-collapse: collapse;
}

.students-table tbody tr,
.leaderboard-table tbody tr,
.performer-card {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.students-table tbody tr:hover,
.leaderboard-table tbody tr:hover {
  background-color: var(--surface-overlay);
}

.students-table th,
.students-table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  border-right: 1px solid var(--border-default);
}

.students-table th:last-child,
.students-table td:last-child {
  border-right: none;
}

.students-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-overlay);
  cursor: pointer;
  user-select: none;
  transition: var(--transition-base);
}

.students-table th:hover {
  color: var(--text-heading);
}

.students-table th i {
  margin-left: var(--space-2);
  font-size: 0.7rem;
  opacity: 0.5;
}

.students-table th.sort-asc i,
.students-table th.sort-desc i {
  opacity: 1;
  color: var(--accent-primary);
}

.students-table td {
  font-size: 0.875rem;
}

.students-table tbody tr {
  cursor: pointer;
  transition: var(--transition-base);
}

.students-table tbody tr:hover {
  background: var(--surface-overlay);
}

/* Badges */
.branch-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.branch-badge.ai-ds {
  background: rgba(0, 188, 212, 0.15);
  color: #818cf8;
}
.branch-badge.comps {
  background: rgba(13, 148, 136, 0.15);
  color: #2dd4bf;
}
.branch-badge.it {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
}
.branch-badge.cce {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
}
.branch-badge.csbs {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.branch-badge.excp {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.branch-badge.extc {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.branch-badge.mech {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}
.branch-badge.rai {
  background: rgba(251, 113, 133, 0.15);
  color: #fb7185;
}
.branch-badge.vlsi {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.result-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.result-badge.pass {
  background: rgba(5, 150, 105, 0.15);
  color: var(--status-success);
}

.result-badge.fail {
  background: rgba(220, 38, 38, 0.15);
  color: var(--status-danger);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-base);
}

.page-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.page-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========================================
   MODAL
   ======================================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.3s var(--ease-out);
  display: flex;
  flex-direction: column;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-4);
  scrollbar-width: thin;
}

.table-responsive::-webkit-scrollbar {
  display: none;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-overlay);
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-base);
  z-index: 10;
}

.modal-close:hover {
  background: var(--status-danger);
  color: #fff;
}

.modal-body {
  padding: var(--space-8);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-default);
}

.modal-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.modal-student-info h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: var(--space-1);
}

.modal-student-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.modal-student-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.modal-stat {
  text-align: center;
  padding: var(--space-5);
  background: var(--surface-overlay);
  border-radius: var(--radius-md);
}

.modal-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-heading);
}

.modal-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.modal-grades {
  margin-top: var(--space-6);
}

.modal-grades h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: var(--space-4);
}

.grades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-3);
}

.grade-item {
  background: var(--surface-overlay);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  text-align: center;
}

.grade-subject {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
  font-weight: 500;
}

.grade-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.grade-value.pass {
  color: var(--status-success);
}
.grade-value.fail {
  color: var(--status-danger);
}

/* Student Modal Content */
.modal-header-content {
  display: flex;
  gap: var(--space-5);
  padding-bottom: var(--space-6);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-default);
  align-items: flex-start;
}

.student-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-tertiary)
  );
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.student-main-info {
  flex: 1;
  min-width: 0;
}

.student-main-info h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.student-main-info p {
  margin-bottom: var(--space-2);
  font-size: 0.9rem;
  color: var(--text-body);
}

.student-main-info p strong {
  color: var(--text-heading);
  font-family: var(--font-mono);
}

.student-result {
  text-align: center;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.student-result.pass {
  background: rgba(5, 150, 105, 0.15);
}

.student-result.fail {
  background: rgba(220, 38, 38, 0.15);
}

.student-result .result-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.student-result .result-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.student-result.pass .result-value {
  color: var(--status-success);
}

.student-result.fail .result-value {
  color: var(--status-danger);
}

/* Stats Grid */
.student-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 600px) {
  .student-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.student-stats-grid .stat-card {
  background: var(--surface-overlay);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  border: 1px solid var(--border-default);
}

.student-stats-grid .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(0, 188, 212, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-2);
  font-size: 0.9rem;
}

.student-stats-grid .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

.student-stats-grid .stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: var(--space-1);
}

/* Grades Table */
.modal-body h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.modal-body h3 i {
  color: var(--accent-primary);
}

.grades-table {
  min-width: 100%;
  width: max-content;
  border-collapse: collapse;
  font-size: 0.85rem;
  table-layout: auto;
}

.grades-table th,
.grades-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.grades-table th {
  background: var(--surface-overlay);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.grades-table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.grades-table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.grades-table td {
  color: var(--text-body);
}

.grades-table tbody tr:hover {
  background: rgba(0, 188, 212, 0.05);
}

.grades-table tbody tr:last-child td {
  border-bottom: none;
}

.grade-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.75rem;
  text-align: center;
  min-width: 36px;
}

.grade-badge.pass {
  background: rgba(5, 150, 105, 0.15);
  color: var(--status-success);
}

.grade-badge.fail {
  background: rgba(220, 38, 38, 0.15);
  color: var(--status-danger);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
  background: var(--surface-card);
  border-top: 1px solid var(--border-default);
  padding: var(--space-8) var(--space-6);
  margin-top: var(--space-12);
}

.footer-content {
  max-width: 1440px;
  margin: 0 auto;
  text-align: center;
}

.footer-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.footer-content p:last-child {
  margin-bottom: 0;
  font-weight: 500;
  color: var(--text-body);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  /* Hide the gradient background on mobile for cleaner look */
  .bg-gradient {
    background: var(--surface-base) !important;
    background-image: none !important;
  }

  /* Login Overlay Refinements */
  .login-card {
    padding: 1.5rem !important;
    width: 92% !important;
    display: flex;
    flex-direction: column;
    align-items: center; /* Ensure centered content */
  }

  .login-logo {
    width: 48px; /* Slightly smaller on mobile */
    height: 48px;
    margin-bottom: 1rem;
  }

  .login-title {
    font-size: 1.25rem !important;
  }

  .login-subtitle {
    font-size: 0.8rem !important;
  }

  #googleBtnContainer {
    width: 100% !important;
  }

  /* Header - Compact Layout */
  .header {
    padding: var(--space-3) var(--space-4);
    z-index: 200;
  }

  .nav-logo {
    width: 28px;
    height: 28px;
  }

  .header-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: 0;
    background: var(--surface-card);
  }

  .header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
    min-height: 40px;
  }

  .logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: auto;
  }

  .logo-text h1 {
    font-size: 1.15rem;
    font-weight: 800;
    white-space: normal;
    line-height: 1.2;
    letter-spacing: -0.01em;
  }

  .logo-text p {
    display: none;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    flex-wrap: nowrap;
  }

  .search-box {
    flex: 1;
    display: block;
    order: 1; /* Keep search on the left */
    min-width: 0; /* Prevent flex item from overflowing */
  }

  .search-box input {
    width: 100%;
    background: var(--surface-raised);
    height: 40px;
    font-size: 0.875rem;
    padding-left: 2.25rem;
  }

  .search-box i {
    font-size: 0.875rem;
    left: var(--space-3);
  }

  .apps-menu-container {
    order: 2;
    flex-shrink: 0;
  }

  .apps-toggle {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex; /* Ensure flex centering */
    align-items: center;
    justify-content: center;
    padding: 0; /* Remove padding */
    margin: 0; /* Remove margin */
    flex-shrink: 0;
  }

  .apps-toggle svg {
    width: 24px;
    height: 24px;
    display: block; /* Remove line-height issues */
  }

  .apps-toggle:hover {
    background: var(--surface-overlay);
  }

  .apps-dropdown {
    position: fixed; /* Fixed on mobile for better centering */
    top: 60px; /* Below header */
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    width: 90%;
    max-width: 340px;
    right: auto; /* Reset right positioning */
    transform-origin: top center;
  }

  .apps-dropdown.show {
    transform: translateX(-50%) scale(1);
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: var(--surface-raised);
    border: 1px solid var(--border-default);
    flex-shrink: 0;
    order: 3; /* Move to the right of apps toggle */
  }

  /* Navigation Tabs - Top Bar with Icons Only (Like Desktop) */
  .nav-tabs {
    position: sticky;
    top: 0;
    z-index: 150;
    background: var(--surface-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    flex-wrap: wrap;
    margin-top: 0;
  }

  .tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 550;
    cursor: pointer;
    transition: var(--transition-base);
    min-width: 44px;
    height: 44px;
  }

  .tab-btn i {
    font-size: 1.1rem;
    margin: 0;
  }

  .tab-btn span {
    display: none; /* Hide text on mobile, show only icons */
  }

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

  .tab-btn.active {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 188, 212, 0.3);
  }

  .tab-btn:active {
    transform: scale(0.95);
  }

  .tab-btn i {
    transition: var(--transition-base);
  }

  .main-content {
    padding: var(--space-4);
    padding-bottom: var(--space-8);
  }

  /* Metrics Cards */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-6);
  }

  .metric-card {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--accent-primary);
  }

  .metric-card.passed {
    border-left-color: var(--status-success);
  }
  .metric-card.failed {
    border-left-color: var(--status-danger);
  }
  .metric-card.total {
    border-left-color: var(--accent-primary);
  }

  .metric-icon {
    display: none; /* Hide icon on mobile to focus on value */
  }

  .metric-value {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
  }

  .metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    opacity: 0.7;
  }

  /* Charts */
  .charts-row {
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }

  .chart-card {
    min-height: 300px;
    padding: var(--space-4);
  }

  .chart-header {
    padding: var(--space-3) 0;
    margin-bottom: var(--space-3);
  }

  .chart-header h3 {
    font-size: 0.95rem;
  }

  /* Branch Buttons - Chips */
  .branch-selector {
    display: flex;
    overflow-x: auto;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    margin-bottom: var(--space-4);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .branch-btn {
    flex-shrink: 0;
    padding: var(--space-2) var(--space-4) !important;
    border-radius: var(--radius-full) !important;
    font-size: 0.8rem !important;
    min-height: 36px;
    touch-action: manipulation;
  }

  .filter-group {
    width: 100%;
    margin-bottom: var(--space-3);
  }

  .filter-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-heading);
  }

  .filter-group select,
  .filter-group input {
    width: 100%;
    min-height: 44px;
    font-size: 0.9rem;
    touch-action: manipulation;
  }

  .students-filters {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .students-filters .filter-group {
    margin-bottom: 0;
  }

  .students-count {
    font-size: 0.8rem;
    padding: var(--space-2) 0;
    margin-bottom: var(--space-3);
    text-align: center;
  }

  /* Students Table - Optimized Mobile Layout */
  .students-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    position: relative;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .students-table-container::-webkit-scrollbar {
    display: none;
  }

  .students-table {
    min-width: 100%;
    width: max-content;
    font-size: 0.8rem;
    table-layout: auto;
  }

  .students-table th,
  .students-table td {
    padding: var(--space-3) var(--space-4);
    white-space: nowrap;
  }

  .students-table th {
    font-size: 0.7rem;
    padding: var(--space-2);
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .students-table th i {
    font-size: 0.65rem;
    margin-left: var(--space-1);
  }

  .students-table th:nth-child(n),
  .students-table td:nth-child(n) {
    min-width: auto;
    width: auto;
    max-width: none;
  }

  /* Specific column spacing for readability */
  .students-table th:nth-child(2),
  .students-table td:nth-child(2) {
    min-width: 180px;
  }

  .students-table th:nth-child(3),
  .students-table td:nth-child(3) {
    min-width: 100px;
  }

  .students-table th:nth-child(5),
  .students-table td:nth-child(5) {
    display: table-cell;
    min-width: 100px;
  }

  .students-table tbody tr {
    border-bottom: 1px solid var(--border-default);
  }

  .students-table tbody tr:active {
    background: var(--surface-overlay);
  }

  /* Modal - Floating Card on Mobile */
  .modal {
    padding: var(--space-4);
    align-items: center;
    justify-content: center;
  }

  .modal-content {
    width: 95%; /* Small padding to side */
    max-width: 450px;
    border-radius: var(--radius-xl);
    max-height: 85vh;
    padding-top: var(--space-4);
    position: relative;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .modal-content::-webkit-scrollbar {
    display: none;
  }

  .modal-content::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border-default);
    border-radius: 2px;
  }

  .modal-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-default);
  }

  .modal-body {
    padding: var(--space-4);
  }

  .student-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }

  .stat-card {
    padding: var(--space-3);
  }

  .stat-value {
    font-size: 1.1rem !important;
  }

  .student-avatar {
    width: 60px;
    height: 60px;
    font-size: 1.25rem;
    margin-bottom: var(--space-2);
  }

  .student-main-info h2 {
    font-size: 1.15rem;
    text-align: center;
  }

  .branch-badge {
    padding: 2px 6px;
    font-size: 0.65rem;
  }

  .modal-header-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-3);
  }

  .student-main-info {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .student-result {
    width: 100%;
    margin-top: var(--space-2);
  }

  .grades-table th:nth-child(2),
  .grades-table td:nth-child(2) {
    min-width: 150px;
  }

  /* Podium - Horizontal Layout for Mobile */
  /* Podium - Horizontal Layout for Mobile */
  .podium {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-end !important;
    gap: var(--space-2) !important;
    min-height: 240px !important;
    padding: var(--space-4) 0 !important;
    background: transparent !important;
    border: none !important;
  }

  .podium-item {
    width: 33% !important;
    padding: 0 !important;
  }

  .podium-item .podium-box,
  .podium-item .podium-card {
    display: none !important; /* Remove old card styles */
  }

  .podium-item.first {
    transform: translateY(-20px);
  }
  .podium-item.second {
    transform: translateY(0);
  }
  .podium-item.third {
    transform: translateY(10px);
  }

  /* Scale down contents */
  .podium-avatar {
    width: 40px !important;
    height: 40px !important;
    font-size: 1rem !important;
    margin-bottom: var(--space-2) !important;
  }

  .podium-rank {
    width: 20px !important;
    height: 20px !important;
    font-size: 0.7rem !important;
    top: -5px !important;
    right: -5px !important;
  }

  .podium-name {
    font-size: 0.75rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .podium-branch {
    font-size: 0.6rem !important;
  }

  .podium-sgpi {
    font-size: 0.9rem !important;
  }

  .podium-item.first {
    order: 2;
    z-index: 2;
    transform: scale(1.1) translateY(-15px); /* Lift clear winner */
  }

  .podium-item.second {
    order: 1;
    transform: translateY(0);
  }

  .podium-item.third {
    order: 3;
    transform: translateY(0);
  }

  /* Leaderboard Filters */
  .leaderboard-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
  }

  .leaderboard-filters select {
    width: 100%;
    min-height: 44px;
    font-size: 0.9rem;
    touch-action: manipulation;
    background: var(--surface-raised);
  }

  /* Leaderboard Table - Optimized Mobile Layout */
  .leaderboard-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    position: relative;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .leaderboard-table-container::-webkit-scrollbar {
    display: none;
  }

  .leaderboard-table {
    min-width: 100%;
    width: max-content;
    font-size: 0.8rem;
    table-layout: auto;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: var(--space-3) var(--space-4);
    white-space: nowrap;
  }

  .leaderboard-table th {
    font-size: 0.7rem;
    padding: var(--space-2);
    position: sticky;
    top: 0;
    z-index: 10;
  }

  /* Column widths for mobile leaderboard - Allow horizontal scroll */
  .leaderboard-table th:nth-child(1),
  .leaderboard-table td:nth-child(1) {
    min-width: 60px;
    text-align: center;
  } /* RANK */

  .leaderboard-table th:nth-child(2),
  .leaderboard-table td:nth-child(2) {
    min-width: 200px;
  } /* STUDENT NAME */

  .leaderboard-table th:nth-child(3),
  .leaderboard-table td:nth-child(3) {
    min-width: 120px;
  } /* SEAT NO */

  .leaderboard-table th:nth-child(4),
  .leaderboard-table td:nth-child(4) {
    min-width: 100px;
  } /* BRANCH */

  .leaderboard-table th:nth-child(5),
  .leaderboard-table td:nth-child(5) {
    min-width: 80px;
    font-weight: 700;
    color: var(--accent-primary);
    text-align: center;
  } /* SGPI */

  .leaderboard-table th:nth-child(6),
  .leaderboard-table td:nth-child(6) {
    min-width: 100px;
    text-align: center;
  } /* RESULT */

  .leaderboard-table tbody tr {
    border-bottom: 1px solid var(--border-default);
  }

  .leaderboard-table tbody tr:active {
    background: var(--surface-overlay);
  }

  .rank-badge {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  /* Branch Buttons - Already defined above, removing duplicate */

  /* Pagination */
  .pagination {
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
    margin-top: var(--space-4);
  }

  .page-btn {
    min-width: 44px;
    min-height: 44px;
    padding: var(--space-2);
    font-size: 0.85rem;
    touch-action: manipulation;
  }

  /* Top Performers Preview */
  .performers-list {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .performer-card {
    padding: var(--space-4);
    gap: var(--space-3);
  }

  .performer-name {
    font-size: 0.85rem;
  }

  .performer-sgpi {
    font-size: 1rem;
  }

  .performer-rank {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .view-all-btn {
    min-height: 44px;
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
    touch-action: manipulation;
  }

  .section-header {
    margin-bottom: var(--space-4);
  }

  .section-header h3 {
    font-size: 1rem;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .header-content {
    padding: 0;
  }

  .logo-section h1 {
    font-size: 1.1rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    flex-direction: row;
    align-items: center;
    gap: var(--space-4);
    text-align: left;
  }

  .metric-card::before {
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
    height: 100%;
  }

  .metric-icon {
    flex-shrink: 0;
  }

  .metric-content {
    flex: 1;
  }

  .metric-value {
    font-size: 1.35rem;
  }

  .student-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .student-stats-grid .stat-card {
    padding: var(--space-3);
  }

  .student-stats-grid .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .student-stats-grid .stat-value {
    font-size: 1.1rem;
  }

  .student-stats-grid .stat-label {
    font-size: 0.6rem;
  }

  /* Further optimize table for very small screens */
  /* Maintain consistency on very small screens */
  .students-table,
  .leaderboard-table {
    width: max-content !important;
    font-size: 0.8rem;
  }

  .students-table th,
  .students-table td,
  .leaderboard-table th,
  .leaderboard-table td {
    padding: var(--space-3) var(--space-4);
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
    display: table-cell !important;
  }

  /* Specific column spacing for readability on micro screens */
  .students-table th:nth-child(2),
  .students-table td:nth-child(2),
  .leaderboard-table th:nth-child(2),
  .leaderboard-table td:nth-child(2) {
    min-width: 160px;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .tab-btn,
  .branch-btn,
  .page-btn,
  .view-all-btn,
  .students-table tbody tr {
    -webkit-tap-highlight-color: transparent;
  }

  .students-table tbody tr:active {
    background: var(--surface-overlay);
  }
}

/* Dash Entry Animation */
@keyframes dashEntry {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.main-content > section {
  animation: dashEntry 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.main-content > section:nth-child(2) {
  animation-delay: 0.1s;
}
.main-content > section:nth-child(3) {
  animation-delay: 0.2s;
}

/* Mobile Search Polish */
@media (max-width: 768px) {
  .search-box input {
    border-radius: var(--radius-lg);
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  }
}

/* ========================================
   MOBILE OPTIMIZATION
   ======================================== */
@media (max-width: 768px) {
  /* Reduce header padding on mobile */
  .header {
    padding: var(--space-4) var(--space-4);
  }

  /* Optimize Header Layout */
  .header-content {
    flex-direction: column;
    gap: var(--space-4);
    padding: 0;
  }

  .header-top {
    flex-direction: column;
    align-items: stretch; /* Full width */
    gap: var(--space-4);
  }

  .logo {
    justify-content: center; /* Center logo */
  }

  .logo-text h1 {
    font-size: 1.1rem; /* Smaller title */
    text-align: center;
  }

  .logo-text p {
    font-size: 0.75rem;
    text-align: center;
  }

  .batch-semester-selector {
    justify-content: center;
    width: 100%;
  }

  .batch-semester-selector .filter-select {
    flex: 1; /* Equal width selectors */
    max-width: 50%;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: var(--space-2);
  }

  .search-box {
    flex: 1;
  }

  .search-box input {
    width: 100%;
  }

  .search-box input:focus {
    width: 100%;
  }

  /* Optimize Nav Tabs */
  .nav-tabs {
    justify-content: center;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: var(--space-2) var(--space-4);
    -webkit-overflow-scrolling: touch; /* Smooth scroll */
    gap: var(--space-3);
  }

  .tab-btn {
    flex-shrink: 0;
    padding: var(--space-3);
    font-size: 0.8rem;
    border-radius: var(--radius-full);
  }

  /* Hide text labels on mobile for cleaner look */
  .tab-btn span {
    display: none;
  }

  .tab-btn i {
    font-size: 1.2rem;
    margin: 0;
  }

  /* Hide scrollbar for tabs */
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
}

/* Rank Column Style */
.batch-rank {
  font-weight: 600;
  color: var(--accent-primary);
  font-family: var(--font-mono);
}

.branch-rank {
  font-weight: 500;
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Performance Analytics Overlay */
.analytics-section {
  margin-top: var(--space-4);
  margin-bottom: var(--space-6);
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-4);
}

.analytics-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.stat-card {
  background: var(--surface-hover);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.trend-positive {
  color: var(--success);
}
.trend-negative {
  color: var(--danger);
}
.trend-neutral {
  color: var(--text-secondary);
}

.sem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.sem-card {
  background: var(--surface-card);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-primary);
  display: flex;
  flex-direction: column;
}

.sem-card.best-sem {
  border-left-color: var(--success);
}
.sem-card.low-sem {
  border-left-color: var(--danger);
}

.sem-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.sem-sgpi {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.perf-analysis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.perf-card {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.1); /* Success tint */
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.perf-card.lowest {
  background: rgba(239, 68, 68, 0.1); /* Danger tint */
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.perf-header {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.perf-card .perf-header {
  color: var(--success);
}
.perf-card.lowest .perf-header {
  color: var(--danger);
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .perf-analysis {
    grid-template-columns: 1fr;
  }
}
