/* ==========================================================================
   CaliMed Billing - Shared Header & Footer Styles
   Desktop Sticky Navigation, Dropdowns, Mobile Drawer, and Footer
   ========================================================================== */

/* Top Utility Bar */
.top-bar {
  background-color: var(--forest-900);
  color: var(--white);
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px clamp(20px, 4vw, 32px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.top-bar-tagline {
  font-family: var(--font-tagline);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  color: var(--sage-400);
}

.top-bar-contacts {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.top-bar-link {
  color: var(--white);
  text-decoration: none;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast);
}

.top-bar-link:hover {
  color: var(--teal-500);
}

.top-bar-phone {
  font-weight: 600;
  color: var(--white);
}

/* Sticky Main Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--white);
  border-bottom: 1px solid var(--sage-200);
  transition: box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.site-header.is-scrolled {
  box-shadow: 0 4px 20px rgba(18, 42, 36, 0.08);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px clamp(20px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.header-logo {
  height: 60px;
  width: auto;
  display: block;
}

/* Desktop Navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 15px;
  font-weight: 500;
}

.nav-link {
  color: var(--forest-800);
  text-decoration: none;
  padding: 8px 4px;
  position: relative;
  transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  color: var(--teal-500);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--teal-500);
  border-radius: 1px;
}

/* Desktop Dropdown (<details>) */
.nav-dropdown {
  position: relative;
}

.nav-dropdown summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--forest-800);
  padding: 8px 4px;
  transition: color var(--transition-fast);
}

.nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown summary:hover,
.nav-dropdown[open] summary,
.nav-dropdown.active summary {
  color: var(--teal-500);
}

.dropdown-icon {
  width: 12px;
  height: 12px;
  transition: transform var(--transition-fast);
}

.nav-dropdown[open] .dropdown-icon {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  background: var(--white);
  border: 1px solid var(--sage-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: grid;
  gap: 2px;
  z-index: 1010;
  animation: fadeInDown 150ms ease;
}

/* Invisible bridge between summary and dropdown menu to ensure smooth hover */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.dropdown-item {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  color: var(--forest-800);
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.dropdown-item:hover,
.dropdown-item.active {
  background-color: var(--linen-100);
  color: var(--teal-600);
}

.dropdown-view-all {
  border-top: 1px solid var(--sage-200);
  margin-top: 4px;
  padding-top: 8px;
  font-weight: 600;
  color: var(--terracotta-500);
}

.dropdown-view-all:hover {
  color: var(--terracotta-600);
}

/* Header CTA Button */
.header-cta-btn {
  display: inline-flex;
  align-items: center;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  background-color: var(--terracotta-500);
  color: var(--white);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(224, 122, 95, 0.22);
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
}

.header-cta-btn:hover {
  background-color: var(--terracotta-600);
  color: var(--white);
}

.header-cta-btn:active {
  transform: scale(0.97);
}

/* Mobile Hamburger Button */
.mobile-toggle-btn {
  display: none;
  background: none;
  border: 1px solid var(--sage-200);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--forest-800);
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast);
}

.mobile-toggle-btn:hover {
  background-color: var(--linen-100);
}

/* Mobile Navigation Drawer */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(18, 42, 36, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms ease, visibility 250ms ease;
}

.mobile-drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 360px);
  background-color: var(--white);
  z-index: 1050;
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.2, 0.7, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-drawer.is-open {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--sage-200);
}

.mobile-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: var(--linen-100);
  color: var(--forest-800);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast);
}

.mobile-drawer-close:hover {
  background-color: var(--teal-100);
}

.mobile-drawer-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

.mobile-nav-link {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--forest-800);
  text-decoration: none;
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--teal-500);
}

.mobile-submenu {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.mobile-sub-link {
  font-size: 14.5px;
  color: var(--muted-600);
  text-decoration: none;
  padding: 4px 0;
}

.mobile-sub-link:hover,
.mobile-sub-link.active {
  color: var(--teal-600);
}

.mobile-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--sage-200);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--linen-100);
}

/* Shared Footer */
.site-footer {
  background-color: var(--forest-800);
  color: var(--white);
  padding: clamp(64px, 8vw, 96px) 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: clamp(32px, 5vw, 48px);
  margin-bottom: clamp(48px, 6vw, 64px);
}

.footer-col-title {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 20px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-link {
  color: var(--sage-200);
  text-decoration: none;
  font-size: 14.5px;
  line-height: 1.5;
  transition: color var(--transition-fast), padding-left var(--transition-fast);
}

.footer-link:hover {
  color: var(--white);
  padding-left: 4px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 14px;
  color: var(--sage-200);
}

.footer-badges {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-badge-tile {
  background: var(--white);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
}

.footer-badge-tile img {
  height: 32px;
  width: auto;
  display: block;
}

/* Media Queries */
@media (max-width: 992px) {
  .header-nav {
    display: none;
  }
  .mobile-toggle-btn {
    display: flex;
  }
}

@media (max-width: 640px) {
  .top-bar-tagline {
    display: none;
  }
  .top-bar-inner {
    justify-content: center;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
