/* ==========================================================================
   MOBILE-FIRST RESPONSIVE FIXES — HANUTHAI FIGHT STORE
   Compliant with iOS HIG & Android Material Design 3 (Fitts' Law / Touch targets)
   ========================================================================== */

/* Universal Box-Sizing & Overflow Safety */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Responsive Media & Images */
img, video, canvas, svg, iframe {
    max-width: 100% !important;
    height: auto;
}

/* Horizontal Scroll Containers for Data Tables */
.table-container, .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

table {
    max-width: 100%;
}

/* Mobile Touch Target Standards (Google Lighthouse & Material Design 3 - min 48x48px) */
@media (hover: none), (max-width: 768px) {
    button, 
    a.btn, 
    .tag-btn, 
    .filter-chip, 
    .search-chip-btn, 
    .color-swatch,
    .part-tab,
    .size-btn,
    input[type="button"], 
    input[type="submit"] {
        min-height: 48px;
        min-width: 48px;
        touch-action: manipulation;
    }

    /* Input Fields Touch & Virtual Keyboard Optimization */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents iOS auto-zoom on focus */
        min-height: 48px;
        scroll-margin-top: 80px;
        scroll-margin-bottom: 140px; /* Prevents virtual keyboard from hiding active input & CTA */
    }
}

/* Dynamic Viewport Height (dvh) & Ultra-Compact Mobile Auto-Fit (320px - 360px) */
@supports (height: 100dvh) {
    .simulator-layout, .app-layout {
        min-height: 100dvh;
    }
}

@media (max-width: 360px) {
    .container, .container-xl, .page {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}

/* Responsive Breakpoints & Flexbox Stacking */
@media (max-width: 992px) {
    .container, .container-xl, .page {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* Fixed width inline style overrides */
    [style*="width: 1"], [style*="width: 2"], [style*="width: 3"],
    [style*="width: 4"], [style*="width: 5"], [style*="width: 6"],
    [style*="width: 7"], [style*="width: 8"], [style*="width: 9"] {
        max-width: 100% !important;
    }

    /* Grid layout fallbacks */
    .grid-2, .grid-3, .grid-4, .spec-grid, .hub-cards-grid, .subpage-links-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

@media (max-width: 640px) {
    /* Main Headings Fluid Scaling */
    h1, .subpage-title, .hub-main-title, .hero-title {
        font-size: clamp(2rem, 7vw, 2.8rem) !important;
    }

    h2, .section-title {
        font-size: clamp(1.4rem, 5vw, 1.8rem) !important;
    }

    /* Horizontal scroll chip groups */
    .faq-tags, .hub-search-chips {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding-bottom: 8px !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .tag-btn, .search-chip-btn {
        flex-shrink: 0 !important;
        scroll-snap-align: start;
    }

    /* Hero Topbar & Navigation Adjustments */
    .hero-topbar {
        padding: 8px 12px !important;
    }

    .top-cart-btn .btn-text {
        display: none !important;
    }

    .top-cart-btn {
        padding: 6px 10px !important;
    }
}

/* ==========================================================================
   GLOBAL BUTTON & CONTAINER OVERFLOW SAFETY RULES
   Prevents cut-off or overflowing buttons across all display resolutions
   ========================================================================== */
button, .btn, a.btn, input[type="button"], input[type="submit"] {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.step-actions, .modal-footer, .header-actions, .action-buttons, .sub-header {
    flex-wrap: wrap !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.modal-content, .modal-box, .dossier-modal-container {
    max-width: min(95vw, 850px) !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
}

