/* CSS Variables for theming */
:root {
  --bg-color: #ffffff;
  --text-color: #2c3e50;
  --card-bg: #f8f9fa;
  --border-color: #e9ecef;
  --accent-color: #3498db;
  --header-bg: #ffffff;
  --shadow: rgba(0, 0, 0, 0.1);
  --link-color: #2c3e50;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #ffffff;
  --card-bg: #2a2a2a;
  --border-color: #404040;
  --accent-color: #64b5f6;
  --header-bg: #1e1e1e;
  --shadow: rgba(0, 0, 0, 0.3);
  --link-color: #ffffff;
}

/* Apply theme variables */
body {
  background-color: var(--bg-color) !important;
  color: var(--text-color) !important;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.site-header {
  background-color: var(--header-bg) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

/* Desktop header styles only */
@media (min-width: 769px) {
  /* Critical header alignment - must match page content */
  .site-header .wrapper {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 2rem !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    min-height: 60px !important;
  }

  /* Align site title with profile image (image is centered in 300px sidebar, image is 220px, so 40px offset) */
  .site-header .site-title {
    margin-left: 80px !important;
  }

  /* Push navigation to the right */
  .site-header .site-nav {
    margin-left: 700px !important;
  }

  /* Fix header alignment */
  .site-nav .trigger {
    display: flex !important;
    align-items: center !important;
    gap: 1.5rem !important;
  }
}

/* Dark mode styles for all elements */
[data-theme="dark"] .site-title,
[data-theme="dark"] .page-link,
[data-theme="dark"] .content-section h2,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] p,
[data-theme="dark"] li,
[data-theme="dark"] .intro-description {
  color: var(--text-color) !important;
}

/* Target all card divs - Experience (blue border), Education (dark border) */
.content-section > div[style*="border-left: 4px solid #3498db"],
.content-section > div[style*="border-left: 4px solid #2c3e50"] {
  background: #f8f9fa !important;
}

.content-section > div[style*="border-left: 4px solid #3498db"] h3,
.content-section > div[style*="border-left: 4px solid #3498db"] h4,
.content-section > div[style*="border-left: 4px solid #3498db"] p,
.content-section > div[style*="border-left: 4px solid #3498db"] li,
.content-section > div[style*="border-left: 4px solid #2c3e50"] h3,
.content-section > div[style*="border-left: 4px solid #2c3e50"] h4,
.content-section > div[style*="border-left: 4px solid #2c3e50"] p,
.content-section > div[style*="border-left: 4px solid #2c3e50"] li {
  color: #2c3e50 !important;
}

/* Dark mode overrides for Experience and Education cards */
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #3498db"],
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #2c3e50"] {
  background: #2d2d2d !important;
}

/* Change Education card borders to match Experience blue */
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #2c3e50"] {
  border-left: 4px solid #3498db !important;
}

[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #3498db"] h3,
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #3498db"] h4,
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #3498db"] p,
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #3498db"] li,
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #2c3e50"] h3,
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #2c3e50"] h4,
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #2c3e50"] p,
[data-theme="dark"] .content-section > div[style*="border-left: 4px solid #2c3e50"] li {
  color: #e0e0e0 !important;
}

/* Recent Updates section - must override inline !important styles */
div[style*="background: #fafafa !important"],
div[style*="border-left: 4px solid #3498db !important"][style*="padding: 2rem"] {
  background: #fafafa !important;
  background-color: #fafafa !important;
}

div[style*="background: #fafafa !important"] h2,
div[style*="background: #fafafa !important"] p,
div[style*="background: #fafafa !important"] div {
  color: #2c3e50 !important;
}

[data-theme="dark"] div[style*="background: #fafafa !important"],
[data-theme="dark"] div[style*="border-left: 4px solid #3498db !important"][style*="padding: 2rem"] {
  background: #2d2d2d !important;
  background-color: #2d2d2d !important;
}

[data-theme="dark"] div[style*="background: #fafafa !important"] h2,
[data-theme="dark"] div[style*="background: #fafafa !important"] p,
[data-theme="dark"] div[style*="background: #fafafa !important"] div {
  color: #e0e0e0 !important;
}

/* Recent Publications - has 3px border and #fafafa background */
.content-section > div[style*="border-left: 3px solid #3498db"] {
  background: #fafafa !important;
}

.content-section > div[style*="border-left: 3px solid #3498db"] h4,
.content-section > div[style*="border-left: 3px solid #3498db"] p,
.content-section > div[style*="border-left: 3px solid #3498db"] a {
  color: #2c3e50 !important;
}

[data-theme="dark"] .content-section > div[style*="border-left: 3px solid #3498db"] {
  background: #2d2d2d !important;
}

[data-theme="dark"] .content-section > div[style*="border-left: 3px solid #3498db"] h4,
[data-theme="dark"] .content-section > div[style*="border-left: 3px solid #3498db"] p {
  color: #e0e0e0 !important;
}

[data-theme="dark"] .content-section > div[style*="border-left: 3px solid #3498db"] a {
  color: #64b5f6 !important;
}

/* Technical Skills - has border-top instead of border-left */
div[style*="border-top: 4px solid #3498db"] {
  background: #f8f9fa !important;
}

div[style*="border-top: 4px solid #3498db"] h4,
div[style*="border-top: 4px solid #3498db"] p {
  color: #2c3e50 !important;
}

[data-theme="dark"] div[style*="border-top: 4px solid #3498db"] {
  background: #2d2d2d !important;
}

[data-theme="dark"] div[style*="border-top: 4px solid #3498db"] h4,
[data-theme="dark"] div[style*="border-top: 4px solid #3498db"] p {
  color: #e0e0e0 !important;
}

/* Fix publication title links and other dark text links */
[data-theme="dark"] a[style*="#2c3e50"] {
  color: var(--text-color) !important;
}

[data-theme="dark"] a[style*="#333"] {
  color: var(--link-color) !important;
}

[data-theme="dark"] a[style*="#000"] {
  color: var(--link-color) !important;
}

/* Make university/organization links white like other text in dark mode */
[data-theme="dark"] a[style*="#3498db"] {
  color: #ffffff !important;
}

[data-theme="dark"] a[style*="#3498db"]:hover {
  color: #ffffff !important;
  text-decoration: underline !important;
}

[data-theme="dark"] footer {
  background: var(--card-bg) !important;
  border-top: 1px solid var(--border-color) !important;
}

/* Fix social media icons colors in dark mode */
[data-theme="dark"] a[href*="github.com"] {
  color: var(--link-color) !important;
}

[data-theme="dark"] a[href*="x.com"] {
  color: var(--link-color) !important;
}

/* Universal hover animation */
a:not(.theme-toggle) {
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

a:not(.theme-toggle):hover {
  transform: translateY(-1px) !important;
  text-decoration: none !important;
}

/* Theme toggle button */
.theme-toggle-container {
  display: inline-flex;
  align-items: center;
  margin-left: 1rem;
}

.theme-toggle {
  background: none;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: var(--text-color);
}

.theme-toggle:hover {
  border-color: var(--accent-color);
  transform: rotate(20deg) !important;
}

.theme-toggle .sun-icon {
  display: block;
}

.theme-toggle .moon-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: block;
}

/* Hamburger menu - hidden on desktop */
.nav-trigger {
  display: none;
}

.menu-icon {
  display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
  /* Reset ALL desktop header styles for mobile */
  .site-header {
    min-height: auto !important;
  }

  .site-header .wrapper {
    max-width: 100% !important;
    padding: 1rem !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: auto !important;
  }

  .site-header .site-title {
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    font-size: 1.2rem !important;
    flex: 1 !important;
  }

  .site-header .site-nav {
    margin-left: 0 !important;
    margin-right: 0 !important;
    position: relative !important;
    flex: 0 0 auto !important;
  }

  /* Hamburger menu icon - light mode defaults */
  .menu-icon {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer;
    width: 40px;
    height: 40px;
    padding: 10px;
    background: transparent !important;
    border: 1px solid #e9ecef !important;
    border-radius: 6px;
    transition: all 0.3s ease;
  }

  .menu-icon span {
    display: block !important;
    width: 18px !important;
    height: 2px !important;
    background: #2c3e50 !important;
    margin: 2px 0 !important;
    transition: all 0.3s ease;
    border-radius: 2px;
  }
  /* FORCE hide navigation items on mobile by default */
  .site-nav .trigger {
    display: none !important;
    position: absolute;
    top: 55px;
    right: 0;
    background: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 1000;
    min-width: 220px;
  }

  /* Show menu when checkbox is checked */
  .nav-trigger:checked ~ .trigger {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0 !important;
  }

  .site-nav .page-link {
    font-size: 1rem !important;
    width: 100% !important;
    padding: 0.75rem 0 !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    text-align: center !important;
    text-indent: 0 !important;
    display: block !important;
    border-bottom: 1px solid var(--border-color) !important;
  }

  .site-nav .page-link:last-of-type {
    margin-bottom: 1rem !important;
  }

  .theme-toggle {
    width: 40px !important;
    height: 40px !important;
    margin: 0 !important;
    align-self: center !important;
  }

  /* Hamburger animation when checked */
  .nav-trigger:checked ~ .menu-icon span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
  }

  .nav-trigger:checked ~ .menu-icon span:nth-child(2) {
    opacity: 0;
  }

  .nav-trigger:checked ~ .menu-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
  }
}

/* Dark mode for hamburger icon - must be outside media query */
[data-theme="dark"] .menu-icon {
  background: transparent !important;
  border-color: #404040 !important;
}

[data-theme="dark"] .menu-icon span {
  background: #ffffff !important;
}
