/**
 * MH MEDICAL CENTRE - FULLY RESPONSIVE BREAKPOINTS & LAYOUT OPTIMIZATIONS
 * Supports: Mobile (320px - 480px), Tablets (481px - 768px), Laptops (769px - 1180px),
 * Desktop (1181px - 1440px), and Large Displays (1440px+)
 */

/* ==========================================================================
   1. LARGE MONITORS (>= 1440px)
   ========================================================================== */
@media (min-width: 1440px) {
  :root {
    --container-max-w: 1320px;
  }

  .hero-grid {
    gap: 4rem;
  }
}

/* ==========================================================================
   2. LAPTOPS & DESKTOPS (1025px - 1180px)
   ========================================================================== */
@media (max-width: 1180px) {
  /* Navigation Drawer */
  .nav-toggle-btn {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background-color: #ffffff;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem 1.25rem;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition-base), opacity var(--transition-base);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
  }

  .nav-menu.is-active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link {
    font-size: var(--font-size-lg);
    width: 100%;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .header-actions .btn-primary {
    display: none;
  }
}

/* ==========================================================================
   3. TABLET & LAPTOP SCREENS (<= 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .location-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .doctor-card {
    grid-template-columns: 1fr;
  }

  .doctor-photo-wrap {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 1.75rem;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .video-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .trust-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

/* ==========================================================================
   4. TABLET & MOBILE SCREENS (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --section-pad-y: 3.25rem;
  }

  /* Compact Header on Mobile */
  .brand-logo-wrap {
    width: 40px;
    height: 40px;
  }

  .brand-name {
    font-size: 0.95rem;
  }

  .brand-location {
    font-size: 0.68rem;
  }

  .header-actions .btn-outline {
    display: none;
  }

  /* Input fields 16px font to prevent mobile Safari/Chrome auto-zoom */
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px !important;
  }

  /* Form Responsive */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .appointment-form-card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-md);
  }

  /* Modal Form Mobile */
  .modal-overlay {
    padding: 0.5rem;
  }

  .modal-container {
    max-width: 100%;
    width: 100%;
    max-height: calc(100vh - 20px);
  }

  .modal-card {
    padding: 1rem 0.85rem;
    border-radius: var(--radius-md);
  }

  .modal-card .form-grid {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  /* Services & Gallery on Mobile */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .service-card {
    padding: 1.25rem;
  }

  .gallery-controls {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    flex-wrap: nowrap;
    margin-bottom: 1.25rem;
  }

  .gallery-controls::-webkit-scrollbar {
    display: none;
  }

  .gallery-tab {
    flex-shrink: 0;
    padding: 0.4rem 0.85rem;
    font-size: var(--font-size-xs);
    min-height: 38px;
    display: inline-flex;
    align-items: center;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .gallery-img-wrap {
    height: 220px;
  }

  /* Video Grid Responsive */
  .video-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .video-media-wrap video {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  /* Location Card Mobile */
  .map-facade-card {
    min-height: 280px;
  }

  .map-actions {
    flex-direction: column;
    gap: 0.65rem;
    align-items: stretch;
    text-align: center;
  }

  .map-actions .btn {
    width: 100%;
  }

  /* FAQ Touch Targets */
  .faq-question {
    padding: 1rem 0.85rem;
    font-size: 0.95rem;
    min-height: 48px;
  }

  /* Footer on Mobile */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-links a {
    display: inline-block;
    padding: 0.35rem 0;
    min-height: 38px;
    line-height: 38px;
  }

  /* Mobile Bottom Action Bar Active with iOS Safe Area */
  .mobile-bottom-bar {
    display: block;
    padding: 0.45rem 0.65rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  }

  /* Adjust Body Padding to avoid bottom bar overlap */
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  /* Adjust Floating WhatsApp above the bottom bar */
  .floating-whatsapp-btn {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    width: 48px;
    height: 48px;
  }

  .trust-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   5. SMALL MOBILE SCREENS (320px - 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .container {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .brand-logo-wrap {
    width: 36px;
    height: 36px;
  }

  .brand-name {
    font-size: 0.875rem;
  }

  .brand-location {
    display: none;
  }

  .hero-section {
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    gap: 0.65rem;
  }

  .hero-cta-group .btn {
    width: 100%;
  }

  .hero-quick-links {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  .hero-quick-link {
    width: 100%;
    justify-content: center;
  }

  .cta-banner {
    padding: 2rem 1rem;
    border-radius: var(--radius-md);
  }

  .cta-banner-buttons {
    flex-direction: column;
    width: 100%;
    gap: 0.65rem;
  }

  .cta-banner-buttons .btn {
    width: 100%;
  }

  .hero-image-badge {
    left: 8px;
    right: 8px;
    bottom: -15px;
    padding: 0.45rem 0.75rem;
  }

  .doctor-photo-wrap img {
    max-width: 200px;
    height: 220px;
  }

  .doctor-info-content {
    padding: 1.25rem 0.85rem;
  }

  .video-card-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .video-card-actions .btn {
    width: 100%;
  }
}

/* ==========================================================================
   6. REDUCED MOTION SUPPORT (WCAG 2.1 AAA)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
