/* ===== CSS Variables ===== */
:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-secondary: #64748b;
  --color-accent: #0ea5e9;
  --color-text: #1e293b;
  --color-text-light: #64748b;
  --color-text-muted: #94a3b8;
  --color-bg: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-bg-sidebar: #0f172a;
  --color-border: #e2e8f0;
  --color-card: #ffffff;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
  --sidebar-width: 280px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg-alt);
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-bg-sidebar);
  color: #fff;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-content {
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ===== Profile ===== */
.profile {
  text-align: center;
  margin-bottom: 2rem;
}

.profile-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1.25rem;
  transition: var(--transition);
}

.profile-photo:hover {
  border-color: var(--color-primary);
  transform: scale(1.02);
}

.name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.title {
  font-size: 0.95rem;
  color: var(--color-accent);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

/* ===== Affiliation Logos ===== */
.affiliation-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.affiliation-logos a {
  display: block;
  opacity: 0.7;
  transition: var(--transition);
}

.affiliation-logos a:hover {
  opacity: 1;
  transform: scale(1.05);
}

.affiliation-logos img {
  height: 35px;
  width: auto;
  filter: brightness(0) invert(1);
}

.affiliation-logos img.colored {
  filter: none;
}

.institution a,
.lab a,
.team a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--transition);
}

.institution a:hover,
.lab a:hover,
.team a:hover {
  color: #fff;
}

.lab,
.team {
  margin-top: 0.25rem;
}

.team a {
  color: var(--color-accent);
  font-weight: 500;
}

/* ===== Navigation ===== */
.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 2rem 0;
}

.nav-link {
  display: block;
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
  color: #fff;
  background: var(--color-primary);
}

/* ===== Social Links ===== */
.social-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: auto;
  padding-top: 2rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  text-decoration: none;
  transition: var(--transition);
}

.social-links a:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-2px);
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 3rem;
  overflow-x: hidden;
}

.content-wrapper {
  max-width: 900px;
  margin: 0 auto;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; margin-bottom: 1.5rem; }
h2 { 
  font-size: 1.75rem; 
  margin: 2.5rem 0 1rem; 
  color: var(--color-primary-dark);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border);
}
h3 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; }
h4 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; color: var(--color-text); }

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

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

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

/* ===== Page Header ===== */
.page-header {
  margin-bottom: 3rem;
  padding: 2rem 0;
  position: relative;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 2px;
}

.page-header h1 {
  margin-bottom: 0.75rem;
  font-size: 2.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header .subtitle {
  font-size: 1.15rem;
  color: var(--color-text-light);
  font-weight: 400;
}

/* ===== Cards ===== */
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

/* ===== Research Interests ===== */
.interests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.interest-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

.interest-item:hover {
  border-color: var(--color-primary);
  background: #fff;
}

.interest-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.interest-content h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.interest-content p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* ===== Publications ===== */
.publication {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.publication:first-child {
  padding-top: 0;
}

.publication:last-child {
  border-bottom: none;
}

.publication-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.publication-title a {
  color: var(--color-text);
}

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

.publication-authors {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 0.35rem;
}

.publication-venue {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.publication-links {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.publication-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  background: var(--color-bg-alt);
  border-radius: 20px;
  color: var(--color-text-light);
  transition: var(--transition);
}

.publication-link:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ===== Teaching ===== */
.course-card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

.course-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.course-card h3 {
  margin: 0 0 0.5rem;
  color: var(--color-text);
}

.course-card .course-info {
  font-size: 0.9rem;
  color: var(--color-primary);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.course-card p {
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.course-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  background: var(--color-bg-alt);
  color: var(--color-text-light);
  border-radius: 20px;
}

/* ===== Contact Form ===== */
.contact-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--color-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  text-decoration: none;
  transition: var(--transition);
}

.contact-item:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.contact-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.contact-details h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text);
}

.contact-details p {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--color-text-light);
}

/* ===== Highlight Box ===== */
.highlight-box {
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.highlight-box p {
  margin: 0;
  color: var(--color-text);
}

/* ===== Skills/Tech Stack ===== */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 25px;
  font-size: 0.9rem;
  color: var(--color-text);
  transition: var(--transition);
}

.tech-badge:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-alt);
}

.tech-badge i {
  color: var(--color-primary);
}

/* ===== Mobile Navigation Toggle ===== */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  font-size: 1.25rem;
  transition: var(--transition);
}

.mobile-nav-toggle:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}

/* ===== Responsive Design ===== */
@media (max-width: 900px) {
  .main-content {
    padding: 2rem 1.5rem;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 1.5rem 1rem;
  }
  
  .content-wrapper {
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .interests-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }
  
  .contact-info {
    grid-template-columns: 1fr;
  }
  
  /* Tables responsive */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.9rem;
  }
  
  th, td {
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
  }
  
  /* Page header responsive */
  .page-header h1 {
    font-size: 2rem;
  }
  
  /* Publication links responsive */
  .publication-links {
    flex-direction: column;
  }
  
  .publication-link {
    justify-content: center;
  }
  
  /* Cards responsive */
  .course-card {
    padding: 1.25rem;
  }
  
  .course-tags {
    gap: 0.4rem;
  }
  
  .tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }
}

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

.content-wrapper > * {
  animation: fadeIn 0.4s ease forwards;
}

/* ===== Code Blocks ===== */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-alt);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--color-bg-sidebar);
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* ===== Lists ===== */
ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

th {
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg-alt);
}

tr:hover {
  background: var(--color-bg-alt);
}

/* ===== Slideshow ===== */
.slideshow {
  position: relative;
  max-width: 800px;
  margin: 2rem auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.slideshow-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--color-bg-sidebar);
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.slide.active {
  opacity: 1;
}

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

.slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.5rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
}

.slideshow-prev,
.slideshow-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  color: var(--color-text);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.slideshow-prev:hover,
.slideshow-next:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
}

.slideshow-prev {
  left: 1rem;
}

.slideshow-next {
  right: 1rem;
}

.slideshow-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

.slideshow-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: var(--transition);
}

.slideshow-dots .dot:hover {
  background: rgba(255, 255, 255, 0.8);
}

.slideshow-dots .dot.active {
  background: white;
  transform: scale(1.2);
}

/* ===== PyRat Showcase ===== */
.pyrat-showcase {
  margin: 2rem 0;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.pyrat-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pyrat-logo {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pyrat-title h3 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.pyrat-tagline {
  margin: 0.25rem 0 0;
  color: #94a3b8;
  font-size: 1.1rem;
}

.pyrat-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding: 2rem;
}

.pyrat-description {
  color: #e2e8f0;
}

.pyrat-description p {
  color: #cbd5e1;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.pyrat-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.pyrat-stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: #60a5fa;
}

.stat-label {
  font-size: 0.85rem;
  color: #94a3b8;
}

.pyrat-algorithms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.algo-tag {
  padding: 0.35rem 0.75rem;
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.pyrat-video {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.pyrat-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.pyrat-footer {
  padding: 1.5rem 2rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pyrat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pyrat-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.pyrat-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.pyrat-btn.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.pyrat-btn.primary:hover {
  background: var(--color-primary-dark);
}

.pyrat-presentations {
  font-size: 0.9rem;
  color: #94a3b8;
}

.pyrat-presentations a {
  color: #60a5fa;
  text-decoration: none;
}

.pyrat-presentations a:hover {
  text-decoration: underline;
}

.pyrat-presentations span {
  margin: 0 0.5rem;
}

@media (max-width: 768px) {
  .pyrat-content {
    grid-template-columns: 1fr;
  }
  
  .pyrat-stats {
    justify-content: space-around;
  }
  
  .pyrat-header {
    flex-direction: column;
    text-align: center;
  }
}
