/**
 * Modern Header System - CSS (Modern / Minimal Style)
 * Unified slide-out navigation for all screen sizes
 * Includes: Transparent homepage header, full-height hero, service boxes
 */

/* ========================================================================
   TOP CONTACT BAR
   ======================================================================== */

.top-contact-bar {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1060;
}

.top-contact-bar .social-icon {
  color: var(--primary-color);
  font-size: 1.1rem;
  transition: color 0.2s ease;
  text-decoration: none;
}

.top-contact-bar .social-icon:hover {
  color: var(--primary-color-dark);
}

.top-contact-bar .btn-outline-primary {
  font-size: 0.813rem;
  padding: 0.375rem 0.875rem;
  border-radius: 30px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.top-contact-bar .btn-outline-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(52, 119, 173, 0.2);
}

/* Mobile CTA buttons - 50% width each */
.mobile-cta-buttons {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  margin-left: 0;
}

/* On mobile, make the container fill the parent */
@media (max-width: 767.98px) {
  .top-bar-right {
    flex: 1;
    width: 100%;
  }

  .mobile-cta-buttons {
    width: 100%;
  }
}

.mobile-cta-btn {
  flex: 1;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
}


/* ========================================================================
   MAIN HEADER / NAVBAR
   ======================================================================== */

.main-header {
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 1050;
  transition: all 0.3s ease;
}

.main-header .navbar {
  padding: 0.75rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Logo styling */
.navbar-brand {
  padding: 0;
  padding-left: 1rem;
  margin: 0;
  transition: all 0.3s ease;
}

@media (min-width: 992px) {
  .navbar-brand {
    padding-left: 1.5rem;
  }
}

.header-logo {
  height: 60px;
  width: auto;
  transition: all 0.3s ease;
}

body.header-scrolled .header-logo {
  height: 40px;
}

/* Compact navbar padding when scrolled */
body.header-scrolled .main-header .navbar {
  padding: 0.35rem 0;
}

/* Smaller icon buttons when scrolled */
body.header-scrolled .header-icon-btn {
  padding: 0.4rem;
  font-size: 1.35rem;
}

body.header-scrolled .hamburger-btn {
  font-size: 1.5rem;
}

/* Smaller CTA buttons when scrolled */
body.header-scrolled .header-cta-buttons .btn {
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
}

/* Header right controls - search and hamburger */
.header-right-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-icon-btn {
  background: none;
  border: none;
  padding: 0.625rem;
  font-size: 1.5rem;
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-icon-btn:hover {
  background-color: rgba(52, 119, 173, 0.1);
  color: var(--primary-color-dark);
}

.header-icon-btn:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.hamburger-btn {
  font-size: 1.75rem;
}

/* Header CTA buttons - shown when scrolled on desktop */
.header-cta-buttons {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.header-cta-buttons .btn {
  font-size: 0.813rem;
  padding: 0.375rem 0.875rem;
  border-radius: 30px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.header-cta-buttons .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(52, 119, 173, 0.2);
}

/* Show CTA buttons when scrolled on large screens */
@media (min-width: 992px) {
  body.header-scrolled .header-cta-buttons {
    display: flex;
  }
}


/* ========================================================================
   UNIFIED SLIDE-OUT MENU (RIGHT SIDE)
   ======================================================================== */

.slide-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background-color: #ffffff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1070;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slide-menu.active {
  transform: translateX(0);
}

/* Slide menu header */
.slide-menu-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #ffffff;
  flex-shrink: 0;
}

.slide-menu-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: #333;
}

.slide-menu-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #333;
  padding: 0.5rem;
  cursor: pointer;
  transition: color 0.2s ease;
  border-radius: 0.25rem;
}

.slide-menu-close:hover {
  color: var(--primary-color);
  background-color: #f8f9fa;
}

/* Slide menu content - scrollable */
.slide-menu-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Navigation list */
.slide-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.slide-nav-item {
  border-bottom: 1px solid #f0f0f0;
}

.slide-nav-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  color: #333;
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
  cursor: pointer;
}

.slide-nav-link:hover,
.slide-nav-link:focus {
  background-color: #f8f9fa;
  color: var(--primary-color);
}

.slide-nav-toggle i {
  transition: transform 0.3s ease;
  font-size: 0.875rem;
}

.slide-nav-item.active .slide-nav-toggle i {
  transform: rotate(180deg);
}

/* Standard submenu (accordion) */
.slide-submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  background-color: #f8f9fa;
  transition: max-height 0.3s ease;
}

.slide-nav-item.active .slide-submenu {
  max-height: 500px;
}

.slide-submenu-link {
  display: block;
  padding: 0.75rem 1.25rem 0.75rem 2rem;
  color: #555;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.slide-submenu-link:hover,
.slide-submenu-link:focus {
  background-color: #ffffff;
  color: var(--primary-color);
  padding-left: 2.25rem;
}


/* ========================================================================
   MEGA MENU WITHIN SLIDE MENU (Procedures)
   ======================================================================== */

.slide-mega-menu {
  max-height: 0;
  overflow: hidden;
  background-color: #f8f9fa;
  transition: max-height 0.4s ease;
}

.slide-nav-item.active .slide-mega-menu {
  max-height: 2000px;
}

.mega-menu-grid {
  padding: 1rem;
}

.mega-menu-column {
  margin-bottom: 1.25rem;
}

.mega-menu-column:last-child {
  margin-bottom: 0;
}

.slide-mega-menu .mega-menu-header {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 2px solid var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mega-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mega-menu-list li {
  margin-bottom: 0.125rem;
}

.mega-menu-list a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #555;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.mega-menu-list a:hover,
.mega-menu-list a:focus {
  background-color: #ffffff;
  color: var(--primary-color);
  padding-left: 1rem;
}

/* Desktop: Show mega menu in 2-column grid layout */
@media (min-width: 768px) {
  .slide-menu {
    width: 500px;
  }

  .mega-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .mega-menu-column {
    margin-bottom: 0;
  }
}


/* ========================================================================
   SLIDE MENU FOOTER (CTA + Social)
   ======================================================================== */

.slide-nav-footer {
  padding: 1.5rem 1.25rem;
  border-top: 1px solid #e9ecef;
  background-color: #f8f9fa;
  flex-shrink: 0;
}

.slide-nav-cta {
  margin-bottom: 1rem;
}

.slide-nav-cta .btn {
  font-size: 0.9rem;
  border-radius: 30px;
  font-weight: 500;
}

.slide-nav-cta .btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.slide-nav-cta .btn-primary:hover {
  background-color: var(--primary-color-dark);
  border-color: var(--primary-color-dark);
}

.slide-nav-cta .btn-outline-primary {
  background-color: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.slide-nav-cta .btn-outline-primary:hover {
  background-color: var(--primary-color);
  color: white;
}

.slide-nav-social {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.social-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: white;
  color: var(--primary-color);
  font-size: 1.25rem;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.social-icon-btn:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}


/* ========================================================================
   SLIDE MENU OVERLAY
   ======================================================================== */

.slide-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1065;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.slide-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}


/* ========================================================================
   SEARCH OVERLAY
   ======================================================================== */

.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 1080;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.search-overlay-content {
  margin-top: 0;
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
}

.search-header {
  padding: 1.5rem 0;
  border-bottom: 1px solid #e9ecef;
  background-color: #ffffff;
}

.search-input-wrapper {
  position: relative;
}

.search-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 1.25rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  font-size: 1.25rem;
  border: 2px solid #e9ecef;
  border-radius: 0.5rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary-color);
}

.search-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #333;
  padding: 0.5rem 1rem;
  cursor: pointer;
  margin-left: 1rem;
}

.search-close:hover {
  color: var(--primary-color);
}

.search-results-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 0;
}


/* ========================================================================
   HOMEPAGE TRANSPARENT HEADER
   ======================================================================== */

/* Homepage: transparent header at top, normal when scrolled */
/* Uses header-not-at-top for INSTANT switching (no debounce) */
body.homepage:not(.header-not-at-top) .main-header {
  background-color: transparent;
  box-shadow: none;
}

/* On homepage at top: invert logo to white */
/* Uses header-not-at-top for INSTANT switching (no debounce) */
body.homepage:not(.header-not-at-top) .header-logo {
  filter: brightness(0) invert(1);
}

/* Larger logo on homepage transparent header */
body.homepage:not(.header-scrolled) .header-logo {
  height: 80px;
}

/* White icons at top of homepage - INSTANT switching */
body.homepage:not(.header-not-at-top) .header-icon-btn {
  color: white;
}

body.homepage:not(.header-not-at-top) .header-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}


/* ========================================================================
   HOMEPAGE HERO - TRANSPARENT HEADER ADJUSTMENTS
   Hero extends behind the transparent navigation header
   ======================================================================== */

/* Top bar height - used to calculate hero height so it fits exactly in viewport */
:root {
  --top-bar-height: 48px;
}

/* On homepage, pull the hero up to meet the gray top bar */
body.homepage #homepage-cover {
  margin-top: -105px;
  padding-top: 105px;
  min-height: calc(100vh + 2px);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Make the hero content area fill the remaining space */
body.homepage #homepage-cover .bg-cover {
  padding-top: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Center hero content vertically within the available space */
body.homepage #homepage-cover .bg-cover > .container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}


/* ========================================================================
   HERO SERVICE BOXES
   Full-width colored boxes at the bottom of the hero section
   ======================================================================== */

:root {
  --hero-box-height: 120px;
  /* Service box colors - override these in client.css for custom colors */
  --hero-box-1: color-mix(in srgb, var(--primary-color-dark) 80%, black 20%);
  --hero-box-2: var(--primary-color);
  --hero-box-3: var(--primary-color-dark);
  --hero-box-4: var(--primary-color-light, var(--primary-color));
}

.hero-service-boxes {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  position: relative;
  z-index: 20;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.2);
}

.hero-service-box {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--hero-box-height);
  padding: 0.75rem 1rem;
  text-align: center;
}

.hero-service-box a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.3;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hero-service-box a i {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.hero-service-box a:hover {
  opacity: 0.85;
  transform: scale(1.03);
}

/* Box colors */
.hero-service-box--1 { background-color: var(--hero-box-1); }
.hero-service-box--2 { background-color: var(--hero-box-2); }
.hero-service-box--3 { background-color: var(--hero-box-3); }
.hero-service-box--4 { background-color: var(--hero-box-4); }

/* Mobile: 2x2 grid */
@media (max-width: 767px) {
  .hero-service-boxes {
    flex-wrap: wrap;
  }
  .hero-service-box {
    flex: 0 0 50%;
    height: auto;
    min-height: 100px;
    padding: 1rem 0.5rem;
  }
  .hero-service-box a {
    flex-direction: column;
    text-align: center;
    font-size: 0.95rem;
    gap: 0.5rem;
  }
  .hero-service-box a i {
    font-size: 2rem;
  }
}


/* ========================================================================
   HERO TYPOGRAPHY - RESPONSIVE
   Step down heading sizes on smaller screens
   ======================================================================== */

body.homepage #homepage-cover h1 {
  font-size: 2.75rem;
  line-height: 1.2;
}

body.homepage #homepage-cover .lead {
  font-size: 1.1rem;
}

@media (max-width: 991px) {
  body.homepage #homepage-cover h1 {
    font-size: 2.25rem;
  }
  body.homepage #homepage-cover .lead {
    font-size: 1rem;
  }
}

@media (max-width: 767px) {
  body.homepage #homepage-cover h1 {
    font-size: 1.75rem;
  }
  body.homepage #homepage-cover .lead {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  body.homepage #homepage-cover h1 {
    font-size: 1.5rem;
  }
  body.homepage #homepage-cover .lead {
    font-size: 0.9rem;
  }
}


/* ========================================================================
   HERO VIDEO GRADIENT OVERLAY
   Animated shifting gradient using brand colors
   Override --hero-gradient-* vars in client.css for custom gradient
   ======================================================================== */

:root {
  --hero-gradient-1: rgba(15, 55, 65, 0.8);
  --hero-gradient-2: rgba(20, 75, 90, 0.78);
  --hero-gradient-3: rgba(25, 95, 110, 0.75);
  --hero-gradient-4: rgba(20, 75, 90, 0.78);
  --hero-gradient-5: rgba(18, 70, 82, 0.8);
  --hero-gradient-6: rgba(30, 85, 100, 0.77);
  --hero-gradient-7: rgba(40, 110, 125, 0.73);
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.background-video-container-overlay {
  background: linear-gradient(
    -45deg,
    var(--hero-gradient-1),
    var(--hero-gradient-2),
    var(--hero-gradient-3),
    var(--hero-gradient-4),
    var(--hero-gradient-5),
    var(--hero-gradient-6),
    var(--hero-gradient-7),
    var(--hero-gradient-6),
    var(--hero-gradient-1)
  );
  background-size: 800% 800%;
  animation: gradientShift 20s ease infinite;
  background-color: transparent !important;
}


/* ========================================================================
   HERO SCROLL INDICATOR
   ======================================================================== */

@keyframes scrollBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(8px);
  }
  60% {
    transform: translateY(4px);
  }
}

.hero-scroll-indicator {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.5rem;
  animation: scrollBounce 2s ease infinite;
  cursor: pointer;
  transition: color 0.2s ease;
}

.hero-scroll-indicator:hover {
  color: white;
}

@media (max-width: 768px) {
  .hero-scroll-indicator {
    bottom: 220px;
    font-size: 1.25rem;
  }
}


/* ========================================================================
   HERO SEARCH BOX (inside hero)
   ======================================================================== */

.hero-search-wrapper {
  position: relative;
  max-width: 500px;
  margin: 1.5rem auto 0;
}

.hero-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 1.1rem;
  z-index: 2;
}

.hero-search-input {
  padding-left: 2.75rem;
  border-radius: 30px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.95);
  font-size: 1rem;
}

.hero-search-input:focus {
  border-color: var(--primary-color);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


/* ========================================================================
   RESPONSIVE ADJUSTMENTS
   ======================================================================== */

/* Mobile specific adjustments */
@media (max-width: 575.98px) {
  .slide-menu {
    width: 100%;
    max-width: 100%;
  }

  .header-logo {
    height: 50px;
  }

  body.header-scrolled .header-logo {
    height: 40px;
  }

  .mega-menu-grid {
    padding: 0.75rem;
  }

  .mega-menu-list a {
    padding: 0.625rem 0.75rem;
  }
}


/* ========================================================================
   ACCESSIBILITY ENHANCEMENTS
   ======================================================================== */

/* Focus styles for keyboard navigation */
.slide-nav-link:focus,
.slide-submenu-link:focus,
.mega-menu-list a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  z-index: 10000;
  transition: top 0.3s ease;
}

.skip-to-main:focus {
  top: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .main-header,
  .header-logo,
  .slide-menu,
  .slide-menu-overlay,
  .slide-submenu,
  .slide-mega-menu,
  .hero-scroll-indicator,
  .background-video-container-overlay {
    transition: none;
    animation: none;
  }
}


/* ========================================================================
   PRINT STYLES
   ======================================================================== */

@media print {
  .top-contact-bar,
  .main-header,
  .slide-menu,
  .slide-menu-overlay {
    display: none;
  }
}


/* ========================================================================
   HIGH CONTRAST MODE SUPPORT
   ======================================================================== */

@media (prefers-contrast: high) {
  .main-header {
    border-bottom: 2px solid #000;
  }

  .slide-nav-link,
  .slide-submenu-link {
    font-weight: 600;
  }
}


/* ========================================================================
   SMOOTH SCROLL
   ======================================================================== */

html {
  scroll-behavior: smooth;
}
