/* ==========================================================================
   PAINFREE PHYSIOTHERAPY CLINIC - RESPONSIVE DESIGN SYSTEM
   Breakpoints: 320px, 360px, 375px, 390px, 414px, 480px, 768px, 1024px, 1440px, 1920px+
   ========================================================================== */

/* 1. Universal Overflow Protection */
html, body {
  max-width: 100vw;
  overflow-x: hidden !important;
}

/* 2. Safe Area Insets for Modern Mobile Devices */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-sticky-action-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    height: calc(68px + env(safe-area-inset-bottom));
  }
  
  @media (max-width: 767px) {
    body {
      padding-bottom: calc(74px + env(safe-area-inset-bottom));
    }
    
    .whatsapp-float-btn {
      bottom: calc(82px + env(safe-area-inset-bottom));
    }
  }
}

/* 3. Touch Targets (Minimum 44px x 44px) */
button, 
.btn, 
.nav-link, 
.drawer-link, 
.condition-tab-btn, 
.filter-btn, 
.cal-day-cell, 
.time-slot-chip, 
.action-btn, 
.mobile-action-btn {
  min-height: 44px;
  touch-action: manipulation;
}

/* 4. Ultra-Wide Screens (1920px and above) */
@media (min-width: 1920px) {
  .container {
    max-width: 1440px;
  }
  
  .hero-content {
    max-width: 720px;
  }
}

/* 5. Desktop to Large Screen Transitions (1280px - 1440px) */
@media (max-width: 1280px) {
  .desktop-nav {
    gap: 20px;
  }
}

/* 6. Tablet Landscape & Small Laptops (992px - 1199px) */
@media (max-width: 1199px) {
  .hero-grid {
    gap: 32px;
  }

  .hero-3d-stage {
    height: 480px;
  }

  .floating-info-card.card-rating {
    left: -10px;
    top: 8%;
  }

  .floating-info-card.card-reviews {
    left: -10px;
    bottom: 8%;
  }

  .floating-info-card.card-hours {
    right: -10px;
    top: 14%;
  }
}

/* 7. Tablet Portrait (768px - 991px) */
@media (max-width: 991px) {
  .site-header {
    height: auto;
  }

  .header-inner {
    height: 70px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 36px;
  }

  .hero-content {
    max-width: 100%;
    margin: 0 auto;
    order: 1;
  }

  .hero-3d-wrapper {
    order: 2;
    margin-top: 10px;
  }

  .hero-3d-stage {
    height: 440px;
    max-width: 480px;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-trust-badge {
    justify-content: center;
  }

  .condition-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .condition-media {
    height: 300px;
  }

  .doctor-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 36px;
  }

  .doctor-quote {
    padding-left: 0;
    border-left: none;
    padding-top: 12px;
    border-top: 2px solid var(--healthcare-green);
  }

  .doctor-focus-list {
    text-align: left;
    max-width: 500px;
    margin: 0 auto 32px;
  }

  .doctor-cta-row {
    display: flex;
    justify-content: center;
  }

  /* Admin Dashboard on Tablet */
  .admin-sidebar {
    width: 210px;
    padding: 20px 14px;
  }

  .admin-main {
    padding: 24px;
  }
}

/* 8. Large Mobile (481px - 767px) */
@media (max-width: 767px) {
  .header-inner {
    height: 64px;
  }

  .hero-section {
    padding: 28px 0 40px;
  }

  .hero-3d-stage {
    height: 380px;
    max-width: 100%;
  }

  .floating-info-card {
    padding: 8px 12px;
    border-radius: var(--radius-md);
  }

  .info-card-val {
    font-size: 1.1rem;
  }

  .info-card-val-green {
    font-size: 1.15rem;
  }

  .info-card-time {
    font-size: 0.8rem;
  }

  .floating-info-card.card-rating {
    top: 4%;
    left: 2%;
  }

  .floating-info-card.card-reviews {
    bottom: 4%;
    left: 2%;
  }

  .floating-info-card.card-hours {
    top: 6%;
    right: 2%;
  }

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

  .condition-media {
    height: 240px;
  }

  .condition-tab-list {
    flex-direction: column;
  }

  .condition-tab-btn {
    text-align: center;
    width: 100%;
  }

  .condition-highlights {
    grid-template-columns: 1fr;
  }

  /* Admin Dashboard Mobile View */
  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    padding: 16px 20px;
  }

  .admin-brand {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
  }

  .admin-nav-item {
    white-space: nowrap;
    padding: 8px 14px;
  }

  .admin-main {
    padding: 18px 14px;
  }

  .admin-table-container {
    display: none;
  }

  .admin-mobile-cards {
    display: flex;
  }

  .calendar-days-grid {
    gap: 4px;
  }

  .cal-day-cell {
    font-size: 0.88rem;
  }

  .booking-card-main {
    padding: 24px 18px;
  }
}

/* 9. Small Mobile (320px - 480px) */
@media (max-width: 480px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand-title {
    font-size: 1.05rem;
  }

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

  .hero-title {
    font-size: 2.15rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

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

  .hero-3d-stage {
    height: 330px;
  }

  .floating-info-card {
    padding: 6px 10px;
  }

  .info-card-val {
    font-size: 0.95rem;
  }

  .info-card-val-green {
    font-size: 1.05rem;
  }

  .info-card-lbl {
    font-size: 0.7rem;
  }

  .info-card-time {
    font-size: 0.72rem;
  }

  .trust-bar-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .trust-bar-item {
    padding: 6px 0;
  }

  .option-cards-grid {
    grid-template-columns: 1fr;
  }

  .time-slots-grid {
    grid-template-columns: 1fr 1fr;
  }

  .time-slot-chip {
    padding: 10px 6px;
    font-size: 0.88rem;
  }

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

  .gallery-item {
    height: 240px;
  }

  .booking-actions-row {
    flex-direction: column-reverse;
    gap: 12px;
  }

  .booking-actions-row .btn {
    width: 100%;
  }

  .footer-legal-links {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}

/* 10. Ultra-Small Devices (320px - 359px) */
@media (max-width: 359px) {
  .brand-text {
    max-width: 150px;
  }

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

  .brand-icon {
    width: 38px;
    height: 38px;
  }

  .hero-title {
    font-size: 1.95rem;
  }

  .time-slots-grid {
    grid-template-columns: 1fr;
  }
}

/* 11. Landscape Orientation on Mobile (Height <= 500px) */
@media (max-height: 500px) and (orientation: landscape) {
  .site-header {
    position: relative;
  }

  .mobile-drawer {
    width: 100%;
  }

  .hero-grid {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .hero-trust-badge {
    justify-content: flex-start;
  }

  .hero-3d-stage {
    height: 260px;
  }

  .mobile-sticky-action-bar {
    display: none;
  }

  body {
    padding-bottom: 0 !important;
  }
}

/* 12. Accessibility: Prefers Reduced Motion */
@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;
  }

  .floating-badge {
    animation: none;
  }
}
