/**
 * Shared Navigation Styles for Infographic Sub-Pages
 * Responsive, theme-aware, collapsible sidebar navigation
 */

/* ===============================================
   Hide Original Theme Toggle
   =============================================== */

/* Hide the original theme toggle since we've integrated it into the navigation */
.theme-toggle {
  display: none !important;
}

/* ===============================================
   Breadcrumb
   =============================================== */

.breadcrumb {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 8px 20px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
  z-index: 998;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb a {
  color: var(--c-accent, var(--c-text));
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--c-muted);
}

.breadcrumb-current {
  color: var(--c-text);
  font-weight: 500;
}

/* ===============================================
   Toggle Button
   =============================================== */

.nav-toggle {
  position: fixed;
  top: 48px;
  left: 20px;
  width: 44px;
  height: 44px;
  z-index: 1001;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--c-text);
}

.nav-toggle:hover {
  background: var(--c-bg);
  border-color: var(--c-accent);
}

.nav-toggle:active {
  transform: scale(0.95);
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
}

/* Hide toggle when nav is open */
body.nav-open .nav-toggle {
  display: none;
}

/* ===============================================
   Navigation Sidebar
   =============================================== */

.infographic-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
  transform: translateX(-280px);
  transition: transform 0.3s ease;
}

body.nav-open .infographic-nav {
  transform: translateX(0);
}

/* ===============================================
   Navigation Header
   =============================================== */

.nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.nav-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--c-text);
  margin: 0;
}

.nav-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-muted);
  transition: all 0.2s ease;
}

.nav-close:hover {
  background: var(--c-bg);
  color: var(--c-text);
}

.nav-close svg {
  width: 18px;
  height: 18px;
}

/* ===============================================
   Navigation Items
   =============================================== */

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 6px;
  color: var(--c-text);
  text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  font-size: 15px;
}

.nav-item:hover {
  background: var(--c-bg);
}

.nav-item.active {
  background: var(--c-accent);
  color: white;
  font-weight: 600;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-home {
  font-weight: 500;
  margin-bottom: 8px;
}

/* ===============================================
   Navigation Sections
   =============================================== */

.nav-section {
  margin-bottom: 20px;
}

.nav-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 8px 12px;
}

.nav-divider {
  height: 1px;
  background: var(--c-border);
  margin: 16px 0;
}

/* ===============================================
   Theme Selector
   =============================================== */

.theme-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--c-text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  width: 100%;
  text-align: left;
}

.theme-option:hover {
  background: var(--c-bg);
}

.theme-option.active {
  background: var(--c-accent);
  color: white;
  font-weight: 500;
}

.theme-option svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ===============================================
   Overlay
   =============================================== */

.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.nav-open .nav-overlay {
  display: block;
  opacity: 1;
}

/* ===============================================
   Scrollbar Styling
   =============================================== */

.infographic-nav::-webkit-scrollbar {
  width: 8px;
}

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

.infographic-nav::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: 4px;
}

.infographic-nav::-webkit-scrollbar-thumb:hover {
  background: var(--c-muted);
}

/* ===============================================
   Responsive Breakpoints
   =============================================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  .infographic-nav {
    width: 260px;
    transform: translateX(-260px);
  }
}

/* Mobile (<768px) */
@media (max-width: 768px) {
  /* Full-screen navigation */
  .infographic-nav {
    width: 100%;
    max-width: 320px;
    transform: translateX(-100%);
  }

  body.nav-open .infographic-nav {
    transform: translateX(0);
  }

  /* Darker overlay on mobile */
  body.nav-open .nav-overlay {
    background: rgba(0, 0, 0, 0.5);
  }

  /* Larger touch targets */
  .nav-toggle {
    width: 48px;
    height: 48px;
  }

  .nav-close {
    width: 40px;
    height: 40px;
  }

  .nav-item {
    padding: 14px 12px;
    font-size: 16px;
  }

  .theme-option {
    padding: 12px;
    font-size: 15px;
  }
}

/* Very small screens (<400px) */
@media (max-width: 400px) {
  .infographic-nav {
    max-width: 100%;
    padding: 16px;
  }

  .nav-header h2 {
    font-size: 18px;
  }

  .nav-item {
    font-size: 15px;
  }
}

/* ===============================================
   Focus Styles (Accessibility)
   =============================================== */

.nav-toggle:focus-visible,
.nav-close:focus-visible,
.nav-item:focus-visible,
.theme-option:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* ===============================================
   Print Styles
   =============================================== */

@media print {
  .nav-toggle,
  .infographic-nav,
  .nav-overlay {
    display: none !important;
  }
}

/* ===============================================
   Reduced Motion (Accessibility)
   =============================================== */

@media (prefers-reduced-motion: reduce) {
  .infographic-nav,
  .nav-overlay,
  .nav-toggle,
  .nav-item,
  .theme-option {
    transition: none;
  }
}
