/* ===================================
   ROOT
   =================================== */

:root {
  --nav-bg: #111111;
  --nav-bg-scrolled: rgba(255, 255, 255, 0.1);
  --nav-height: 100px;
  --bottom-nav-height: 72px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===================================
   TOP NAVBAR (DESKTOP)
   =================================== */

.main-navbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 100%;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;

  background: var(--nav-bg);
  
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;

  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* SCROLLED STATE - WHITE CAPSULE WITH GLASSMORPHISM */
.main-navbar.scrolled {
  top: 1.5rem;
  width: calc(100% - 6rem);
  max-width: 1400px;
  height: 90px;

  /* Glassmorphism Effect */
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  
  /* Capsule Shape */
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  
  /* Glass Shadow */
  box-shadow: 
    0 8px 32px 0 rgba(0, 0, 0, 0.37),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

/* Spacer */
.navbar-spacer {
  height: var(--nav-height);
}

/* ===================================
   NAV CONTAINER
   =================================== */

.nav-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;

  display: flex;
  align-items: center;
  gap: 2rem;
  
  transition: padding 0.3s ease;
}

.main-navbar.scrolled .nav-container {
  padding: 0 2.5rem;
}

/* ===================================
   LOGO
   =================================== */

.nav-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo {
  height: 80px;
  width: auto;
  transition: all 0.3s ease;
}

.main-navbar.scrolled .nav-logo {
  height: 70px;
  filter: none;
}

/* ===================================
   DESKTOP MENU
   =================================== */

.nav-menu-desktop {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
  list-style: none;
}

/* Base link */
.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;

  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: "Montserrat", system-ui, sans-serif;

  background: transparent;
  border: none;
  cursor: pointer;

  transition: all 0.25s ease;
}

/* Hover / active (dark navbar) */
.nav-link:hover,
.nav-link.active {
  color: #f36e36;
  background: rgba(243, 110, 54, 0.1);
}

/* Links on glass capsule navbar */
.main-navbar.scrolled .nav-link {
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.main-navbar.scrolled .nav-link:hover,
.main-navbar.scrolled .nav-link.active {
  background: rgba(255, 255, 255, 0.25);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

/* Liquid Ink Bar Effect */
.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #f36e36, #ff8c52);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
}

.nav-link:hover::after {
  width: 100%;
}

/* ===================================
   DESKTOP CTA
   =================================== */

.nav-cta-desktop {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;

  padding: 0.8rem 2rem;
  border-radius: 999px;

  background: linear-gradient(135deg, #f36e36, #ff8c52);
  color: #ffffff;

  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  font-family: "Montserrat", system-ui, sans-serif;

  box-shadow: 0 4px 15px rgba(243, 110, 54, 0.3);

  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.main-navbar.scrolled .nav-cta-desktop {
  background: #ffffff;
  color: #f36e36;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.nav-cta-desktop:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(243, 110, 54, 0.5);
}

.main-navbar.scrolled .nav-cta-desktop:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* ===================================
   DROPDOWN (DESKTOP)
   =================================== */

.nav-dropdown {
  position: relative;
}

.nav-dropbtn {
  border: none;
  background: transparent;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;

  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  font-weight: 600;
  font-family: "Montserrat", system-ui, sans-serif;

  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  
  transition: all 0.25s ease;
}

.nav-dropbtn::after {
  content: "▾";
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.nav-dropdown:hover .nav-dropbtn::after {
  transform: rotate(180deg);
}

.main-navbar:not(.scrolled) .nav-dropbtn:hover {
  color: #f36e36;
  background: rgba(243, 110, 54, 0.1);
}

.main-navbar.scrolled .nav-dropbtn {
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.main-navbar.scrolled .nav-dropbtn:hover {
  background: rgba(255, 255, 255, 0.25);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

/* Dropdown menu */
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 0;

  min-width: 220px;
  padding: 0.75rem 0;

  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);

  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);

  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1001;
  list-style: none;
  margin: 0;
}

.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-menu li {
  list-style: none;
}

.nav-dropdown-link {
  display: block;
  padding: 0.8rem 1.5rem;

  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: "Montserrat", system-ui, sans-serif;
  
  transition: all 0.2s ease;
}

.nav-dropdown-link:hover {
  background: rgba(243, 110, 54, 0.3);
  color: #ffffff;
  padding-left: 2rem;
}

/* ===================================
   BOTTOM NAV (MOBILE) - WITH ICONS
   =================================== */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  height: var(--bottom-nav-height);
  display: none;
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 100%;

  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.5rem 0 0.7rem 0;
  
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.bottom-nav-item {
  background: transparent;
  border: none;

  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-family: "Montserrat", system-ui, sans-serif;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;

  padding: 0.4rem 0;
  cursor: pointer;
  position: relative;

  transition: color 0.25s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:active {
  transform: scale(0.92);
}

.bottom-nav-item:hover {
  color: rgba(255, 255, 255, 0.95);
}

.bottom-nav-item.active {
  color: #f36e36;
}

/* Icon styling */
.bottom-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.bottom-nav-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

/* Label */
.bottom-nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}

/* CENTER FAB BUTTON */
.bottom-nav-center {
  position: relative;
}

.bottom-nav-center .bottom-nav-icon,
.bottom-nav-center .bottom-nav-label {
  display: none !important;
}

.bottom-nav-center .bottom-nav-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;

  background: linear-gradient(135deg, #f36e36, #ff8c52);
  color: #ffffff;

  box-shadow: 0 6px 20px rgba(243, 110, 54, 0.5);

  display: flex !important;
  align-items: center;
  justify-content: center;

  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);

  transition: transform 0.2s ease, box-shadow 0.2s ease;
  
  border: 4px solid #111111;
}

.bottom-nav-center:active .bottom-nav-fab {
  transform: translateX(-50%) scale(0.92);
  box-shadow: 0 4px 16px rgba(243, 110, 54, 0.4);
}

.bottom-nav-center .bottom-nav-fab svg {
  stroke: currentColor;
}

/* Active state with indicator dot */
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f36e36;
  box-shadow: 0 0 8px rgba(243, 110, 54, 0.6);
}

/* ===================================
   VISIBILITY RULES - CRITICAL FIX
   =================================== */

/* Desktop only - Large screens */
@media (min-width: 1280px) {
  .main-navbar {
    display: flex !important;
  }
  
  .navbar-spacer {
    display: block !important;
    height: var(--nav-height) !important;
  }
  
  .bottom-nav {
    display: none !important;
  }
  
  body {
    padding-bottom: 0 !important;
  }
}

/* Tablets and Mobile - Show bottom nav */
@media (max-width: 1279px) {
  .main-navbar {
    display: none !important;
  }

  .navbar-spacer {
    display: none !important;
    height: 0 !important;
  }

  .bottom-nav {
    display: block !important;
  }

  body {
    padding-bottom: var(--bottom-nav-height) !important;
  }
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
  :root {
    --bottom-nav-height: 70px;
  }

  .bottom-nav-icon {
    width: 28px;
    height: 28px;
  }

  .bottom-nav-label {
    font-size: 0.65rem;
  }

  .bottom-nav-center .bottom-nav-fab {
    width: 58px;
    height: 58px;
  }
}

/* Mobile Large - Landscape phones and small tablets */
@media (max-width: 768px) {
  :root {
    --nav-height: 80px;
    --bottom-nav-height: 68px;
  }

  .nav-container {
    padding-inline: 1.5rem;
  }

  .nav-logo {
    height: 64px;
  }
  
  .main-navbar.scrolled {
    width: calc(100% - 2rem);
    top: 1rem;
    height: 80px;
  }
  
  .main-navbar.scrolled .nav-logo {
    height: 60px;
  }

  .bottom-nav-icon {
    width: 26px;
    height: 26px;
  }

  .bottom-nav-label {
    font-size: 0.6rem;
  }

  .bottom-nav-center .bottom-nav-fab {
    width: 56px;
    height: 56px;
  }
}

/* Mobile Medium */
@media (max-width: 480px) {
  :root {
    --bottom-nav-height: 64px;
  }

  .nav-logo {
    height: 58px;
  }
  
  .main-navbar.scrolled {
    width: calc(100% - 1rem);
    top: 0.75rem;
    height: 75px;
  }
  
  .main-navbar.scrolled .nav-logo {
    height: 56px;
  }

  .bottom-nav-icon {
    width: 24px;
    height: 24px;
  }

  .bottom-nav-label {
    font-size: 0.58rem;
  }

  .bottom-nav-center .bottom-nav-fab {
    width: 52px;
    height: 52px;
    top: -26px;
  }

  .bottom-nav-center .bottom-nav-fab svg {
    width: 24px;
    height: 24px;
  }
}

/* Mobile Small - Very small screens */
@media (max-width: 375px) {
  :root {
    --bottom-nav-height: 60px;
  }

  .bottom-nav-icon {
    width: 22px;
    height: 22px;
  }

  .bottom-nav-label {
    font-size: 0.55rem;
  }

  .bottom-nav-center .bottom-nav-fab {
    width: 50px;
    height: 50px;
    top: -25px;
  }

  .bottom-nav-center .bottom-nav-fab svg {
    width: 22px;
    height: 22px;
  }
}

/* Specific device targeting */
@media only screen 
  and (min-device-width: 768px) 
  and (max-device-width: 1024px) {
  /* iPad and tablets */
  .main-navbar {
    display: none !important;
  }
  
  .bottom-nav {
    display: block !important;
  }
}

@media only screen 
  and (min-device-width: 375px) 
  and (max-device-width: 812px) 
  and (-webkit-device-pixel-ratio: 3) {
  /* iPhone X, XS, 11 Pro, 12, 13 */
  .main-navbar {
    display: none !important;
  }
  
  .bottom-nav {
    display: block !important;
  }
}

@media only screen 
  and (min-device-width: 320px) 
  and (max-device-width: 568px) {
  /* iPhone SE, 5, 5S */
  .main-navbar {
    display: none !important;
  }
  
  .bottom-nav {
    display: block !important;
  }
}

/* ===================================
   FOCUS STATES
   =================================== */

.nav-link:focus,
.nav-cta-desktop:focus,
.bottom-nav-item:focus,
.nav-dropdown-link:focus,
.nav-dropbtn:focus {
  outline: 2px solid rgba(243, 110, 54, 0.5);
  outline-offset: 2px;
}

.bottom-nav-item:focus-visible {
  outline: 2px solid rgba(243, 110, 54, 0.6);
  outline-offset: 4px;
  border-radius: 8px;
}

/* ===================================
   CUSTOM SCROLLBAR
   =================================== */

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #111111;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #f36e36, #ff8c52);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff8c52, #ffa366);
}

/* ===================================
   SAFE AREA INSETS FOR NOTCHED DEVICES
   =================================== */

@supports (padding: max(0px)) {
  .bottom-nav-inner {
    padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
  }
  
  body {
    padding-bottom: max(var(--bottom-nav-height), calc(var(--bottom-nav-height) + env(safe-area-inset-bottom))) !important;
  }
}
