/* ==============================
   CSS Custom Properties (Themes)
   ============================== */
:root {
  /* Ocean Blue (Default) */
  --primary: #4a90e2;
  --primary-dark: #2563eb;
  --primary-light: #93c5fd;
  --primary-glow: rgba(74, 144, 226, 0.35);
  --accent: #06b6d4;
  --bg-gradient-1: #0f172a;
  --bg-gradient-2: #1e293b;
  --bg-gradient-3: #0f172a;
  --surface: rgba(30, 41, 59, 0.85);
  --surface-hover: rgba(30, 41, 59, 0.95);
  --surface-border: rgba(74, 144, 226, 0.2);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-heading: #e2e8f0;
  --nav-bg: rgba(15, 23, 42, 0.92);
  --card-bg: rgba(30, 41, 59, 0.8);
  --panel-bg: rgba(15, 23, 42, 0.6);
  --accordion-bg: rgba(30, 41, 59, 0.7);
  --accordion-hover: rgba(74, 144, 226, 0.25);
  --table-header-bg: rgba(74, 144, 226, 0.2);
  --table-row-alt: rgba(30, 41, 59, 0.4);
  --table-row-hover: rgba(74, 144, 226, 0.15);
  --footer-bg: rgba(15, 23, 42, 0.95);
  --scrollbar-thumb: var(--primary);
  --particle-color: rgba(76, 29, 149, 0.85);
  --shadow-color: rgba(0, 0, 0, 0.3);
  --transition-speed: 0.4s;
}

/* Emerald Theme */
[data-theme="emerald"] {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #6ee7b7;
  --primary-glow: rgba(16, 185, 129, 0.35);
  --accent: #14b8a6;
  --bg-gradient-1: #042f2e;
  --bg-gradient-2: #064e3b;
  --bg-gradient-3: #042f2e;
  --surface: rgba(6, 78, 59, 0.75);
  --surface-hover: rgba(6, 78, 59, 0.9);
  --surface-border: rgba(16, 185, 129, 0.2);
  --nav-bg: rgba(4, 47, 46, 0.92);
  --card-bg: rgba(6, 78, 59, 0.7);
  --panel-bg: rgba(4, 47, 46, 0.6);
  --accordion-bg: rgba(6, 78, 59, 0.6);
  --accordion-hover: rgba(16, 185, 129, 0.25);
  --table-header-bg: rgba(16, 185, 129, 0.2);
  --table-row-alt: rgba(6, 78, 59, 0.4);
  --table-row-hover: rgba(16, 185, 129, 0.15);
  --footer-bg: rgba(4, 47, 46, 0.95);
  --particle-color: rgba(16, 185, 129, 0.4);
}

/* Sunset Theme */
[data-theme="sunset"] {
  --primary: #f59e0b;
  --primary-dark: #d97706;
  --primary-light: #fcd34d;
  --primary-glow: rgba(245, 158, 11, 0.35);
  --accent: #ef4444;
  --bg-gradient-1: #1c1917;
  --bg-gradient-2: #292524;
  --bg-gradient-3: #1c1917;
  --surface: rgba(41, 37, 36, 0.85);
  --surface-hover: rgba(41, 37, 36, 0.95);
  --surface-border: rgba(245, 158, 11, 0.2);
  --nav-bg: rgba(28, 25, 23, 0.92);
  --card-bg: rgba(41, 37, 36, 0.8);
  --panel-bg: rgba(28, 25, 23, 0.6);
  --accordion-bg: rgba(41, 37, 36, 0.7);
  --accordion-hover: rgba(245, 158, 11, 0.25);
  --table-header-bg: rgba(245, 158, 11, 0.2);
  --table-row-alt: rgba(41, 37, 36, 0.4);
  --table-row-hover: rgba(245, 158, 11, 0.15);
  --footer-bg: rgba(28, 25, 23, 0.95);
  --particle-color: rgba(245, 158, 11, 0.4);
}

/* Cyber Theme */
[data-theme="cyber"] {
  --primary: #a855f7;
  --primary-dark: #7c3aed;
  --primary-light: #c4b5fd;
  --primary-glow: rgba(168, 85, 247, 0.35);
  --accent: #ec4899;
  --bg-gradient-1: #0c0a1a;
  --bg-gradient-2: #1a1133;
  --bg-gradient-3: #0c0a1a;
  --surface: rgba(26, 17, 51, 0.85);
  --surface-hover: rgba(26, 17, 51, 0.95);
  --surface-border: rgba(168, 85, 247, 0.2);
  --nav-bg: rgba(12, 10, 26, 0.92);
  --card-bg: rgba(26, 17, 51, 0.8);
  --panel-bg: rgba(12, 10, 26, 0.6);
  --accordion-bg: rgba(26, 17, 51, 0.7);
  --accordion-hover: rgba(168, 85, 247, 0.25);
  --table-header-bg: rgba(168, 85, 247, 0.2);
  --table-row-alt: rgba(26, 17, 51, 0.4);
  --table-row-hover: rgba(168, 85, 247, 0.15);
  --footer-bg: rgba(12, 10, 26, 0.95);
  --particle-color: rgba(168, 85, 247, 0.4);
}

/* Rose Theme */
[data-theme="rose"] {
  --primary: #f43f5e;
  --primary-dark: #e11d48;
  --primary-light: #fda4af;
  --primary-glow: rgba(244, 63, 94, 0.35);
  --accent: #fb923c;
  --bg-gradient-1: #1a0a0e;
  --bg-gradient-2: #2d1520;
  --bg-gradient-3: #1a0a0e;
  --surface: rgba(45, 21, 32, 0.85);
  --surface-hover: rgba(45, 21, 32, 0.95);
  --surface-border: rgba(244, 63, 94, 0.2);
  --nav-bg: rgba(26, 10, 14, 0.92);
  --card-bg: rgba(45, 21, 32, 0.8);
  --panel-bg: rgba(26, 10, 14, 0.6);
  --accordion-bg: rgba(45, 21, 32, 0.7);
  --accordion-hover: rgba(244, 63, 94, 0.25);
  --table-header-bg: rgba(244, 63, 94, 0.2);
  --table-row-alt: rgba(45, 21, 32, 0.4);
  --table-row-hover: rgba(244, 63, 94, 0.15);
  --footer-bg: rgba(26, 10, 14, 0.95);
  --particle-color: rgba(244, 63, 94, 0.4);
}

/* Midnight Theme */
[data-theme="midnight"] {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent: #22d3ee;
  --bg-gradient-1: #020617;
  --bg-gradient-2: #0f172a;
  --bg-gradient-3: #020617;
  --surface: rgba(15, 23, 42, 0.9);
  --surface-hover: rgba(15, 23, 42, 0.98);
  --surface-border: rgba(99, 102, 241, 0.2);
  --nav-bg: rgba(2, 6, 23, 0.95);
  --card-bg: rgba(15, 23, 42, 0.85);
  --panel-bg: rgba(2, 6, 23, 0.6);
  --accordion-bg: rgba(15, 23, 42, 0.7);
  --accordion-hover: rgba(99, 102, 241, 0.25);
  --table-header-bg: rgba(99, 102, 241, 0.2);
  --table-row-alt: rgba(15, 23, 42, 0.5);
  --table-row-hover: rgba(99, 102, 241, 0.15);
  --footer-bg: rgba(2, 6, 23, 0.98);
  --particle-color: rgba(99, 102, 241, 0.4);
}


/* ==============================
   LIGHT MODE (Formal / Professional)
   ============================== */
[data-mode="light"] {
  --bg-gradient-1: #f8fafc;
  --bg-gradient-2: #f1f5f9;
  --bg-gradient-3: #f8fafc;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-hover: rgba(255, 255, 255, 1);
  --surface-border: rgba(0, 0, 0, 0.08);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-heading: #0f172a;
  --nav-bg: rgba(255, 255, 255, 0.96);
  --card-bg: rgba(255, 255, 255, 0.92);
  --panel-bg: rgba(248, 250, 252, 0.95);
  --accordion-bg: rgba(241, 245, 249, 0.9);
  --accordion-hover: rgba(74, 144, 226, 0.08);
  --table-header-bg: rgba(74, 144, 226, 0.08);
  --table-row-alt: rgba(248, 250, 252, 0.8);
  --table-row-hover: rgba(74, 144, 226, 0.06);
  --footer-bg: rgba(255, 255, 255, 0.98);
  --shadow-color: rgba(0, 0, 0, 0.06);
  --particle-color: rgba(76, 29, 149, 0.4);
  --primary-glow: rgba(74, 144, 226, 0.12);
}

/* Light + Emerald */
[data-mode="light"][data-theme="emerald"] {
  --primary-glow: rgba(16, 185, 129, 0.12);
  --accordion-hover: rgba(16, 185, 129, 0.08);
  --table-header-bg: rgba(16, 185, 129, 0.08);
  --table-row-hover: rgba(16, 185, 129, 0.06);
  --particle-color: rgba(16, 185, 129, 0.15);
}

/* Light + Sunset */
[data-mode="light"][data-theme="sunset"] {
  --primary-glow: rgba(245, 158, 11, 0.12);
  --accordion-hover: rgba(245, 158, 11, 0.08);
  --table-header-bg: rgba(245, 158, 11, 0.08);
  --table-row-hover: rgba(245, 158, 11, 0.06);
  --particle-color: rgba(245, 158, 11, 0.15);
}

/* Light + Cyber */
[data-mode="light"][data-theme="cyber"] {
  --primary-glow: rgba(168, 85, 247, 0.12);
  --accordion-hover: rgba(168, 85, 247, 0.08);
  --table-header-bg: rgba(168, 85, 247, 0.08);
  --table-row-hover: rgba(168, 85, 247, 0.06);
  --particle-color: rgba(168, 85, 247, 0.15);
}

/* Light + Rose */
[data-mode="light"][data-theme="rose"] {
  --primary-glow: rgba(244, 63, 94, 0.12);
  --accordion-hover: rgba(244, 63, 94, 0.08);
  --table-header-bg: rgba(244, 63, 94, 0.08);
  --table-row-hover: rgba(244, 63, 94, 0.06);
  --particle-color: rgba(244, 63, 94, 0.15);
}

/* Light + Midnight */
[data-mode="light"][data-theme="midnight"] {
  --primary-glow: rgba(99, 102, 241, 0.12);
  --accordion-hover: rgba(99, 102, 241, 0.08);
  --table-header-bg: rgba(99, 102, 241, 0.08);
  --table-row-hover: rgba(99, 102, 241, 0.06);
  --particle-color: rgba(99, 102, 241, 0.15);
}

/* Light mode specific overrides */
[data-mode="light"] .card {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
}

[data-mode="light"] .card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--surface-border);
}

[data-mode="light"] nav {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-mode="light"] nav button {
  border-color: #e2e8f0;
  color: #475569;
}

[data-mode="light"] nav button:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

[data-mode="light"] nav button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

[data-mode="light"] .accordion {
  border-color: #e2e8f0;
}

[data-mode="light"] .accordion:hover {
  border-color: var(--primary);
}

[data-mode="light"] .panel {
  border-left-color: var(--primary);
  background: #fafbfc;
}

[data-mode="light"] .leaderboard {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
}

[data-mode="light"] .leaderboard td {
  border-top-color: #f1f5f9;
}

[data-mode="light"] header {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-mode="light"] header h1 {
  -webkit-text-fill-color: var(--text-heading);
  background: none;
}

[data-mode="light"] .stat-item {
  background: rgba(255, 255, 255, 0.8);
  border-color: #e2e8f0;
}

[data-mode="light"] .gallery-container figure {
  border-color: #e2e8f0;
  background: #fff;
}

[data-mode="light"] .theme-dot {
  border-color: rgba(0, 0, 0, 0.15);
}

[data-mode="light"] footer {
  color: #475569;
  border-top-color: #e2e8f0;
}

[data-mode="light"] .profile-links a {
  background: #fff;
  border-color: #e2e8f0;
}

[data-mode="light"] .chart {
  background: rgba(255, 255, 255, 0.9);
  border-color: #e2e8f0;
}

[data-mode="light"] .grid-line {
  background: rgba(0, 0, 0, 0.04);
}

[data-mode="light"] .bar-value {
  color: var(--primary-dark);
}

[data-mode="light"] .header-info-section {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

[data-mode="light"] .timeline li::before {
  background: #fff;
}

[data-mode="light"] table[border] {
  border-color: #e2e8f0 !important;
}

[data-mode="light"] table[border] th,
[data-mode="light"] table[border] td {
  border-color: #f1f5f9 !important;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3));
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* ==============================
   Particle Canvas
   ============================== */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ==============================
   Theme Switcher
   ============================== */
.theme-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.theme-toggle-btn,
.mode-toggle-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--surface);
  backdrop-filter: blur(12px);
  color: var(--primary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px var(--primary-glow);
}

.theme-toggle-btn:hover {
  transform: scale(1.1) rotate(30deg);
  box-shadow: 0 6px 30px var(--primary-glow);
}

.mode-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px var(--primary-glow);
}

.mode-toggle-btn i {
  transition: transform 0.4s ease;
}

[data-mode="light"] .mode-toggle-btn i {
  transform: rotate(180deg);
}

.theme-options {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 8px 32px var(--shadow-color);
  animation: slideDown 0.3s ease;
}

.theme-options.show {
  display: flex;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.theme-option:hover {
  background: var(--primary-glow);
  transform: translateX(-4px);
}

.theme-option.active {
  background: var(--primary-glow);
  border-left: 3px solid var(--primary);
}

.theme-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==============================
   Container
   ============================== */
.container {
  position: relative;
  z-index: 1;
  padding: 30px;
  flex: 1;
}

header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 30px;
  padding: 30px 40px;
  border-bottom: 1px solid var(--surface-border);
  color: var(--text-primary);
  transition: all var(--transition-speed) ease;
  overflow: hidden;
}

.header-info-section {
  flex: 1;
  min-width: 300px;
  background: var(--panel-bg);
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 8px 32px var(--shadow-color);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-profile-wrap {
  display: flex;
  align-items: center;
  gap: 30px;
}

.profile-img {
  border-radius: 50%;
  width: 130px;
  height: 130px;
  border: 3px solid var(--primary);
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: 0 0 25px var(--primary-glow);
  object-fit: cover;
  flex-shrink: 0;
}

.profile-img:hover {
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 0 40px var(--primary-glow), 0 8px 25px var(--shadow-color);
}

/* ==============================
   Header Slideshow
   ============================== */
.header-slideshow-container {
  width: 550px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 2px solid var(--surface-border);
  box-shadow: 0 8px 30px var(--shadow-color);
  flex-shrink: 0;
  display: none; /* Shown via JS if gallery items exist */
  background: var(--card-bg);
}

.header-slideshow {
  width: 100%;
  height: 100%;
  position: relative;
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  display: flex;
  flex-direction: column;
}

.slide.active {
  opacity: 1;
  z-index: 2;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 12px 15px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
  font-size: 13px;
  text-align: center;
  z-index: 3;
}

header h1 {
  font-size: 28px;
  margin: 0;
  color: var(--text-heading);
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header p {
  margin: 3px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.social-icons a {
  margin-right: 14px;
  color: var(--primary);
  font-size: 24px;
  transition: all 0.3s ease;
  display: inline-block;
}

.social-icons a:hover {
  color: var(--primary-light);
  transform: translateY(-3px) scale(1.15);
  filter: drop-shadow(0 4px 8px var(--primary-glow));
}

/* ==============================
   Sticky Navigation
   ============================== */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 15px 25px;
  border-bottom: 1px solid var(--surface-border);
  gap: 10px;
  transition: all var(--transition-speed) ease;
}

nav button {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
  padding: 10px 18px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

nav button i {
  font-size: 14px;
  transition: transform 0.3s ease;
}

nav button:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--text-primary);
  transform: translateY(-3px);
  box-shadow: 0 4px 15px var(--primary-glow);
}

nav button:hover i {
  transform: scale(1.2);
  color: var(--primary);
}

nav button.active {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  box-shadow: 0 4px 15px var(--primary-glow);
}

nav button.active i {
  color: #fff;
}

nav::-webkit-scrollbar {
  height: 4px;
}

nav::-webkit-scrollbar-track {
  background: transparent;
}

nav::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

/* ==============================
   Cards (Glassmorphism)
   ============================== */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 25px;
  box-shadow: 0 8px 32px var(--shadow-color);
  color: var(--text-primary);
  border-left: 4px solid var(--primary);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  animation: fadeInUp 0.6s ease forwards;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px var(--shadow-color), 0 0 20px var(--primary-glow);
  border-left-color: var(--primary-light);
}

.card h2 {
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 12px;
  margin-bottom: 20px;
  color: var(--text-heading);
  font-size: 22px;
  position: relative;
}

.card h2::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), transparent);
  border-radius: 3px;
}

.card span {
  font-weight: 600;
  color: var(--primary-light);
  display: inline-block;
  width: 160px;
}

.card p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.card a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.3s ease;
}

.card a:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

/* ==============================
   Profile Links
   ============================== */
.profile-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--panel-bg);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

.profile-links a:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  transform: translateX(8px);
  box-shadow: 0 4px 20px var(--primary-glow);
}

.profile-links a i {
  font-size: 20px;
  color: var(--primary);
  transition: transform 0.3s ease;
}

.profile-links a:hover i {
  transform: scale(1.2);
}

/* ==============================
   Timeline
   ============================== */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), var(--primary-light), transparent);
}

.timeline li {
  position: relative;
  margin: 20px 0;
  padding-left: 50px;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.timeline li:hover {
  color: var(--text-primary);
  transform: translateX(4px);
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 3px;
  width: 12px;
  height: 12px;
  background: var(--bg-gradient-1);
  border: 2px solid var(--primary);
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 0 0 3px transparent;
}

.timeline li:hover::before {
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.timeline li span {
  display: block;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  white-space: normal;
  word-break: break-word;
}

/* ==============================
   Accordion
   ============================== */
.accordion {
  background: var(--accordion-bg);
  color: var(--text-primary);
  position: relative;
  cursor: pointer;
  border: 1px solid var(--surface-border);
  padding: 14px 40px 14px 16px;
  width: 100%;
  text-align: left;
  outline: none;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1);
  margin-bottom: 6px;
  border-radius: 10px;
}

.accordion::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: bold;
  color: var(--primary);
  transition: all 0.3s ease;
}

.accordion:hover {
  background: var(--accordion-hover);
  border-color: var(--primary);
  transform: translateX(4px);
  box-shadow: 0 4px 15px var(--primary-glow);
}

.accordion.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 20px var(--primary-glow);
}

.accordion.active::after {
  content: "−";
  color: #fff;
  transform: translateY(-50%) rotate(180deg);
}

.panel {
  padding: 0 16px;
  display: none;
  max-height: 0;
  overflow: hidden;
  border-left: 3px solid var(--primary);
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  transition: max-height 0.4s ease-out, padding 0.3s ease;
  border-radius: 0 0 10px 10px;
  margin-bottom: 4px;
}

.panel.show {
  display: block;
  max-height: 800px;
  padding: 15px 16px;
}

.panel p {
  line-height: 1.7;
}

.panel img {
  border-radius: 10px;
  margin: 8px 4px;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 15px var(--shadow-color);
}

.panel img:hover {
  transform: scale(1.03);
}

/* ==============================
   Gallery
   ============================== */
.gallery-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding: 10px;
}

.gallery-container figure {
  text-align: center;
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--panel-bg);
  border: 1px solid var(--surface-border);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.gallery-container figure:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 35px var(--shadow-color), 0 0 15px var(--primary-glow);
  border-color: var(--primary);
}

.gallery-container img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: pointer;
}

.gallery-container figure:hover img {
  transform: scale(1.05);
}

.gallery-container figcaption {
  padding: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==============================
   Lightbox
   ============================== */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: zoom-out;
}

.lightbox-overlay.active {
  display: flex;
  opacity: 1;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: lightboxZoom 0.4s ease;
}

@keyframes lightboxZoom {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 36px;
  color: #fff;
  cursor: pointer;
  transition: transform 0.3s ease;
  z-index: 10001;
  background: none;
  border: none;
  font-family: 'Inter', sans-serif;
}

.lightbox-close:hover {
  transform: rotate(90deg) scale(1.2);
}

/* ==============================
   Chart Styles
   ============================== */
.chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 900px;
  max-width: 95%;
  margin: 40px auto;
  font-family: "Inter", sans-serif;
  color: var(--text-primary);
}

.chart-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 14px;
  text-align: center;
  color: var(--text-heading);
}

.chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-evenly;
  height: 500px;
  width: 100%;
  padding: 40px 30px 40px 60px;
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px var(--shadow-color);
  position: relative;
  overflow: hidden;
}

.grid-lines {
  position: absolute;
  left: 60px;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
}

.grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 45px;
  position: relative;
}

.bar {
  width: 100%;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 6px 6px 0 0;
  position: relative;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: 0 0 10px var(--primary-glow);
}

.bar:hover {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  transform: scaleY(1.05);
  box-shadow: 0 0 25px var(--primary-glow);
}

.bar-value {
  margin-top: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-light);
  text-align: center;
}

.year {
  text-align: center;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.x-axis-label {
  margin-top: 20px;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.y-axis-label {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: rotate(-90deg) translateY(-50%);
  transform-origin: center;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* ==============================
   Tables
   ============================== */
table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

.leaderboard {
  width: 95%;
  max-width: 1100px;
  margin: 30px auto;
  border-collapse: collapse;
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px var(--shadow-color);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
}

.leaderboard th {
  padding: 14px 18px;
  text-align: left;
  color: var(--text-heading);
  font-weight: 600;
  font-size: 14px;
}

.leaderboard td {
  padding: 12px 18px;
  text-align: left;
  color: var(--text-secondary);
  font-size: 14px;
  border-top: 1px solid var(--surface-border);
}

.leaderboard thead {
  background: var(--table-header-bg);
}

/* Override inline background-color on thead */
.leaderboard thead[style],
table thead[style] {
  background: var(--table-header-bg) !important;
}

.leaderboard tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

.leaderboard tbody tr {
  transition: all 0.3s ease;
}

.leaderboard tbody tr:hover {
  background: var(--table-row-hover);
  transform: translateX(4px);
}

.rank {
  font-weight: 700;
  color: var(--primary);
}

.citation-count {
  font-weight: 600;
  color: var(--primary-light);
}

/* General table styles for publication tables */
table[border] {
  border: 1px solid var(--surface-border) !important;
  border-radius: 12px;
  overflow: hidden;
}

table[border] thead[style] {
  background: var(--table-header-bg) !important;
}

table[border] th {
  padding: 12px 16px;
  color: var(--text-heading);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--surface-border) !important;
}

table[border] td {
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  border: 1px solid var(--surface-border) !important;
}

table[border] tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

table[border] tbody tr {
  transition: all 0.3s ease;
}

table[border] tbody tr:hover {
  background: var(--table-row-hover);
}

td.meta, th.meta {
  color: var(--text-secondary);
}

/* ==============================
   Back to Top
   ============================== */
#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 18px;
  cursor: pointer;
  display: none;
  box-shadow: 0 4px 20px var(--primary-glow);
  transition: all 0.3s ease;
  z-index: 999;
}

#backToTop:hover {
  background: var(--primary-dark);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 30px var(--primary-glow);
}

/* ==============================
   Footer
   ============================== */
footer {
  position: relative;
  z-index: 1;
  background: var(--footer-bg);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  flex-shrink: 0;
  text-align: center;
  padding: 20px 0;
  font-size: 0.9em;
  font-family: 'Inter', sans-serif;
  width: 100%;
  border-top: 1px solid var(--surface-border);
  transition: all var(--transition-speed) ease;
}

/* ==============================
   CV Download
   ============================== */
.cv-download {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.cv-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--primary-glow);
}

/* ==============================
   Tab Content
   ============================== */
.tabcontent {
  display: none;
}

.tabcontent.show {
  display: block;
  animation: fadeInUp 0.5s ease forwards;
}

/* ==============================
   Scroll Reveal Animation
   ============================== */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ==============================
   Stats Bar (Header Enhancement)
   ============================== */
.stats-bar {
  display: flex;
  gap: 30px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--surface-border);
  min-width: 90px;
  transition: all 0.3s ease;
}

.stat-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--primary-glow);
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ==============================
   Header Subtitle
   ============================== */
.header-subtitle {
  margin: 2px 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

/* ==============================
   Animations
   ============================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 15px var(--primary-glow); }
  50% { box-shadow: 0 0 30px var(--primary-glow); }
}

/* ==============================
   Responsive
   ============================== */
@media (max-width: 900px) {
  header {
    flex-direction: column;
    text-align: center;
  }

  .header-profile-wrap {
    flex-direction: column;
    text-align: center;
  }

  .stats-bar {
    justify-content: center;
    gap: 12px;
  }

  .stat-item {
    min-width: 70px;
    padding: 6px 10px;
  }

  .stat-number {
    font-size: 20px;
  }

  .theme-switcher {
    top: 10px;
    right: 10px;
  }

  .theme-toggle-btn,
  .mode-toggle-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .chart {
    height: 300px;
    padding: 30px 15px 30px 40px;
  }

  .bar-wrapper {
    width: 22px;
  }

  .bar-value {
    font-size: 10px;
    margin-top: 4px;
    margin-bottom: 4px;
  }

  .year {
    font-size: 10px;
  }

  .chart-title {
    font-size: 16px;
  }

  .y-axis-label,
  .x-axis-label {
    font-size: 12px;
  }

  .gallery-container {
    grid-template-columns: 1fr;
  }

  nav {
    padding: 8px 10px;
    gap: 6px;
  }

  nav button {
    padding: 6px 14px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 22px;
  }

  .card {
    padding: 18px;
    margin-bottom: 18px;
  }

  .container {
    padding: 16px;
  }
}

/* ==============================
   Selection Style
   ============================== */
::selection {
  background: var(--primary);
  color: #fff;
}

/* ==============================
   Scrollbar (Global)
   ============================== */
::-webkit-scrollbar {
  width: 8px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}
