/**
 * Quote Builder Mobile Responsive Styles
 * Shared CSS for all quote builder templates
 * © 2026 AppWT Web & AI Solutions (AppWT LLC)
 */

/* Mobile-First Base */
* { box-sizing: border-box; }

/* Progress Steps - Mobile Optimization */
@media (max-width: 768px) {
    .progress-steps {
        gap: 0.5rem;
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .progress-steps::-webkit-scrollbar {
        display: none;
    }
    .step {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
        min-width: max-content;
    }
    .step-number {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }
}

/* Navigation Banner - Mobile */
@media (max-width: 600px) {
    [style*="display: flex"][style*="justify-content: space-between"][style*="flex-wrap: wrap"] {
        padding: 10px 15px !important;
        gap: 8px !important;
    }
    [style*="display: flex"][style*="gap: 15px"] {
        gap: 10px !important;
    }
    [style*="padding: 8px 16px"] {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
}

/* Service Tabs - Scrollable on Mobile */
@media (max-width: 768px) {
    .service-tabs {
        display: flex;
        gap: 0.4rem;
        overflow-x: auto;
        padding: 0.5rem 0.5rem 1rem;
        margin: 0 -0.5rem 1rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        scroll-snap-type: x mandatory;
    }
    .service-tabs::-webkit-scrollbar {
        display: none;
    }
    .service-tab {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        scroll-snap-align: start;
        flex-shrink: 0;
    }
}

/* Quote Layout - Single Column on Mobile */
@media (max-width: 900px) {
    .quote-layout {
        grid-template-columns: 1fr !important;
        padding: 1rem !important;
        gap: 1.5rem !important;
    }
    .quote-summary {
        position: static !important;
        order: -1;
    }
}

/* Service Cards - Mobile Optimization */
@media (max-width: 600px) {
    .service-card {
        padding: 1rem;
    }
    .service-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .service-price {
        font-size: 1.1rem;
    }
    .service-name {
        font-size: 1rem;
    }
    .service-description {
        font-size: 0.85rem;
    }
    .service-features {
        gap: 0.35rem;
    }
    .service-feature {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
    .quantity-row {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .quantity-label {
        width: 100%;
    }
    .quantity-controls {
        flex: 1;
    }
    .add-to-quote-btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1rem;
    }
}

/* Quote Summary - Mobile */
@media (max-width: 600px) {
    .quote-summary {
        padding: 1rem;
    }
    .summary-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
    .summary-icon {
        width: 36px;
        height: 36px;
    }
    .summary-title {
        font-size: 1rem;
    }
    .summary-item {
        padding: 0.6rem 0;
    }
    .summary-item-name {
        font-size: 0.85rem;
    }
    .summary-item-detail {
        font-size: 0.75rem;
    }
    .summary-row.total {
        font-size: 1.1rem;
    }
    .get-quote-btn {
        padding: 0.875rem;
        font-size: 0.95rem;
    }
}

/* Header - Mobile */
@media (max-width: 600px) {
    .quote-header {
        padding: 1.5rem 1rem;
    }
    .quote-header h1 {
        font-size: 1.35rem !important;
        line-height: 1.3;
    }
    .quote-header p {
        font-size: 0.9rem;
    }
}

/* Touch-Friendly Elements */
@media (max-width: 768px) {
    .qty-btn {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    .qty-input {
        width: 50px;
        height: 40px;
        font-size: 1rem;
    }
    button, .btn, a[class*="btn"] {
        min-height: 44px;
    }
}

/* CTA Buttons - Stack on Mobile */
@media (max-width: 480px) {
    .cta-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .cta-buttons > * {
        width: 100%;
        justify-content: center;
    }
    .btn-primary, .btn-secondary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Gallery Cards Grid - Mobile */
@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    .card {
        padding: 20px !important;
    }
    .card-icon {
        font-size: 2rem !important;
    }
    .card-title {
        font-size: 1rem !important;
    }
    .card-description {
        font-size: 0.85rem !important;
    }
}

/* Hero Section - Mobile */
@media (max-width: 600px) {
    .hero {
        padding: 50px 16px 40px !important;
    }
    .hero h1 {
        font-size: 1.75rem !important;
    }
    .hero-subtitle, .hero p {
        font-size: 1rem !important;
    }
    .hero-badges {
        gap: 8px !important;
    }
    .hero-badge {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
}

/* Prevent Horizontal Scroll */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Safe Areas for Notched Devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    .quote-header, .cta-section, .footer {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}


/* 2026-09-13 Vaughn (Finance) — A SCROLL CONTAINER MUST ITSELF FIT THE SCREEN.
   Measured at 390px on quotebuilder.appwt.com: .service-tabs already had overflow-x:auto,
   but the container and its .services-section parent were being sized by their widest child
   (up to 603px on pest-control, 468px on pool-service, 401px on hvac). A scroll container
   wider than the viewport cannot contain anything — it just pushes the page sideways, and
   html{overflow-x:hidden} then HIDES the symptom instead of fixing it. Constraining the
   container is the actual fix; the tab strip then scrolls inside a box that fits. */
@media (max-width: 768px) {
  .services-section,
  .services-grid,
  .service-tabs,
  .quote-header,
  .container { max-width: 100%; min-width: 0; }
  .service-tabs { flex-wrap: nowrap; }
  .service-card { max-width: 100%; min-width: 0; }
  /* a wide table scrolls in its OWN container, per the build standard */
  .options-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* 2026-09-13 Vaughn (Finance) — GRID AND FLEX ITEMS DEFAULT TO min-width:auto, WHICH REFUSES
   TO SHRINK BELOW CONTENT WIDTH. Traced on hvac at 390px: .quote-layout was correctly 390 wide
   with 16px padding, but its unclassed grid child measured 385 instead of 358 and pushed to
   right=401. The child carries no class, so no class-based selector could reach it. Scoped to
   the children of the two layout containers rather than applied globally. */
@media (max-width: 768px) {
  .quote-layout > *,
  .services-section > * { min-width: 0; max-width: 100%; }
}
