/**
 * Shared Layout Styles for PromptLens
 * Used by all pages for consistent header, footer, and layout
 */

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-raised: #1a1a26;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --text-muted: #8888a0;
  --accent: #7c5cff;
  --accent-glow: rgba(124, 92, 255, 0.15);
  --warm: #ff6b4a;
  --teal: #4adfcf;
  /* Header height — used by body { padding-top } to offset content below fixed nav.
     Matches nav padding (1rem top + 1rem bottom = 32px) + logo height (32px) ≈ 65px.
     beta-widgets.js updates this to bannerHeight + navHeight when the dev banner shows. */
  --header-height: 65px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.6;
  /* Pure CSS offset — keeps content below the fixed header on every page, before any JS runs.
     --header-height defaults to 65px (nav only). beta-widgets.js updates it to
     bannerH + navH when the dev banner is visible. No JS needed for this offset. */
  padding-top: var(--header-height);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
}

/* ========== NAVIGATION ========== */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
  padding: 1rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(20px);
  background: rgba(10, 10, 15, 0.95);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  transition: opacity 0.3s;
}

.logo:hover {
  opacity: 0.8;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
}

/* ========== HAMBURGER MENU ========== */

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  z-index: 101;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ========== NAV GROUPS ========== */

/* Left group: logo + primary links (Home, Gallery, Upload) */
.nav-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-left-links {
  display: flex;
  gap: 1.75rem;
  align-items: center;
}

/* Right group: secondary links + toggle + auth button */
.nav-right-links {
  display: flex;
  gap: 1.75rem;
  align-items: center;
}

/* Legacy .nav-container support */
.nav-container {
  display: flex;
  gap: 2rem;
  align-items: center;
}

#nav-links {
  display: flex;
  gap: 1.75rem;
  align-items: center;
}

#nav-links a,
.nav-left-links a,
.nav-right-links a {
  text-decoration: none;
  transition: color 0.3s;
}

/* ========== MODE TOGGLE BUTTON ========== */

.mode-toggle-btn {
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.3s;
  color: var(--text-muted);
}

.mode-toggle-btn:hover {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--accent);
}

/* ========== FOOTER ========== */

footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 3rem 2.5rem;
  margin-top: 8rem;
}

footer a {
  transition: color 0.3s;
}

footer a:hover {
  color: var(--accent);
}

/* ========== MOBILE NAV MENU ========== */

/* Mobile menu — hidden on desktop */
.mobile-nav-menu {
  display: none;
}

/* ========== MOBILE RESPONSIVE ========== */

@media (max-width: 768px) {
  nav {
    padding: 1rem 1.5rem;
  }

  .hamburger {
    display: flex;
  }

  /* Hide desktop nav groups entirely on mobile */
  .nav-left-links,
  .nav-right-links,
  .nav-container,
  #nav-links {
    display: none !important;
  }

  /* Mobile dropdown — hidden by default, shown when hamburger is tapped */
  .mobile-nav-menu {
    display: none;
    position: absolute;
    top: var(--header-height, 65px);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    background: rgba(10, 10, 15, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
    z-index: 99;
  }

  .mobile-nav-menu.mobile-open {
    display: flex;
  }

  .mobile-nav-menu a {
    font-size: 1rem !important;
    font-weight: 500 !important;
    padding: 0.25rem 0;
  }

  .logo {
    font-size: 1.1rem;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  footer {
    padding: 2rem 1.5rem;
  }

  footer > div > div {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  nav {
    padding: 0.75rem 1rem;
  }

  .logo {
    font-size: 1rem;
  }

  .logo-icon {
    width: 24px;
    height: 24px;
  }

  .mobile-nav-menu a {
    font-size: 0.95rem !important;
  }
}
