/* ============================================================
   SMARTCARE FM — NAVIGATION CSS
   Sticky header, desktop nav, mobile menu, dropdowns
   ============================================================ */

/* ── Header shell ── */
#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
  transition: box-shadow var(--t-base), background var(--t-base);
  /* NO fixed height here — let content define it, overflow visible for mobile menu */
  overflow: visible;
}

/* ── Nav bar (72px strip) ── */
.nav-bar {
  height: var(--nav-h);
  display: flex;
  align-items: center;
}

#site-header.scrolled {
  box-shadow: var(--shadow-md);
  background: rgba(255, 255, 255, 0.99);
}

/* ── Nav inner layout ── */
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-8);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-8);
}

/* ── Logo ── */
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo img {
  height: 64px;
  width: auto;
  object-fit: contain;
}

.nav-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.nav-logo-text .brand {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
}

.nav-logo-text .tagline {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

/* ── Desktop nav links ── */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex: 1;
  justify-content: center;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--gray-700);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: var(--navy);
  background: var(--gray-50);
}

.nav-link.active {
  color: var(--teal);
  font-weight: 600;
}

/* dropdown arrow — supports both text span.arrow and svg.arrow-icon */
.nav-link .arrow {
  font-size: 11px;
  color: var(--gray-400);
  transition: transform var(--t-fast);
  display: inline-block;
}
.nav-item:hover .arrow { transform: rotate(180deg); }
.arrow-icon { color: var(--gray-400); transition: transform var(--t-fast); }
.nav-item:hover .arrow-icon { transform: rotate(180deg); }

/* ── Dropdown menu — mega panel ── */
.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-base), visibility var(--t-base), transform var(--t-base);
  z-index: 200;
  display: flex !important;
  flex-direction: row !important;
  width: 620px;
  min-height: 360px;
  padding: 0;
  overflow: hidden;
}

.nav-item:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Left category panel */
.dd-panel-left {
  width: 180px;
  min-width: 180px;
  flex-shrink: 0;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dd-cat-tab {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--t-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  line-height: 1.3;
}

/* Force SVG to stay small inside tab buttons */
.dd-cat-tab svg,
.dd-cat-tab svg * {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  flex-shrink: 0;
  color: var(--gray-400);
  transition: color var(--t-fast);
  display: block;
}

.dd-cat-tab:hover,
.dd-cat-tab.active {
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-xs);
}
.dd-cat-tab:hover svg,
.dd-cat-tab.active svg {
  color: var(--teal) !important;
}
.dd-cat-tab.active {
  color: var(--teal);
  font-weight: 700;
}

/* Right services panel */
.dd-panel-right {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  overflow-y: auto;
  max-height: 420px;
}

.dd-panel-content {
  display: none;
}
.dd-panel-content.active {
  display: block;
}

.dd-panel-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}

.dd-services-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dd-service-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.dd-service-link:hover {
  background: var(--teal-pale);
  color: var(--teal);
}
.dd-service-link.dd-active {
  color: var(--teal);
  font-weight: 600;
  background: var(--teal-pale);
}
.dd-service-link::before {
  content: '';
  width: 5px;
  height: 5px;
  background: var(--gray-300);
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.dd-service-link:hover::before,
.dd-service-link.dd-active::before {
  background: var(--teal);
}

/* View all row at bottom */
.dd-view-all {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px;
  margin-top: 10px;
  border-top: 1px solid var(--gray-100);
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
  text-decoration: none;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.dd-view-all:hover {
  background: var(--teal-pale);
}

/* old classes kept for compat */
.dropdown a.dd-heading { display: none; }
.dropdown-divider { display: none; }
.dropdown a.dd-sub { display: none; }
.dropdown a.dd-all { display: none; }

/* ── Dropdown SVG icon ── */
.dropdown a .dd-svg {
  width: 15px;
  height: 15px;
  color: var(--teal);
  flex-shrink: 0;
}

/* Category heading rows — bold, navy, with icon */
.dropdown a.dd-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
}
.dropdown a.dd-heading:hover {
  background: var(--teal-pale);
  color: var(--teal);
}

/* Sub-item rows — indented, lighter weight */
.dropdown a.dd-sub {
  padding-left: 36px;
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 400;
}
.dropdown a.dd-sub:hover {
  background: var(--gray-50);
  color: var(--navy);
}
.dropdown a.dd-sub.dd-active {
  color: var(--teal);
  font-weight: 600;
}

/* View all link */
.dropdown a.dd-all {
  color: var(--teal);
  font-weight: 700;
  font-size: 13.5px;
}
.dropdown a.dd-all:hover {
  background: var(--teal-pale);
  color: var(--teal);
}

.dropdown-divider {
  height: 1px;
  background: var(--gray-100);
  margin: var(--sp-2) var(--sp-3);
}

/* ── Nav CTA buttons ── */
.nav-cta {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-shrink: 0;
}

.nav-phone {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.nav-phone:hover { background: var(--gray-50); }
.nav-phone svg { color: var(--teal); flex-shrink: 0; }
/* phone-icon empty span — hide it, number alone is fine */
.nav-phone .phone-icon { display: none; }

/* ── Hamburger ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.hamburger:hover { background: var(--gray-100); }

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile menu ── */
.mobile-menu {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-lg);
  z-index: 989;
  overflow-y: auto;
  max-height: calc(100vh - var(--nav-h));

  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--t-base), visibility var(--t-base), transform var(--t-base);
  /* Always fixed to viewport — works inside or outside header */
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mobile-menu-inner {
  padding: var(--sp-4) var(--sp-6) var(--sp-6);
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
}

.mobile-nav-link:last-of-type { border-bottom: none; }

.mobile-nav-link .m-arrow {
  font-size: 12px;
  color: var(--gray-400);
  transition: transform var(--t-fast);
}

.mobile-dropdown {
  display: none;
  flex-direction: column;
  padding: var(--sp-2) 0 var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--gray-100);
}

.mobile-dropdown.open { display: flex; }

.mobile-dropdown a {
  padding: 9px 0;
  font-size: 14px;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.mobile-dropdown a:hover { color: var(--teal); }

.mobile-cta-row {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.mobile-cta-row .btn { flex: 1; justify-content: center; }

/* ── Responsive breakpoints ── */
@media (max-width: 1100px) {
  .nav-phone { display: none; }
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
}

/* Tablet sizing adjustments */
@media (max-width: 768px) {
  .nav-inner { gap: var(--sp-3); }
}

/* Mobile sizing adjustments */
@media (max-width: 480px) {
  .nav-inner { 
    padding: 0 var(--sp-4); 
    gap: 10px; /* Reduces the gap to prevent overflow */
  }
  
  .nav-logo img { 
    height: 46px; /* Slightly scale down the logo image */
  }
  
  .nav-logo-text .brand {
    font-size: 18px; /* Slightly scale down the brand text */
  }
  
  .nav-logo-text .tagline { 
    display: none; 
  }
  
  /* Hides the top button to make room for the hamburger toggle. 
     Users can still access this button inside the opened mobile menu! */
  .nav-cta { 
    display: none; 
  }
}