/* ========== HEADER / NAVIGATION STYLES ========== */

/* Site Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  gap: 1rem;
}

/* Logo */
.site-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: none;
  opacity: 0.9;
}

.site-logo img {
  height: 28px;
  width: auto;
  display: block;
}

/* Navigation Links — desktop */
.site-nav {
  display: none;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* Header Right Section */
.site-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Hamburger Button ── */
.hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
  flex-shrink: 0;
}

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

.hamburger-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Hide hamburger on desktop */
@media (min-width: 900px) {
  .hamburger-btn {
    display: none;
  }
}

/* ── Sidebar Overlay (backdrop) ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* ── Sidebar Drawer ── */
.sidebar-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 201;
  width: min(300px, 80vw);
  height: 100dvh;
  background: var(--card-bg);
  border-left: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
}

.sidebar-drawer.is-open {
  transform: translateX(0);
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 64px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.sidebar-close-btn:hover {
  background: var(--badge-bg);
  color: var(--text);
}

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

/* Sidebar Nav Links */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  min-height: 48px;
}

.sidebar-nav a:hover {
  background: var(--badge-bg);
  color: var(--primary);
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 1.25rem;
}

/* Sidebar Footer CTA */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-footer .site-header-cta {
  width: 100%;
  justify-content: center;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  border-radius: 10px;
  min-height: 48px;
}

/* ── Theme Toggle Button ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--badge-bg);
  color: var(--text);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* ── CTA Button ── */
.site-header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  min-height: 36px;
}

.site-header-cta:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

/* ── Desktop nav visible ── */
@media (min-width: 900px) {
  .site-nav {
    display: flex;
  }
}

@media (max-width: 640px) {
  .site-header-inner {
    padding: 0 1rem;
  }

  .site-header-cta {
    padding: 0.4rem 0.9rem;
    font-size: 0.75rem;
    min-height: 32px;
  }
}

@media (max-width: 480px) {
  .site-header-inner {
    padding: 0 0.75rem;
  }

  .site-logo img {
    height: 22px;
  }

  /* Hide "Go to App" button on very small screens — sidebar has it */
  .go-to-app {
    display: none !important;
  }

  .theme-toggle {
    width: 30px !important;
    height: 30px !important;
  }

  .theme-toggle svg {
    width: 16px !important;
    height: 16px !important;
  }

  .site-nav {
    display: none !important;
  }
}

/* ── CSS Variables ── */
:root {
  --nav-bg: rgba(250, 250, 250, 0.8);
  --border: #e5e7eb;
  --text-muted: #6b7280;
  --text: #111827;
  --badge-bg: rgba(99, 102, 241, 0.08);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
}

.dark {
  --nav-bg: rgba(10, 10, 10, 0.8);
  --border: #27272a;
  --text-muted: #94a3b8;
  --text: #f1f5f9;
  --badge-bg: rgba(129, 140, 248, 0.1);
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --card-bg: #18181b;
  --card-border: #27272a;
}

html.light {
  --nav-bg: rgba(250, 250, 250, 0.8);
  --border: #e5e7eb;
  --text-muted: #6b7280;
  --text: #111827;
  --badge-bg: rgba(99, 102, 241, 0.08);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
}

html.dark {
  --nav-bg: rgba(10, 10, 10, 0.8);
  --border: #27272a;
  --text-muted: #94a3b8;
  --text: #f1f5f9;
  --badge-bg: rgba(129, 140, 248, 0.1);
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --card-bg: #18181b;
  --card-border: #27272a;
}