/*
  ASNHP — MOBILE RESPONSIVE OVERRIDE
  Goal: Show ALL components exactly as they appear on desktop, but scaled/fitted for mobile.
  No content is hidden; layout is preserved with horizontal scroll or scaling where needed.
*/

/* ============================== GLOBAL MOBILE BASE ============================== */
@media (max-width: 991px) {

  /* Force full viewport and allow horizontal scroll if needed */
  html, body {
    overflow-x: auto;
    -webkit-text-size-adjust: 100%;
  }

  /* ============================== TOPBAR — show all items ============================== */
  .topbar-right {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
  }
  .topbar .container {
    flex-direction: column !important;
    gap: 6px !important;
    text-align: center !important;
    align-items: center !important;
  }
  .topbar-left, .topbar-right {
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .topbar a {
    font-size: 0.72rem;
    padding: 3px 6px;
    white-space: nowrap;
  }

  /* ============================== HEADER — show desktop nav on mobile too ============================== */
  .hamburger-btn {
    display: none !important;
  }
  nav#desktop-nav {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 2px !important;
  }
  nav#desktop-nav a {
    font-size: 0.75rem !important;
    padding: 6px 9px !important;
  }
  .btn-portal {
    font-size: 0.75rem !important;
    padding: 7px 12px !important;
  }
  .btn-contents {
    font-size: 0.72rem !important;
    padding: 5px 10px !important;
  }
  .header-inner {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 8px 0 !important;
  }
  .logo-text h1 {
    font-size: 0.82rem !important;
  }
  .logo-text span {
    font-size: 0.60rem !important;
  }
  .logo-img {
    height: 40px !important;
  }

  /* ============================== HERO ============================== */
  .hero {
    min-height: 100svh;
  }
  .hero-content {
    padding: 120px 16px 70px !important;
  }
  .hero-title {
    font-size: clamp(1.6rem, 5.5vw, 3rem) !important;
  }
  .hero-subtitle {
    font-size: 0.95rem !important;
  }
  .hero-buttons {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 10px !important;
  }
  .hero-buttons a {
    font-size: 0.88rem !important;
    padding: 12px 20px !important;
  }

  /* Quick link grid — keep 4-column layout, shrink items */
  .quick-link-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    max-width: 100% !important;
    gap: 8px !important;
    margin-top: 36px !important;
  }
  .quick-link {
    padding: 12px 6px !important;
    font-size: 0.72rem !important;
    gap: 6px !important;
  }
  .quick-link i {
    font-size: 1.2rem !important;
  }

  /* Decorative circles — keep them but smaller */
  .hero-deco-circle {
    width: 280px !important;
    height: 280px !important;
    top: -80px !important;
    right: -80px !important;
    display: block !important;
  }
  .hero-deco-circle-2 {
    width: 180px !important;
    height: 180px !important;
    display: block !important;
  }

  /* ============================== STATS — keep 4-column desktop grid ============================== */
  .stats .container {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
  }
  .stat-item + .stat-item {
    border-left: 1px solid rgba(255,255,255,0.1) !important;
  }
  .stat-item:nth-child(odd) + .stat-item {
    border-left: 1px solid rgba(255,255,255,0.1) !important;
  }
  .stat-number {
    font-size: clamp(1.5rem, 3.5vw, 2.8rem) !important;
  }
  .stat-label {
    font-size: 0.68rem !important;
  }

  /* ============================== PROGRAMS ============================== */
  .program-tabs {
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: center !important;
  }
  .program-tab-btn {
    font-size: 0.82rem !important;
    padding: 9px 16px !important;
  }
  .program-panel.active {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 16px !important;
  }

  /* ============================== CLINICAL GALLERY — keep desktop grid ============================== */
  .clinical-gallery {
    grid-template-columns: 2fr 1fr 1fr !important;
    grid-template-rows: 200px 200px !important;
    gap: 10px !important;
  }
  .gallery-large {
    grid-row: 1 / 3 !important;
    grid-column: auto !important;
    height: auto !important;
  }
  .gallery-item {
    height: auto !important;
  }

  /* ============================== FOOTER — keep full grid ============================== */
  .footer-grid {
    grid-template-columns: 1.4fr repeat(4, 1fr) !important;
    gap: 20px !important;
  }
  .footer-brand {
    grid-column: auto !important;
  }
  .footer-col h4 {
    font-size: 0.78rem !important;
    margin-bottom: 12px !important;
  }
  .footer-col a {
    font-size: 0.75rem !important;
  }
  .footer-col li {
    margin-bottom: 7px !important;
  }

  /* ============================== CONTACT GRID ============================== */
  .contact-grid {
    grid-template-columns: 1fr 1.3fr !important;
    gap: 30px !important;
  }

  /* ============================== CAMPUS GRID ============================== */
  .campus-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  }

  /* ============================== MODAL ============================== */
  .modal-content {
    max-width: 95% !important;
    padding: 20px 16px !important;
  }
  .app-form-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* ============================== SCROLL NAV — hide on mobile ============================== */
  #scroll-nav-indicator {
    display: none !important;
  }

  /* ============================== ANNOUNCEMENT BAR ============================== */
  .announce {
    font-size: 0.78rem !important;
    padding: 8px 12px !important;
  }

  /* ============================== SECTION TITLES ============================== */
  .section-title {
    font-size: clamp(1.5rem, 4vw, 2.4rem) !important;
  }
  .section-header {
    margin-bottom: 30px !important;
  }
}

/* ============================== SMALL PHONES (≤ 600px) ============================== */
@media (max-width: 600px) {

  /* Scale down header nav onto two tight rows */
  nav#desktop-nav {
    gap: 2px !important;
  }
  nav#desktop-nav a {
    font-size: 0.68rem !important;
    padding: 5px 7px !important;
  }
  .btn-portal {
    font-size: 0.68rem !important;
    padding: 6px 10px !important;
  }
  .btn-contents {
    font-size: 0.65rem !important;
    padding: 4px 8px !important;
  }

  /* Stats — 2 columns but maintain separation appearance */
  .stats .container {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  .stat-item:nth-child(2) {
    border-left: 1px solid rgba(255,255,255,0.1) !important;
  }
  .stat-item:nth-child(3) {
    border-left: none !important;
    border-top: 1px solid rgba(255,255,255,0.1) !important;
    padding-top: 12px !important;
  }
  .stat-item:nth-child(4) {
    border-left: 1px solid rgba(255,255,255,0.1) !important;
    border-top: 1px solid rgba(255,255,255,0.1) !important;
    padding-top: 12px !important;
  }

  /* Quick links — 2×2 grid */
  .quick-link-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .quick-link {
    padding: 14px 10px !important;
    font-size: 0.78rem !important;
  }
  .quick-link i {
    font-size: 1.4rem !important;
  }

  /* Hero buttons stacked */
  .hero-buttons {
    flex-direction: column !important;
    align-items: center !important;
  }
  .hero-buttons a {
    width: 100% !important;
    max-width: 300px !important;
    justify-content: center !important;
  }

  /* Clinical gallery — 2 col on small screens */
  .clinical-gallery {
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: 180px auto auto !important;
  }
  .gallery-large {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    height: 220px !important;
  }
  .gallery-item {
    height: 160px !important;
  }

  /* Footer — 2 columns */
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 22px !important;
  }
  .footer-brand {
    grid-column: 1 / -1 !important;
  }
  .footer-col h4 {
    font-size: 0.75rem !important;
  }

  /* Contact grid — stack on small phones */
  .contact-grid {
    grid-template-columns: 1fr !important;
  }

  /* Programs panel */
  .program-panel.active {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
  .program-card h3 {
    font-size: 0.9rem !important;
  }
  .program-card p {
    font-size: 0.78rem !important;
  }

  /* App form — single col on tiny screens */
  .app-form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Topbar */
  .topbar-right {
    display: flex !important;
  }
  .topbar a {
    font-size: 0.67rem !important;
  }
}

/* ============================== EXTRA SMALL (≤ 380px) ============================== */
@media (max-width: 380px) {
  nav#desktop-nav a {
    font-size: 0.62rem !important;
    padding: 4px 5px !important;
  }
  .logo-text h1 {
    font-size: 0.72rem !important;
  }
  .logo-img {
    height: 34px !important;
  }
  .container {
    padding: 0 10px !important;
  }
  .program-panel.active {
    grid-template-columns: 1fr !important;
  }
  .footer-grid {
    grid-template-columns: 1fr !important;
  }
  .footer-brand {
    grid-column: 1 / -1 !important;
  }
  .hero-title {
    font-size: 1.5rem !important;
  }
  .stats .container {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ============================== PREVENT HORIZONTAL OVERFLOW ============================== */
/* Make sure nothing breaks the layout silently */
.footer-grid, .stats .container, .quick-link-grid,
.program-panel.active, .clinical-gallery, .contact-grid,
.campus-grid, .sitemap-grid {
  width: 100%;
  box-sizing: border-box;
}

/* ============================== ENSURE SIDEBAR STILL ACCESSIBLE ============================== */
/* Even though hamburger is hidden, sidebar can still be triggered by JS if needed */
#nav-sidebar {
  display: flex !important;
}
