/* ============================================================
   NAVBAR
   ============================================================ */

.navbar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 1160px;
  height: 62px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(2, 5, 51, 0.14);
  box-shadow: 0 2px 12px rgba(2, 5, 51, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  padding: 0 8px 0 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: height 0.25s ease, background 0.25s ease,
    border-color 0.25s ease, box-shadow 0.25s ease,
    top 0.25s ease;
}

.navbar.scrolled {
  top: 10px;
  height: 56px;
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(2, 5, 51, 0.22);
  box-shadow: 0 4px 20px rgba(2, 5, 51, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

/* ---- Logo ---- */
.navbar-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 1;
  transition: opacity 0.18s ease;
}

.navbar-logo:hover {
  opacity: 0.75;
}

.navbar-logo img {
  height: 82px;
  width: auto;
  max-width: 300px;
  object-fit: contain;
}

/* ---- Nav Links ---- */
.navbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  transition: color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

.navbar-links a:hover {
  color: var(--text-primary);
  background: rgba(2, 5, 51, 0.05);
}

/* ---- Nav Actions ---- */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.navbar-actions .btn-ghost {
  font-size: 0.855rem;
  font-weight: 500;
  padding: 8px 16px;
  color: var(--text-secondary);
  border-radius: 999px;
  transition: color 0.18s ease, background 0.18s ease;
}

.navbar-actions .btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(2, 5, 51, 0.05);
}

.navbar-actions .btn-primary {
  font-size: 0.855rem;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 999px;
  letter-spacing: 0.1px;
}

.navbar-actions .btn-primary:hover {
  transform: none;
  opacity: 0.88;
}

/* ---- Hamburger ---- */
.navbar-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.18s ease;
  flex-shrink: 0;
  margin-left: 4px;
}

.navbar-hamburger:hover {
  background: rgba(2, 5, 51, 0.06);
}

.navbar-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 99px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease,
    width 0.3s ease;
  transform-origin: center;
}

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

.navbar-hamburger.active span:nth-child(2) {
  opacity: 0;
  width: 0;
}

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

/* ---- Mobile Backdrop ---- */
.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.32s ease;
}

.mobile-backdrop.active {
  display: block;
  opacity: 1;
}

/* ---- Mobile Drawer ---- */
.navbar-mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  max-width: 88vw;
  background: #ffffff;
  border-left: 1px solid var(--border-light);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.32s ease;
  overflow-y: auto;
}

.navbar-mobile-menu.active {
  transform: translateX(0);
  visibility: visible;
}

/* Drawer header */
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  min-height: 70px;
}

.mobile-menu-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.mobile-menu-close:hover {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--surface);
}

/* Drawer links */
.mobile-menu-links {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  flex: 1;
}

.mobile-menu-links a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  min-height: 50px;
  border-left: 3px solid transparent;
}

.mobile-menu-links a:hover {
  color: var(--brand-green);
  background: rgba(2, 5, 51, 0.04);
  border-left-color: var(--brand-green);
}

.mobile-menu-links a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.18s ease;
}

.mobile-menu-links a:hover svg {
  opacity: 1;
}

/* Drawer CTAs */
.mobile-menu-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-top: 1px solid var(--border-light);
}

.mobile-menu-ctas .btn {
  width: 100%;
  justify-content: center;
  min-height: 46px;
  border-radius: 999px;
}

/* Staggered entrance */
.navbar-mobile-menu.active .mobile-menu-links a {
  animation: mobileNavIn 0.28s ease forwards;
  opacity: 0;
}

.navbar-mobile-menu.active .mobile-menu-links a:nth-child(1) {
  animation-delay: 0.06s;
}

.navbar-mobile-menu.active .mobile-menu-links a:nth-child(2) {
  animation-delay: 0.1s;
}

.navbar-mobile-menu.active .mobile-menu-links a:nth-child(3) {
  animation-delay: 0.14s;
}

.navbar-mobile-menu.active .mobile-menu-links a:nth-child(4) {
  animation-delay: 0.18s;
}

@keyframes mobileNavIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .navbar {
    width: calc(100% - 32px);
    padding: 0 8px 0 16px;
  }
}

@media (max-width: 768px) {

  .navbar-links,
  .navbar-actions {
    display: none;
  }

  .navbar-hamburger {
    display: flex;
  }
}

@media (max-width: 480px) {
  .navbar {
    top: 10px;
    width: calc(100% - 20px);
    height: 56px;
    padding: 0 6px 0 14px;
    border-radius: 16px;
  }

  .navbar.scrolled {
    top: 6px;
    height: 52px;
  }

  .navbar-logo img {
    height: 68px;
  }
}

/* ============================================================
   THEME TOGGLE SWITCH IN NAVBAR
   ============================================================ */

.navbar-theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.navbar-theme-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.navbar-theme-track {
  position: relative;
  width: 48px;
  height: 26px;
  background: #E5E7EB;
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.navbar-theme-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease, box-shadow 0.3s ease;
}

.navbar-theme-sun {
  display: block;
  color: #040634;
  transition: opacity 0.2s ease, transform 0.3s ease;
}

.navbar-theme-moon {
  display: none;
  color: #A9EAFF;
  transition: opacity 0.2s ease, transform 0.3s ease;
}

/* Checked state (dark mode) */
.navbar-theme-switch input:checked + .navbar-theme-track {
  background: #1E293B;
  border-color: #334155;
}

.navbar-theme-switch input:checked + .navbar-theme-track .navbar-theme-thumb {
  transform: translateX(22px);
  background: #0F172A;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.navbar-theme-switch input:checked + .navbar-theme-track .navbar-theme-sun {
  display: none;
}

.navbar-theme-switch input:checked + .navbar-theme-track .navbar-theme-moon {
  display: block;
}



/* Dark mode navbar overrides */
[data-theme="dark"] .navbar {
  background: rgba(17, 23, 38, 0.88);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .navbar.scrolled {
  background: rgba(17, 23, 38, 0.96);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .navbar-links a {
  color: var(--text-secondary);
}

[data-theme="dark"] .navbar-links a:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .navbar-mobile-menu {
  background: #111726;
  border-left-color: #26334D;
}

.mobile-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin: 12px 0 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.mobile-theme-row svg {
  width: 20px;
  height: 20px;
}

.mobile-theme-row .theme-icon-light {
  display: block;
  color: var(--text-primary);
}

.mobile-theme-row .theme-icon-dark {
  display: none;
  color: #A9EAFF;
}

[data-theme="dark"] .mobile-theme-row .theme-icon-light {
  display: none;
}

[data-theme="dark"] .mobile-theme-row .theme-icon-dark {
  display: block;
  color: #A9EAFF;
}