/* ==========================================================================
   NAVBAR.CSS — Shared site header & navigation
   M/s Bisweswar Pharmaceuticals & Surgical | CliniCare
   --------------------------------------------------------------------------
   Used by: index, about, contactus, service1–4
   Relies on the design tokens (:root custom properties) defined in each page.

   TABLE OF CONTENTS
   1. Layout helpers
   2. Header shell
   3. Brand
   4. Desktop navigation
   5. Services dropdown
   6. Header actions (phone + CTA)
   7. Mobile menu toggle (hamburger)
   8. Footer brand (re-uses brand styles)
   9. Responsive — tablet & mobile (≤ 992px)
  10. Responsive — small phones (≤ 480px)
  11. Reduced motion
   ========================================================================== */


/* 1. LAYOUT HELPERS
   ========================================================================== */
:root {
  --nav-height: 86px;
  --nav-height-scrolled: 76px;
  --nav-breakpoint: 992px; /* keep in sync with BREAKPOINT in navbar.js */
}

html {
  /* Keeps in-page anchors from hiding underneath the sticky header */
  scroll-padding-top: calc(var(--nav-height-scrolled) + 1rem);
}

body.nav-open {
  overflow: hidden; /* Lock page scroll while the mobile menu is open */
}


/* 2. HEADER SHELL
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.site-header.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 30px rgba(11, 34, 48, 0.08);
  border-bottom-color: rgba(12, 165, 176, 0.18);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: var(--nav-height);
  transition: height 0.3s ease;
}

.site-header.scrolled .nav {
  height: var(--nav-height-scrolled);
}


/* 3. BRAND
   ========================================================================== */
.brand {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  flex-shrink: 0;
  min-width: 0;
}

.brand-logo-emblem {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(12, 165, 176, 0.35);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.brand-logo-emblem::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 17px;
  border: 1.5px solid rgba(12, 165, 176, 0.35);
  opacity: 0;
  transition: var(--transition);
}

.brand:hover .brand-logo-emblem {
  transform: rotate(8deg) scale(1.06);
  box-shadow: 0 12px 28px rgba(12, 165, 176, 0.45);
}

.brand:hover .brand-logo-emblem::after {
  opacity: 1;
}

.brand-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-titles b {
  display: block;
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--navy);
}

.brand-titles span {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--primary);
}


/* 4. DESKTOP NAVIGATION
   ========================================================================== */
.nav-menu {
  margin-inline: auto; /* Centres the menu between brand and actions */
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2.1rem;
  list-style: none;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 0.5rem 0.2rem;
  color: var(--navy);
  transition: color 0.25s ease;
}

/* Animated underline */
.nav-link::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 0;
  height: 2.5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transform: translateX(-50%);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link:hover,
.nav-item:focus-within > .nav-link {
  color: var(--primary);
}

.nav-link:hover::after,
.nav-link[aria-current="page"]::after,
.nav-item.is-current > .nav-link::after {
  width: 100%;
}

.nav-link[aria-current="page"],
.nav-item.is-current > .nav-link {
  color: var(--primary);
}

.nav-link:focus-visible,
.dropdown-toggle:focus-visible,
.dropdown-link:focus-visible,
.nav-toggle:focus-visible,
.nav-actions a:focus-visible {
  outline: 2.5px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}


/* 5. SERVICES DROPDOWN
   ========================================================================== */
.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-left: 0.1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy);
  cursor: pointer;
  transition: color 0.25s ease;
}

.dropdown-toggle svg {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.has-dropdown:hover > .dropdown-toggle,
.has-dropdown.is-open > .dropdown-toggle,
.has-dropdown.is-current > .dropdown-toggle {
  color: var(--primary);
}

.dropdown-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  z-index: 10;
  width: 340px;
  margin-top: 14px;
  padding: 0.6rem;
  list-style: none;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.3s;
}

/* Invisible bridge so the menu doesn't close while the cursor travels to it */
.dropdown::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 0;
  right: 0;
  height: 16px;
}

/* Open states: JS-toggled (click / keyboard) or hover on desktop pointer devices */
.has-dropdown.is-open > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}

@media (hover: hover) and (min-width: 993px) {
  .has-dropdown:hover > .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition-delay: 0s;
  }

  .has-dropdown:hover > .dropdown-toggle svg {
    transform: rotate(180deg);
  }
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  transition: background-color 0.25s ease;
}

.dropdown-link:hover,
.dropdown-link[aria-current="page"] {
  background: var(--primary-light);
}

.dropdown-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  transition: var(--transition);
}

.dropdown-link:hover .dropdown-icon,
.dropdown-link[aria-current="page"] .dropdown-icon {
  background: var(--primary);
  color: #FFFFFF;
}

.dropdown-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dropdown-text b {
  font-family: var(--font-main);
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--navy);
}

/* Mega Menu Styles */
.mega-menu {
  width: 680px;
  padding: 1.2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.mega-menu-column {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.mega-menu-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, #D8F2F5 100%);
  border: 1px solid rgba(12, 165, 176, 0.25);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mega-menu-header svg {
  flex-shrink: 0;
}

.mega-submenu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mega-submenu .dropdown-link {
  padding: 0.6rem 0.8rem;
  gap: 0.6rem;
}

.mega-submenu .dropdown-text {
  font-size: 0.88rem;
  color: var(--slate);
  font-weight: 500;
}

.mega-submenu .dropdown-link:hover .dropdown-text {
  color: var(--primary-dark);
}

.dropdown-text small {
  margin-top: 0.1rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--slate);
}


/* 6. HEADER ACTIONS (PHONE + CTA)
   ========================================================================== */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.nav-phone-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  background: var(--bg-light);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  transition: var(--transition);
}

.nav-phone-pill svg {
  color: var(--primary);
  flex-shrink: 0;
}

.nav-phone-pill:hover {
  background: #FFFFFF;
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(12, 165, 176, 0.15);
}

.nav-actions .btn {
  padding: 0.78rem 1.6rem;
  font-size: 0.92rem;
}

/* Copy of the actions that lives inside the menu; shown on mobile only */
.nav-menu-actions {
  display: none;
}


/* 7. MOBILE MENU TOGGLE (HAMBURGER)
   ========================================================================== */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-light);
  color: var(--navy);
  cursor: pointer;
  transition: var(--transition);
}

.nav-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.nav-toggle .icon-close,
.nav-toggle[aria-expanded="true"] .icon-open {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}


/* 8. FOOTER BRAND (RE-USES BRAND STYLES ON DARK BACKGROUND)
   ========================================================================== */
.site-footer .brand-titles b {
  color: #FFFFFF;
}


/* 9. RESPONSIVE — MOBILE (≤ 576px)
   The primary menu becomes a full-width, scrollable slide-down panel.
   ========================================================================== */
@media (max-width: 1180px) and (min-width: 993px) {
  /* Tighten desktop layout before switching to the mobile menu */
  .nav-list { gap: 1.5rem; }
  .nav-phone-pill span { display: none; }
  .nav-phone-pill { padding: 0.65rem; }
}

@media (max-width: 992px) {
  :root {
    --nav-height: 76px;
    --nav-height-scrolled: 70px;
  }

  .nav-actions {
    display: none;
  }

  .nav-toggle {
    display: inline-flex !important;
    z-index: 1001;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - var(--nav-height));
    max-height: calc(100dvh - var(--nav-height));
    margin: 0;
    padding: 1rem max(1.5rem, calc((100% - 1220px) / 2)) 2rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #FFFFFF;
    border-bottom: 2px solid var(--border-subtle);
    box-shadow: 0 16px 36px rgba(11, 34, 48, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.3s;
    z-index: 999;
  }

  .nav-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    font-size: 1.05rem;
    font-weight: 700;
  }

  .nav-item {
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-subtle);
  }

  .nav-link {
    flex: 1;
    padding: 1rem 0.25rem;
  }

  .nav-link::after {
    display: none; /* Underline is a desktop-only affordance */
  }

  .dropdown-toggle {
    width: 48px;
    height: 48px;
    margin: 0;
  }

  /* Dropdown turns into an inline accordion */
  .dropdown {
    position: static;
    flex: 0 0 100%;
    width: 100%;
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--bg-light);
    border: 0;
    border-radius: var(--radius-md);
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: max-height 0.35s ease, padding 0.35s ease, margin 0.35s ease;
  }

  .dropdown::before {
    display: none;
  }

  .has-dropdown.is-open > .dropdown {
    max-height: 520px;
    margin: 0 0 1rem;
    padding: 0.5rem;
    transform: none; /* Cancels the desktop open-state offset */
  }

  /* Mega Menu Responsive Styles */
  .mega-menu {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0.8rem;
  }

  .mega-menu-column {
    gap: 0.6rem;
  }

  .mega-menu-header {
    font-size: 0.8rem;
    padding: 0.5rem 0.7rem;
  }

  .mega-submenu .dropdown-link {
    padding: 0.5rem 0.7rem;
  }

  .dropdown-link {
    padding: 0.7rem 0.6rem;
  }

  .nav-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-top: 1.5rem;
  }

  .nav-menu-actions .nav-phone-pill,
  .nav-menu-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 0.9rem 1.2rem;
  }

  .brand-logo-emblem {
    width: 44px;
    height: 44px;
  }

  .brand-titles b {
    font-size: 1.15rem;
  }
}


/* 10. RESPONSIVE — SMALL PHONES (≤ 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .nav {
    gap: 0.75rem;
  }

  .brand {
    gap: 0.7rem;
  }

  .brand-titles b {
    font-size: 1.05rem;
  }

  .brand-titles span {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }
}

@media (max-width: 360px) {
  .brand-titles span {
    display: none; /* Prevents the brand from crowding the menu button */
  }
}


/* 11. REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .nav,
  .nav-menu,
  .dropdown,
  .dropdown-toggle svg,
  .brand-logo-emblem,
  .nav-link::after {
    transition: none !important;
  }
}
