/* ==========================================================================
   Python4Physics - Modern Design System & Global Styles
   Typography: 'Outfit' (Headings), 'Inter' (Body), 'JetBrains Mono' (Code)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Dark Theme (Default) */
  --bg: #0b1120;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --card-bg: rgba(19, 31, 55, 0.65);
  --card-bg-solid: #131f37;
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(6, 182, 212, 0.4);
  --card-hover-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.5), 0 0 25px rgba(6, 182, 212, 0.15);
  
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.3);
  --accent: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.35);
  --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(59, 130, 246, 0.15));
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  
  --navbar-bg: rgba(11, 17, 32, 0.85);
  --navbar-border: rgba(255, 255, 255, 0.08);
  --dropdown-bg: #131f37;
  
  --code-bg: #090e17;
  --code-border: rgba(255, 255, 255, 0.08);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
  
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-bg-solid: #ffffff;
  --card-border: rgba(226, 232, 240, 0.8);
  --card-hover-border: rgba(2, 132, 199, 0.4);
  --card-hover-shadow: 0 16px 36px -10px rgba(15, 23, 42, 0.1), 0 0 20px rgba(2, 132, 199, 0.12);
  
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  --primary: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.2);
  --accent: #0284c7;
  --accent-glow: rgba(2, 132, 199, 0.25);
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #7c3aed 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(2, 132, 199, 0.08), rgba(37, 99, 235, 0.08));
  
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --purple: #7c3aed;
  
  --navbar-bg: rgba(255, 255, 255, 0.88);
  --navbar-border: rgba(226, 232, 240, 0.8);
  --dropdown-bg: #ffffff;
  
  --code-bg: #1e293b;
  --code-border: rgba(226, 232, 240, 0.8);
  
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  max-width: 100vw;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  position: relative;
}

/* Ambient Background Glows */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: 15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, rgba(59, 130, 246, 0.04) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  right: 10%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, rgba(6, 182, 212, 0.03) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; letter-spacing: -0.015em; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary);
}

code, pre, kbd, samp {
  font-family: 'JetBrains Mono', monospace;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  position: relative;
  z-index: 1;
}

.container-fluid {
  width: 100%;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  position: relative;
  z-index: 1;
}

/* Glassmorphic Cards */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  border-color: var(--card-hover-border);
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-3px);
}

.glass-card.highlight {
  border-color: rgba(6, 182, 212, 0.35);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.06), rgba(19, 31, 55, 0.7));
}

/* Gradient Text */
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

/* Buttons */
.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

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

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff !important;
  box-shadow: 0 4px 18px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 8px 25px var(--accent-glow);
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text) !important;
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--accent) !important;
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--accent) !important;
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #ffffff !important;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.9rem 1.8rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Badges & Chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-purple {
  background: rgba(139, 92, 246, 0.12);
  color: var(--purple);
  border: 1px solid rgba(139, 92, 246, 0.25);
}

/* Modern Navbar */
.site-navbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--navbar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--navbar-border);
  transition: var(--transition);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 1.5rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text);
  text-decoration: none;
}

.brand-logo-img {
  height: 42px;
  max-width: 140px;
  object-fit: contain;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-gradient);
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  margin-left: 0.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: var(--transition);
  text-decoration: none;
}

.nav-link-item:hover, .nav-link-item.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link-item.active {
  color: var(--accent);
  background: rgba(6, 182, 212, 0.1);
  font-weight: 600;
}

[data-theme="light"] .nav-link-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Quick Search Trigger in Navbar */
.nav-search-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.95rem;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}

.nav-search-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.nav-search-btn kbd {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: inherit;
  border: 1px solid var(--card-border);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(15deg);
}

/* Mobile Hamburger */
.mobile-nav-toggle {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  font-size: 1.25rem;
  cursor: pointer;
}

/* Global Command Palette / Search Modal */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.search-modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.search-modal {
  background: var(--card-bg-solid);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 680px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(6, 182, 212, 0.2);
  overflow: hidden;
  transform: translateY(-15px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-modal-backdrop.active .search-modal {
  transform: translateY(0);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--card-border);
}

.search-input-wrapper i {
  color: var(--accent);
  font-size: 1.25rem;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1.15rem;
  font-family: inherit;
}

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

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

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
  margin-bottom: 0.25rem;
}

.search-result-item:hover, .search-result-item.selected {
  background: rgba(6, 182, 212, 0.12);
  border-left: 3px solid var(--accent);
}

.search-result-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.search-result-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-modal-footer {
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--card-bg-solid);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  min-width: 260px;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-success i {
  color: var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-error i {
  color: var(--danger);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modern Footer */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--navbar-border);
  padding-top: 4rem;
  padding-bottom: 2rem;
  margin-top: 6rem;
  position: relative;
  z-index: 1;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand h3 {
  margin-bottom: 0.75rem;
}

.footer-col h4 {
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--accent);
  padding-left: 4px;
}

.faculty-pill {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.faculty-pill-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}

.faculty-pill-affil {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--navbar-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-dim);
}

/* Responsive Rules */
@media (max-width: 991px) {
  .nav-links {
    display: none;
  }
  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .nav-search-btn span, .nav-search-btn kbd {
    display: none;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.6rem; }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}
