/* ========================================
   HEADER STYLES
   Top Info Bar + Main Navigation
   Clean Desktop & Optimized Mobile Architecture
   ======================================== */

/* ===== Top Info Bar ===== */
.top-bar {
  background: #0d382d; /* Rich forest green */
  color: #ffffff;
  padding: 7px 0;
  font-size: 0.76rem;
  position: relative;
  z-index: 1001;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-bar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.top-bar-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  font-size: 0.76rem;
}

.top-bar-svg {
  color: #fbbf24; /* Warm golden accent */
  flex-shrink: 0;
}

.top-bar-divider {
  display: inline-block;
  width: 1px;
  height: 13px;
  background: rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
  vertical-align: middle;
}

.top-bar-phone-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
  transition: color 0.15s ease;
}

.top-bar-phone-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.top-bar-ticker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  max-width: 360px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 1;
}

.top-bar-ticker-inner {
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}

.ticker-content {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f8fafc;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.ticker-badge {
  background: #22c55e;
  color: #052e16;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-right: 6px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: livePulse 1.8s infinite;
  flex-shrink: 0;
}

@keyframes livePulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.live-viewers-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  flex-shrink: 0;
}

.live-viewers-count {
  font-weight: 700;
  color: #86efac;
}

.top-bar-social {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.top-bar-social a {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: all 0.15s ease;
  text-decoration: none;
}

.top-bar-social a:hover {
  background: #ffffff;
  color: #0d382d;
  transform: translateY(-1px);
}

/* ===== Main Header (Navbar) ===== */
.main-header {
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05);
  transition: padding 0.2s ease, box-shadow 0.2s ease;
  padding: 10px 0;
}

.main-header.scrolled {
  padding: 7px 0;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ===== Logo ===== */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none;
}

.header-logo-img {
  height: 52px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  display: block;
  transition: height 0.2s ease;
}

.main-header.scrolled .header-logo-img {
  height: 46px;
}

.logo-text {
  line-height: 1.15;
}

.logo-name {
  font-family: var(--font-heading, 'Poppins', sans-serif);
  font-size: 1.38rem;
  font-weight: 800;
  color: var(--green-primary, #15803d);
  letter-spacing: -0.4px;
  margin: 0;
}

.logo-tagline {
  font-size: 0.66rem;
  color: #64748b;
  font-weight: 500;
  margin: 2px 0 0 0;
  letter-spacing: 0.2px;
}

/* ===== Desktop Navigation (Only inside .main-nav on Desktop) ===== */
.main-nav {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #334155;
  transition: all 0.15s ease;
  white-space: nowrap;
  position: relative;
  text-decoration: none;
  border-radius: 6px;
}

.nav-link:hover {
  color: var(--green-primary, #15803d);
  background: #f0fdf4;
}

.nav-link.active {
  color: var(--green-primary, #15803d);
  font-weight: 600;
}

.active-indicator {
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 2.5px;
  background: var(--green-primary, #15803d);
  border-radius: 999px;
}

.dropdown-chevron {
  transition: transform 0.2s ease;
  opacity: 0.6;
}

.nav-item:hover .dropdown-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

/* ===== Dropdown Menus (Desktop) ===== */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  border: 1px solid #e2e8f0;
  border-top: 3px solid var(--green-primary, #15803d);
}

.nav-item:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-size: 0.85rem;
  color: #334155;
  text-decoration: none;
  transition: all 0.15s ease;
  font-weight: 500;
}

.dropdown-item:hover {
  background: #f0fdf4;
  color: var(--green-primary, #15803d);
  padding-left: 22px;
}

.dropdown-facilities {
  min-width: 270px;
}

.dropdown-facilities .dropdown-item {
  padding: 8px 18px;
  font-size: 0.86rem;
  white-space: nowrap;
}

/* ===== Header Actions (Desktop) ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.search-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.search-btn:hover {
  background: #f0fdf4;
  color: var(--green-primary, #15803d);
  border-color: #86efac;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.enquiry-btn {
  padding: 10px 22px;
  background: var(--green-primary, #15803d);
  color: #ffffff;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(21, 128, 61, 0.25);
}

.enquiry-btn:hover {
  background: #0f612d;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(21, 128, 61, 0.35);
}

/* ===== Desktop Defaults for Mobile Elements (Hidden on PC) ===== */
.mobile-drawer,
.mobile-toggle,
.mobile-overlay {
  display: none !important;
}

/* ===== Interactive Quick Search Modal ===== */
.search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}

.search-modal.active {
  display: flex;
}

.search-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.search-modal-box {
  position: relative;
  width: min(580px, 92vw);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  z-index: 2001;
  animation: modalSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.search-modal-icon {
  color: #94a3b8;
  flex-shrink: 0;
}

.search-modal-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: #0f172a;
  background: transparent;
  font-family: inherit;
}

.search-modal-close {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.search-modal-body {
  padding: 18px 20px;
  max-height: 400px;
  overflow-y: auto;
}

.search-section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
  margin-bottom: 12px;
}

.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #334155;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s ease;
}

.search-tag:hover {
  background: #f0fdf4;
  color: #15803d;
  border-color: #86efac;
  transform: translateY(-1px);
}

.search-tag-highlight {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
  font-weight: 600;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f8fafc;
  text-decoration: none;
  transition: all 0.15s ease;
}

.search-result-item:hover {
  background: #f0fdf4;
}

.search-result-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
}

.search-result-category {
  font-size: 0.72rem;
  color: #64748b;
  margin-left: 8px;
  font-weight: 400;
}

.search-result-arrow {
  color: #15803d;
}

/* ===== Medium Desktop (993px - 1240px) ===== */
@media (max-width: 1240px) {
  .nav-link {
    padding: 7px 9px;
    font-size: 0.83rem;
  }

  .top-bar-hours,
  .top-bar-left .top-bar-divider:nth-of-type(2) {
    display: none; /* Keeps top bar clean on medium laptops */
  }

  .top-bar-ticker-wrap {
    max-width: 270px;
  }

  .logo-name {
    font-size: 1.22rem;
  }
}

/* ===== Tablet & Mobile View (<= 992px) ===== */
@media (max-width: 992px) {
  :root {
    --header-height: 64px;
  }

  /* Compact Single-Row Mobile Top Bar */
  .top-bar-left,
  .top-bar-social,
  .top-bar-divider {
    display: none !important;
  }

  .top-bar {
    padding: 6px 0;
  }

  .top-bar-container {
    width: 100%;
    padding: 0 12px;
  }

  .top-bar-right {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
    flex-shrink: 0;
  }

  .top-bar-ticker-wrap {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 3px 10px;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.12);
  }

  .live-viewers-badge {
    flex-shrink: 0;
    font-size: 0.72rem;
    gap: 5px;
  }

  /* Mobile Header Layout */
  .main-header {
    padding: 6px 0;
  }

  .header-container {
    height: var(--header-height);
  }

  .logo-tagline-desktop {
    display: none !important;
  }

  .header-logo-img {
    height: 44px;
    width: auto;
  }

  .logo-name {
    font-size: 1.15rem;
  }

  /* Hide Desktop Navigation and CTA button */
  .main-nav,
  .header-actions .enquiry-btn {
    display: none !important;
  }

  /* Show Mobile Hamburger Toggle */
  .mobile-toggle {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 42px;
    height: 42px;
    padding: 11px 9px;
    border-radius: 8px;
    background: #f1f5f9;
    cursor: pointer;
    border: none;
    z-index: 1002;
    touch-action: manipulation;
  }

  .mobile-toggle span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: var(--green-primary, #15803d);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  .mobile-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .mobile-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ===== Dedicated Off-Canvas Mobile Drawer ===== */
  .mobile-drawer {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    bottom: 0 !important;
    left: auto !important;
    width: min(320px, 86vw) !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: #ffffff !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22) !important;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 10050 !important;
    overflow: hidden !important;
  }

  .mobile-drawer.active {
    right: 0 !important;
  }

  /* Drawer Top Brand Bar */
  .mobile-drawer-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 18px !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    flex-shrink: 0 !important;
    min-height: 64px !important;
    box-sizing: border-box !important;
  }

  .drawer-brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
  }

  .drawer-logo-img {
    height: 38px !important;
    width: 38px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
  }

  .drawer-brand-text {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
  }

  .drawer-school-name {
    font-size: 0.96rem !important;
    font-weight: 700 !important;
    color: var(--green-primary, #15803d) !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
  }

  .drawer-school-tag {
    font-size: 0.66rem !important;
    color: #64748b !important;
    white-space: nowrap !important;
    margin-top: 2px !important;
  }

  .mobile-drawer-close {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    border: none !important;
    background: #e2e8f0 !important;
    color: #334155 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: background 0.15s !important;
    touch-action: manipulation !important;
  }

  .mobile-drawer-close:hover,
  .mobile-drawer-close:active {
    background: #cbd5e1 !important;
    color: #0f172a !important;
  }

  /* Drawer Backdrop Overlay */
  .mobile-overlay {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 10040 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
  }

  .mobile-overlay.active {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Drawer Nav List */
  .mobile-nav-list {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    padding: 8px 16px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    list-style: none !important;
    margin: 0 !important;
  }

  .mobile-nav-item {
    width: 100% !important;
    border-bottom: 1px solid #f1f5f9 !important;
  }

  .mobile-nav-link-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
  }

  .mobile-nav-link {
    display: block !important;
    padding: 13px 0 !important;
    font-size: 0.92rem !important;
    font-weight: 600 !important;
    color: var(--gray-800, #1e293b) !important;
    text-decoration: none !important;
    flex: 1 !important;
    touch-action: manipulation !important;
  }

  .mobile-dropdown-btn {
    width: 40px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    color: #64748b !important;
    touch-action: manipulation !important;
  }

  .mobile-chevron {
    transition: transform 0.25s ease !important;
  }

  .mobile-nav-item.open .mobile-chevron {
    transform: rotate(180deg) !important;
  }

  .mobile-dropdown-menu {
    position: static !important;
    display: none !important;
    flex-direction: column !important;
    padding: 6px 12px 10px 14px !important;
    border-radius: 8px !important;
    background: #f0fdf4 !important;
    margin-bottom: 8px !important;
  }

  .mobile-nav-item.open .mobile-dropdown-menu {
    display: flex !important;
  }

  .mobile-dropdown-item {
    padding: 8px 0 !important;
    font-size: 0.85rem !important;
    color: #15803d !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    border-bottom: 1px solid rgba(21, 128, 61, 0.1) !important;
  }

  .mobile-dropdown-item:last-child {
    border-bottom: none !important;
  }

  /* Drawer Bottom Actions */
  .mobile-drawer-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    flex-shrink: 0 !important;
  }

  .enquiry-btn-mobile {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    text-align: center !important;
    padding: 12px !important;
    background: var(--green-primary, #15803d) !important;
    color: #ffffff !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    font-size: 0.88rem !important;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.25) !important;
    touch-action: manipulation !important;
  }

  .call-btn-mobile {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    text-align: center !important;
    padding: 10px !important;
    background: #ffffff !important;
    color: var(--green-primary, #15803d) !important;
    border: 1.5px solid var(--green-primary, #15803d) !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    font-size: 0.86rem !important;
    text-decoration: none !important;
    touch-action: manipulation !important;
  }
}

/* ===== Small Mobile (<= 480px) ===== */
@media (max-width: 480px) {
  :root {
    --header-height: 60px;
  }

  .top-bar {
    padding: 4px 0;
  }

  .top-bar-ticker-wrap {
    font-size: 0.67rem;
    padding: 2px 8px;
    gap: 5px;
  }

  .live-viewers-badge {
    font-size: 0.67rem;
    gap: 4px;
  }

  .viewers-online-text {
    display: none; /* Shows pulse dot + count on very narrow screens */
  }

  .logo-name {
    font-size: 1.05rem;
  }

  .header-logo-img {
    height: 38px;
  }

  .search-modal {
    padding-top: 60px;
  }

  .search-modal-box {
    border-radius: 12px;
  }
}
