/* =====================================================
   ADEX NAVIGATION COMPONENT STYLES
   File: components/nav.css

   HOW TO LINK (load AFTER style.css and responsive.css):
     <link rel="stylesheet" href="components/nav.css">
===================================================== */

/* ---- Logo Image ---- */
.logo-image {
  height: 60px;
  width: auto;
  display: block;
  padding: 10px 0;
}

/* ---- Header ---- */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0, 212, 255, 0.1);
  height: 80px;
  transition: all 0.3s ease;
}

#header.scrolled {
  padding: 0;
  background: rgba(10, 10, 26, 0.95);
  box-shadow: 0 4px 40px rgba(0, 212, 255, 0.15), 0 0 0 1px rgba(0, 212, 255, 0.1);
  border-bottom-color: rgba(0, 212, 255, 0.2);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
  padding: 0 40px;
}

/* ---- Theme Toggle Button ---- */
.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 12px;
  transition: all 0.3s ease;
  color: var(--text);
  position: relative;
}
.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: scale(1.1);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
  position: absolute;
  transition: all 0.3s ease;
}
.theme-icon-moon { opacity: 1; }
.theme-icon-sun { opacity: 0; }
body.light-mode .theme-icon-moon { opacity: 0; }
body.light-mode .theme-icon-sun { opacity: 1; }


/* ---- Logo ---- */
.logo {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  position: relative;
}

.logo-bracket {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  font-weight: 400;
  line-height: 1;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--text);
  line-height: 1;
}

.logo-accent { color: var(--accent); }

.logo-sub {
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  position: absolute;
  bottom: -11px;
  left: 16px;
}

/* ---- Navigation ---- */
@media (min-width: 769px) {
  #main-nav {
    display: block !important;
    position: relative !important;
    transform: none !important;
    opacity: 1 !important;
    top: 0;
  }
}

#main-nav ul {
  display: flex;
  align-items: center;
  gap: 15px;
  list-style: none;
}

.nav-link {
  color: #ffffff;
  text-decoration: none;
  position: relative;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s;
  border-radius: 2px;
}

.nav-link:hover,
.nav-link.active {
  color: #00d4ff;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: calc(100% - 20px);
  background: linear-gradient(90deg, #00d4ff, #ff00ff);
}

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

/* ---- Mobile Toggle ---- */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
  position: relative;
  z-index: 1100;
  color: var(--text);
}

.nav-toggle .icon-hamburger,
.nav-toggle .icon-close {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  display: block;
  transition: all 0.3s ease;
}

/* Show hamburger, hide X by default */
.nav-toggle .icon-hamburger { display: block; }
.nav-toggle .icon-close     { display: none;  }

/* When menu is open: show X, hide hamburger */
.nav-toggle.active .icon-hamburger { display: none;  }
.nav-toggle.active .icon-close     { display: block; }

.header-cta { flex-shrink: 0; }

/* =====================================================
   RESPONSIVE — Tablet (max 1024px)
===================================================== */
@media (max-width: 1024px) {
  #header {
    height: 70px;
  }

  .header-inner {
    height: 70px;
    padding: 0 24px;
  }

  .header-cta {
    display: none;
  }
}

/* =====================================================
   RESPONSIVE — Mobile Nav (max 992px)
===================================================== */
@media (max-width: 992px) {
  .header-cta {
    display: none !important;
  }

  .theme-toggle {
    margin-right: 0;
    margin-left: 8px;
  }

  .nav-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    cursor: pointer !important;
    padding: 6px !important;
    margin-left: 8px !important;
    z-index: 1100 !important;
    position: relative !important;
    min-width: 44px !important;
    min-height: 44px !important;
    color: #ffffff !important;
  }

  .nav-toggle .icon-hamburger,
  .nav-toggle .icon-close {
    width: 28px !important;
    height: 28px !important;
    stroke: #ffffff !important;
    flex-shrink: 0 !important;
  }

  .nav-toggle .icon-hamburger { display: block !important; }
  .nav-toggle .icon-close     { display: none  !important; }
  .nav-toggle.active .icon-hamburger { display: none  !important; }
  .nav-toggle.active .icon-close     { display: block !important; }

  /* Animate hamburger -> X when open */
  .nav-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg) !important;
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0 !important;
    transform: scaleX(0) !important;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg) !important;
  }

  /* Full-screen slide-in nav overlay */
  #main-nav {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100vh !important;
    background: rgba(4, 6, 15, 0.98);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-16px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    z-index: 1050;
  }

  #main-nav.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
  }

  #main-nav ul {
    flex-direction: column !important;
    align-items: center;
    gap: 0 !important;
    padding: 0;
    width: 100%;
  }

  #main-nav ul li {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  #main-nav ul li:first-child {
    border-top: 1px solid rgba(255,255,255,0.06);
  }

  .nav-link {
    display: block;
    padding: 20px 32px;
    font-size: 16px !important;
    letter-spacing: 0.15em;
    transition: color 0.3s, background 0.3s;
  }

  .nav-link:hover,
  .nav-link.active {
    background: rgba(56, 111, 163, 0.1);
    color: var(--accent);
  }

  .nav-link::after {
    display: none;
  }
}

/* =====================================================
   RESPONSIVE — Small Mobile (max 600px)
===================================================== */
@media (max-width: 600px) {
  #header {
    height: 64px;
  }

  .header-inner {
    height: 64px;
    padding: 0 16px;
  }

  .logo-image {
    height: 44px;
  }

  /* Ensure hamburger stays visible on smallest screens */
  .nav-toggle {
    display: flex !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 6px !important;
  }

  .nav-toggle .icon-hamburger,
  .nav-toggle .icon-close {
    width: 24px !important;
    height: 24px !important;
    stroke: #ffffff !important;
  }
}

/* =====================================================
   RESPONSIVE — Extra Small Mobile (max 400px)
===================================================== */
@media (max-width: 400px) {
  #header {
    height: 56px;
  }

  .header-inner {
    height: 56px;
    padding: 0 12px;
  }

  .logo-image {
    height: 38px;
  }

  /* Keep hamburger visible on tiny screens */
  .nav-toggle {
    display: flex !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 5px !important;
  }

  .nav-toggle .icon-hamburger,
  .nav-toggle .icon-close {
    width: 22px !important;
    height: 22px !important;
    stroke: #ffffff !important;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
    margin-left: 4px;
  }

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

/* =====================================================
   LIGHT MODE HEADER OVERRIDES
===================================================== */
body.light-mode #header {
  background: rgba(238, 241, 247, 0.96);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(100, 120, 180, 0.15);
  box-shadow: 0 1px 12px rgba(30, 50, 120, 0.07);
}
body.light-mode #header.scrolled {
  background: rgba(232, 237, 248, 0.99);
  box-shadow: 0 2px 20px rgba(30, 50, 120, 0.10);
  border-bottom-color: rgba(100, 120, 180, 0.20);
}
body.light-mode .theme-toggle {
  border-color: rgba(0, 87, 184, 0.22);
  color: #1a1f36;
  background: transparent;
}
body.light-mode .theme-toggle:hover {
  border-color: rgba(0, 87, 184, 0.45);
  background: rgba(0, 87, 184, 0.07);
}
body.light-mode .nav-link {
  color: #1a1f36;
}
body.light-mode .nav-link:hover,
body.light-mode .nav-link.active {
  color: #0057b8;
}
body.light-mode .nav-link::after {
  background: linear-gradient(90deg, #0057b8, #6b21a8);
}
body.light-mode .btn-primary {
  background: linear-gradient(135deg, #0057b8 0%, #6b21a8 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 87, 184, 0.28);
}
body.light-mode .btn-primary:hover {
  box-shadow: 0 4px 18px rgba(0, 87, 184, 0.40);
}
body.light-mode .logo-image {
  filter: none;
}

/* Light mode hamburger icon */
body.light-mode .nav-toggle .icon-hamburger,
body.light-mode .nav-toggle .icon-close {
  stroke: #1a1f36 !important;
}


/* =====================================================
   TOUCH DEVICE OPTIMIZATIONS
===================================================== */
@media (hover: none) and (pointer: coarse) {
  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* =====================================================
   SAFE AREA INSETS (iPhone notch / dynamic island)
===================================================== */
@supports (padding-top: env(safe-area-inset-top)) {
  #header {
    padding-top: env(safe-area-inset-top);
    height: calc(70px + env(safe-area-inset-top));
  }

  .header-inner {
    height: 70px;
  }

  @media (max-width: 600px) {
    #header {
      height: calc(64px + env(safe-area-inset-top));
    }
  }
}
