/* header.css v10 — in7.ba navbar redesign */

/* ─── NAVBAR ──────────────────────────────────────────────── */
.main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: var(--bg-navbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-navbar);
  z-index: var(--z-nav);
  transition: box-shadow var(--transition-base),
              background var(--transition-base),
              border-color var(--transition-base);
  padding: 0;
}

/* Scrolled state — more shadow, visible border */
.main-nav.scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  border-bottom-color: var(--border-default);
}

/* ─── HOME PAGE — transparent navbar at top ───────────────── */
/*
 * .nav-home is added to .main-nav on the homepage only (see header.php).
 * When at the very top (no .scrolled) it is fully transparent so the
 * hero background shows through. JS adds .scrolled after 24px scroll.
 */
.nav-home:not(.scrolled) {
  background: transparent;
  border-bottom-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* In light theme the transparent state needs a subtle gradient so
   dark text stays legible against a potentially light hero bg. */
[data-theme="light"] .nav-home:not(.scrolled) {
  background: linear-gradient(180deg, rgba(250,248,244,0.85) 0%, transparent 100%);
}

.nav-container {
  max-width: var(--max-w);
  width: 100%;
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(16px, 3vw, 32px);
}

/* ─── LOGO ────────────────────────────────────────────────── */
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  flex-shrink: 0;
}

.header-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  transition: transform var(--transition-base);
  /* Crisp on retina */
  image-rendering: -webkit-optimize-contrast;
}

.header-brand:hover .header-logo {
  transform: scale(1.06);
}

.header-brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.header-brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  transition: color var(--transition-fast);
}

.header-brand:hover .header-brand-name {
  color: var(--color-accent);
}

.header-brand-name .dot {
  color: var(--color-accent);
}

.header-brand-subtitle {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* ─── NAV LINKS ───────────────────────────────────────────── */
.navbar-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: center;
}

.nav-link-custom {
  position: relative;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-base), background var(--transition-base);
  white-space: nowrap;
}

.nav-link-custom:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
  text-decoration: none;
}

.nav-link-custom.active {
  color: var(--color-accent);
  background: var(--color-accent-light);
}

/* Active underline indicator */
.nav-link-custom.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 13px;
  right: 13px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-accent);
}

/* ─── ACTION AREA ─────────────────────────────────────────── */
.action-area {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* LANGUAGE */
.language-switcher {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.language-link {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.language-link:hover { color: var(--color-accent); }

.language-link.active {
  color: var(--color-accent);
  background: var(--color-accent-light);
}

/* THEME TOGGLE */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1px solid var(--border-default);
  cursor: pointer;
  font-size: 15px;
  transition: border-color var(--transition-base), background var(--transition-base);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

/* NAV BUTTONS */
.btn-nav-pricing {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-base);
}
.btn-nav-pricing:hover { color: var(--color-accent); }

.btn-nav-ghost {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  transition: color var(--transition-base), background var(--transition-base);
}
.btn-nav-ghost:hover {
  color: var(--color-accent);
  background: var(--color-accent-light);
  text-decoration: none;
}

.btn-nav-secondary {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-on-accent);
  background: var(--color-accent);
  text-decoration: none;
  padding: 7px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background var(--transition-base);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.btn-nav-secondary:hover {
  background: var(--color-accent-hover);
  color: var(--text-on-accent);
  text-decoration: none;
}

/* LOGOUT */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: color var(--transition-base), border-color var(--transition-base);
}
.logout-btn:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* USER MENU */
.user-menu { position: relative; }

.user-identity {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
}
.user-identity:hover {
  border-color: var(--color-accent);
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
}
.user-identity .fa-crown { color: var(--color-accent); font-size: 12px; }
.user-identity-caret {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition-base);
}
.user-menu:hover .user-identity-caret { transform: rotate(180deg); }

.user-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 6px;
  /* Dropdown sits above sticky content but below modals.
     --z-dropdown = 300 (defined in E1 tokens; fallback explicit here). */
  z-index: var(--z-dropdown, 300);
  animation: nav-panel-in 0.15s ease both;
}

@keyframes nav-panel-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-menu:hover .user-menu-panel {
  display: flex;
  flex-direction: column;
}

.user-menu-link,
.user-menu-form button.user-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.user-menu-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
  text-decoration: none;
}
.user-menu-link.danger:hover {
  color: var(--color-danger);
  background: rgba(180, 35, 24, 0.08);
}
.user-menu-link i { width: 16px; color: var(--text-muted); font-size: 13px; }

.user-menu-form {
  margin: 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
  padding-top: 4px;
}

/* ─── BODY BASE ───────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  padding-top: var(--navbar-height);
  min-height: 100vh;
}

/* ─── MOBILE TOGGLER ──────────────────────────────────────── */
.navbar-toggler {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 16px;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.navbar-toggler:focus { box-shadow: none; outline: none; }
.navbar-toggler:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

/* Animate hamburger → X when open */
.navbar-toggler[aria-expanded="true"] .nav-toggler-icon::before {
  content: '\f00d'; /* fa-xmark */
}
.navbar-toggler .nav-toggler-icon {
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* ─── MOBILE COLLAPSE ─────────────────────────────────────── */
@media (max-width: 991px) {
  .navbar-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 0;
  }

  .nav-link-custom {
    display: block;
    width: 100%;
    padding: 11px 14px;
    font-size: 15px;
  }

  /* Active underline not needed in mobile — background is enough */
  .nav-link-custom.active::after {
    display: none;
  }

  .action-area {
    flex-wrap: wrap;
    padding: 12px 0 16px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 4px;
    gap: 8px;
  }

  /*
   * The collapse panel renders below the fixed navbar as its own layer.
   * backdrop-filter on the parent (.main-nav) doesn't bleed into children
   * that are separately positioned, so we set the bg directly here.
   * NOTE: mobile.css section 7 previously overrode this with var(--color-accent) — FIXED.
   */
  .navbar-collapse {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    z-index: calc(var(--z-nav) - 1);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 4px 16px;
    box-shadow: var(--shadow-card);
    max-height: calc(100dvh - var(--navbar-height));
    overflow-y: auto;
    /* Smooth slide */
    transform-origin: top center;
  }

  /* When closing, Bootstrap removes .show and adds .collapsing —
     the height animation is handled by Bootstrap. We just ensure
     the background stays correct during the collapsing transition. */
  .navbar-collapse.collapsing {
    background: var(--bg-card);
  }

  .nav-container { flex-wrap: wrap; }

  /* Mobile logo: slightly smaller */
  .header-logo {
    width: 34px;
    height: 34px;
  }
  .header-brand-name { font-size: 20px; }
}
