/* ==========================================================================
   Appliqart - Comprehensive Mobile-First Responsiveness
   Tested strictly for 320px, 360px, 375px, 390px, 412px, 430px, 768px, 1024px+
   Zero horizontal overflow tolerance.
   ========================================================================== */

/* Prevent horizontal scroll globally */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

/* ==========================================================================
   Sticky Mobile Call & Book Action Bar (Strictly Active Below 768px)
   ========================================================================== */
.sticky-mobile-cta {
  display: none; /* Hidden on desktop and tablet >=768px */
}

@media (max-width: 767px) {
  /* Prevent page content from being obscured behind sticky bar */
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .sticky-mobile-cta {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 999;
    background-color: #0a192f;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
    padding: 0.55rem 0.75rem;
    padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
    gap: 0.65rem;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .sticky-mobile-cta .btn-sticky-call {
    flex: 1;
    min-height: 48px;
    background-color: #15803d;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background-color 0.15s ease;
  }

  .sticky-mobile-cta .btn-sticky-call:hover,
  .sticky-mobile-cta .btn-sticky-call:active {
    background-color: #166534;
  }

  .sticky-mobile-cta .btn-sticky-book {
    flex: 1;
    min-height: 48px;
    background-color: #0284c7;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
  }

  .sticky-mobile-cta .btn-sticky-book:hover,
  .sticky-mobile-cta .btn-sticky-book:active {
    background-color: #0369a1;
  }
}

/* ==========================================================================
   Mobile Navigation Drawer (Below 1024px)
   ========================================================================== */
@media (max-width: 1023px) {
  .header-nav {
    display: none; /* Replaced by hamburger menu drawer */
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(10, 25, 47, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }

  .mobile-nav-overlay.is-active {
    opacity: 1;
    visibility: visible;
  }

  .mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background-color: var(--color-surface);
    z-index: 201;
    box-shadow: -6px 0 25px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 1.5rem;
    overflow-y: auto;
  }

  .mobile-nav-drawer.is-active {
    transform: translateX(0);
  }

  .mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
  }

  .mobile-nav-close {
    background: none;
    border: none;
    font-size: 1.85rem;
    line-height: 1;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.25rem;
  }

  .mobile-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  .mobile-nav-link {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-brand-primary);
    padding: 0.5rem 0;
    display: block;
    border-bottom: 1px solid var(--color-surface-muted);
  }

  .mobile-nav-link.active {
    color: var(--color-brand-accent);
  }

  .mobile-nav-sublist {
    padding-left: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0.5rem 0;
  }

  .mobile-nav-sublink {
    font-size: 0.9rem;
    color: var(--color-text-body);
    padding: 0.35rem 0;
    display: block;
  }

  .mobile-drawer-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   Tablet & Medium Viewports (768px - 1023px)
   ========================================================================== */
@media (max-width: 1023px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.25rem;
  }

  .hero-image-wrap {
    max-height: 380px;
  }

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

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

  .editorial-block {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3.5rem;
  }

  .editorial-image-wrap {
    max-height: 300px;
  }

  .process-grid-new {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .pricing-lucknow-card {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2.25rem;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
}

/* ==========================================================================
   Mobile Smartphones Viewport (Strictly 320px - 767px)
   This completely resolves the 3-column squished cards issue
   ========================================================================== */
@media (max-width: 767px) {
  .container {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  /* Header */
  .header-inner {
    height: 62px;
  }

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

  .header-actions {
    gap: 0.4rem;
  }

  .header-phone-btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
  }

  /* Hide Desktop Booking Button in Mobile Header to prevent crowding */
  .header-actions .btn-primary {
    display: none;
  }

  /* Hero Section */
  .hero-section {
    padding: 1.75rem 0 1.5rem;
  }

  .hero-title {
    font-size: 1.85rem;
    line-height: 1.22;
    letter-spacing: -0.02em;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .hero-pill-badge {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }

  .hero-actions-row {
    flex-direction: column;
    width: 100%;
    gap: 0.65rem;
    margin-top: 0.25rem;
  }

  .hero-actions-row .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 0.95rem;
  }

  .hero-disclosure-bar {
    padding: 0.65rem 0.85rem;
    font-size: 0.75rem;
    line-height: 1.45;
    margin-top: 0.35rem;
  }

  .hero-image-wrap {
    width: 100%;
    height: 240px;
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
  }

  .hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .hero-floating-badge {
    position: static;
    margin-top: 0.5rem;
    width: 100%;
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    background-color: var(--color-brand-primary);
  }

  /* Trust Ribbon */
  .trust-ribbon {
    padding: 1.25rem 0;
  }

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

  .trust-ribbon-item {
    gap: 0.75rem;
  }

  .trust-ribbon-title {
    font-size: 0.875rem;
  }

  .trust-ribbon-desc {
    font-size: 0.75rem;
  }

  /* ========================================================================
     APPLIANCE SERVICE CATEGORY CARDS (Crucial Single-Column Mobile Fix)
     Cards take 100% width, large photo on top, legible text, clear spacing!
     ======================================================================== */
  .services-grid-new {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .service-card-new {
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
  }

  .service-card-img-wrap {
    width: 100%;
    height: 190px !important;
  }

  .service-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .service-card-body {
    padding: 1.25rem !important;
  }

  .service-card-title {
    font-size: 1.25rem !important;
    margin-bottom: 0.35rem !important;
  }

  .service-card-desc {
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
    margin-bottom: 0.85rem !important;
  }

  .service-card-issues {
    gap: 0.45rem !important;
    margin-bottom: 1.15rem !important;
  }

  .service-card-issue-item {
    font-size: 0.8125rem !important;
    line-height: 1.4 !important;
  }

  .service-card-actions {
    display: flex !important;
    gap: 0.5rem !important;
    padding-top: 0.85rem !important;
  }

  .service-card-actions .btn {
    flex: 1;
    min-height: 42px;
    font-size: 0.8125rem;
    padding: 0.45rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ========================================================================
     EDITORIAL ALTERNATING APPLIANCE SHOWCASE (Stack Image Top, Text Below)
     ======================================================================== */
  .editorial-block {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.25rem !important;
    margin-bottom: 2.75rem !important;
  }

  .editorial-image-wrap {
    order: 1 !important;
    width: 100% !important;
    height: 220px !important;
    border-radius: var(--radius-md);
    overflow: hidden;
  }

  .editorial-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .editorial-content {
    order: 2 !important;
    width: 100% !important;
  }

  .editorial-content h3 {
    font-size: 1.35rem;
    line-height: 1.28;
    margin-bottom: 0.5rem;
  }

  .editorial-content p {
    font-size: 0.875rem;
    line-height: 1.55;
    margin-bottom: 0.75rem;
  }

  .editorial-content div {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem !important;
    margin-top: 0.75rem !important;
  }

  .editorial-content div .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  /* 4-Step Process */
  .process-grid-new {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .process-card-new {
    padding: 1.35rem 1.15rem;
  }

  .process-card-icon-wrap {
    width: 60px;
    height: 60px;
    margin-bottom: 0.85rem;
  }

  .process-card-title {
    font-size: 1.1rem;
  }

  /* Multi-Brand Coverage */
  .brand-showcase-box {
    padding: 1.5rem 1.15rem;
  }

  .brand-badges-grid {
    gap: 0.45rem;
    margin: 1rem 0 1.25rem;
  }

  .brand-badge-item {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
  }

  .brand-disclaimer-box {
    font-size: 0.75rem;
    line-height: 1.45;
    padding: 0.75rem 0.85rem;
  }

  /* Pricing / Lucknow Section */
  .pricing-lucknow-card {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem 1.15rem;
    border-radius: var(--radius-md);
  }

  .pricing-lucknow-card h2 {
    font-size: 1.5rem;
    line-height: 1.25;
  }

  .pricing-lucknow-text {
    font-size: 0.875rem;
    line-height: 1.55;
  }

  .pricing-lucknow-callout {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-sm);
  }

  .phone-display-large {
    font-size: 1.75rem;
  }

  /* Section Spacing */
  .section {
    padding: 2.75rem 0;
  }

  .section-title {
    font-size: 1.65rem;
    line-height: 1.25;
  }

  .section-desc {
    font-size: 0.875rem;
    line-height: 1.55;
  }

  /* Footer */
  .footer-top {
    padding: 2.75rem 0 2rem;
  }

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

  .footer-bottom-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* ========================================================================
     BOOKING DRAWER / BOTTOM SHEET (<768px)
     ======================================================================== */
  .booking-drawer-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .booking-drawer-container {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    transform: translateY(100%);
  }

  .booking-drawer-overlay.is-open .booking-drawer-container {
    transform: translateY(0);
  }

  .booking-drawer-header {
    padding: 1.15rem 1.15rem 0.75rem;
  }

  .drawer-title {
    font-size: 1.25rem;
  }

  .drawer-subtitle {
    font-size: 0.75rem;
  }

  .booking-drawer-body {
    padding: 1.15rem 1rem;
  }

  .booking-drawer-footer {
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .appliance-select-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .appliance-select-card {
    padding: 0.85rem 0.5rem;
    gap: 0.5rem;
  }

  .appliance-select-name {
    font-size: 0.75rem;
  }

  .brand-select-grid {
    gap: 0.4rem;
  }

  .brand-select-pill {
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
  }

  .form-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.85rem !important;
    margin-bottom: 0 !important;
    width: 100% !important;
  }

  .form-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.35rem !important;
    margin-bottom: 0.75rem !important;
    width: 100% !important;
  }

  .form-label {
    font-size: 0.8125rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    display: block !important;
    margin-bottom: 0.15rem !important;
  }

  .form-input,
  .form-select,
  .form-textarea {
    display: block !important;
    width: 100% !important;
    min-height: 48px !important;
    font-size: 0.9375rem !important;
    padding: 0.65rem 0.85rem !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-sm) !important;
  }
}

/* ==========================================================================
   Ultra-Compact Smartphones (320px - 359px)
   ========================================================================== */
@media (max-width: 359px) {
  .hero-title {
    font-size: 1.6rem;
  }

  .brand-logo-svg {
    height: 30px;
  }

  .header-phone-btn span {
    display: none; /* Phone icon only on ultra-compact 320px screens */
  }

  .sticky-mobile-cta .btn-sticky-call,
  .sticky-mobile-cta .btn-sticky-book {
    font-size: 0.8125rem;
    padding: 0.4rem 0.4rem;
  }
}

/* ==========================================================================
   Print & Accessibility Optimizations
   ========================================================================== */
@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;
  }
}
