/* ============================================================
   PNEUSTORE — MOBILE.CSS
   Mobile-First Optimization Layer
   Aplicado em todas as páginas via <link rel="stylesheet" href="mobile.css">
   ============================================================ */

/* ── BASE MOBILE RESETS ──────────────────────────────────────────────────────── */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
* { -webkit-tap-highlight-color: transparent; }

/* ── BOTTOM NAVIGATION BAR (mobile only) ────────────────────────────────────── */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e8eaf0;
    z-index: 998;
    padding: env(safe-area-inset-bottom, 0) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.mobile-bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    height: 58px;
}

.mob-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #888;
    text-decoration: none;
    padding: 6px 0;
    border: none;
    background: none;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
}

.mob-nav-item.active,
.mob-nav-item:active { color: #00358e; }

.mob-nav-item i { font-size: 18px; }

.mob-nav-cart-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 20px);
    background: #ed1c24;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── WHATSAPP FLOAT BUTTON ──────────────────────────────────────────────────── */
.whatsapp-float-btn {
    position: fixed;
    bottom: 70px; /* above bottom nav on mobile */
    right: 16px;
    width: 52px;
    height: 52px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(37,211,102,0.45);
    z-index: 997;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: waBounce 2s ease-in-out infinite;
}

.whatsapp-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37,211,102,0.6);
}

@keyframes waBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

/* ── MOBILE BREAKPOINTS ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {

    /* === HOMEPAGE: HEADER === */
    .header, header.header {
        padding: 0 !important;
    }

    /* Hide trust bar text on small screens, only show icons */
    .mobile-bottom-nav { display: block; }
    body { padding-bottom: 58px; }

    /* Adjust sticky cat-nav top offset */
    .cat-nav { top: 0 !important; }

    /* === HOMEPAGE: HERO BANNER === */
    .mundo-auto-hero > div {
        min-height: 220px !important;
        padding: 20px 16px !important;
    }

    .mundo-auto-hero > div > div:last-child {
        padding: 22px 16px !important;
        max-width: 100% !important;
    }

    .mundo-auto-hero > div > div:last-child > div:first-child {
        font-size: 16px !important;
        font-weight: 700 !important;
    }

    .mundo-auto-hero > div > div:last-child > div:nth-child(2) {
        font-size: 52px !important;
        padding: 6px 20px !important;
    }

    /* === TIRE FILTER WIDGET === */
    #tire-filter-widget {
        flex-direction: column !important;
        padding: 16px !important;
        gap: 10px !important;
        border-radius: 12px !important;
        margin: 0 !important;
    }

    #tire-filter-widget > div:first-child {
        margin-right: 0 !important;
    }

    /* Make the 3 selects a horizontal row */
    #tire-filter-widget .filter-selects-row {
        display: flex !important;
        gap: 8px !important;
        width: 100%;
    }

    #filter-width, #filter-profile, #filter-aro {
        font-size: 13px !important;
        padding: 10px 8px !important;
    }

    #tire-filter-widget button[onclick="searchByTireSize()"] {
        width: 100% !important;
        padding: 14px !important;
        font-size: 16px !important;
    }

    /* === FLASH SALE SECTION === */
    #flash-sale-section { padding: 20px 0 !important; }

    #flash-sale-section .container > div:first-child {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: flex-start !important;
        margin-bottom: 16px !important;
    }

    .flash-timer-num { font-size: 22px !important; }
    .flash-timer-block { min-width: 46px !important; padding: 5px 10px !important; }
    .flash-card { width: 160px !important; }
    .flash-card-price { font-size: 18px !important; }

    /* === PRODUCT SHELF GRID === */
    .shelf-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        flex-wrap: unset !important;
    }

    .shelf-scroll-wrap {
        overflow-x: hidden !important;
        padding: 0 12px 12px !important;
    }

    .ps-card {
        width: 100% !important;
        flex-shrink: unset !important;
        padding: 10px !important;
    }

    .ps-card-img { height: 120px !important; }
    .ps-card-title { font-size: 12px !important; min-height: 38px !important; }
    .ps-price-pix { font-size: 16px !important; }
    .btn-ps-comprar { padding: 12px !important; font-size: 13px !important; }
    .off-badge { font-size: 9px !important; padding: 2px 5px !important; }

    /* === CAT MINI TILES === */
    .cat-mini-strip-inner { gap: 6px !important; padding: 0 12px !important; }
    .cat-mini-tile { width: 120px !important; height: 80px !important; }
    .cat-mini-tile span { font-size: 10px !important; padding: 4px 6px !important; }

    /* === SHELF HEADER === */
    .shelf-header { padding: 0 12px !important; margin-bottom: 12px !important; }
    .shelf-header h2 { font-size: 16px !important; }

    /* === CATEGORY NAV === */
    .cat-nav-dept { display: none !important; }
    .cat-nav-cep { display: none !important; }
    .cat-nav-inner { height: 40px !important; }
    .cat-link { font-size: 12px !important; padding: 0 10px !important; }

    /* === TRUST BAR === */
    .trust-bar-divider { display: none !important; }
}

@media (max-width: 600px) {

    /* === MAIN HEADER (mobile compact) === */
    header.header > div:first-child { padding: 8px 0 !important; }
    header.header > div:first-child .container {
        gap: 8px !important;
        padding: 0 10px !important;
    }

    /* Logo: smaller on mobile */
    #main-logo img { height: 36px !important; }
    #main-logo span:first-child { font-size: 15px !important; }
    #main-logo span:last-child { font-size: 8px !important; }

    /* Search bar: full width stacked */
    header.header > div:first-child .container > div:nth-child(2) {
        order: 10;
        width: 100%;
        max-width: 100% !important;
    }

    /* Hide "Minha Conta" text, keep icon */
    #account-btn > div { display: none !important; }
    #cart-btn > div:last-child { display: none !important; }
    #account-btn > i, #cart-btn > div > i { font-size: 22px !important; }

    /* Search: restructure to take full row on mobile */
    header.header > div:first-child .container {
        flex-wrap: wrap !important;
        padding: 8px 12px !important;
        gap: 8px !important;
    }

    header.header > div:first-child .container > div:nth-child(2) {
        order: 3;
        flex: 0 0 100%;
    }

    /* Trust bar: only 2 items visible on tiny screens */
    header.header > div:last-child .container > div:nth-child(5),
    header.header > div:last-child .container > div:nth-child(6),
    header.header > div:last-child .container > div:nth-child(7),
    header.header > div:last-child .container > div:nth-child(8) { display: none !important; }

    /* Service bar: hide all links */
    .service-links { display: none !important; }

    /* === STRIP BANNER === */
    .mundo-auto-strip { display: none !important; }

    /* === HERO === */
    .mundo-auto-hero > div {
        min-height: 180px !important;
        padding: 16px !important;
    }

    .mundo-auto-hero > div > div:last-child {
        padding: 18px 14px !important;
    }

    .mundo-auto-hero > div > div:last-child > div:first-child {
        font-size: 14px !important;
    }

    .mundo-auto-hero > div > div:last-child > div:nth-child(2) {
        font-size: 44px !important;
        padding: 6px 16px !important;
    }

    .mundo-auto-hero > div > div:last-child > div:last-child {
        font-size: 14px !important;
        padding: 10px 20px !important;
        margin-top: 14px !important;
    }

    /* === FILTER WIDGET: Selects side by side === */
    #tire-filter-widget {
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        padding: 12px !important;
    }

    /* === FLASH CARDS === */
    .flash-cards-row { gap: 10px !important; padding: 0 12px 8px !important; }
    .flash-card { width: 148px !important; padding: 10px !important; border-radius: 10px !important; }
    .flash-card-name { font-size: 12px !important; }
    .flash-card-price { font-size: 17px !important; }
    .flash-card-pix { font-size: 10px !important; }
    .flash-card-btn { font-size: 12px !important; padding: 9px 6px !important; }

    /* === FOOTER MOBILE === */
    .ps-footer-inner {
        grid-template-columns: 1fr 1fr !important;
        gap: 20px !important;
        text-align: left !important;
    }

    .ps-footer-col ul {
        padding: 0 !important;
        list-style: none !important;
    }

    .ps-footer-bottom-inner {
        flex-direction: column !important;
        text-align: center !important;
        gap: 10px !important;
    }

    /* Footer support: stack */
    .footer-support-inner {
        flex-direction: column !important;
        gap: 20px !important;
        padding: 0 !important;
    }

    /* === PRODUCT GRID: 2 cols on mobile === */
    .shelf-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .shelf-section { padding: 16px 0 !important; }

    /* === CART DRAWER === */
    .cart-drawer { width: 100% !important; right: -100% !important; }
    .cart-drawer.open { right: 0 !important; }
}

/* ── CHECKOUT MOBILE ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .checkout-main {
        grid-template-columns: 1fr !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 0 !important;
    }

    .checkout-right {
        order: -1; /* Summary first on mobile */
        position: static !important;
        padding: 12px !important;
    }

    .checkout-left {
        padding: 12px !important;
    }

    .checkout-header {
        padding: 0 12px !important;
        height: auto !important;
        min-height: 56px !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    .checkout-steps {
        display: none !important; /* Hide steps on mobile to save space */
    }

    .checkout-back { font-size: 12px !important; }

    /* Full-width forms */
    .form-row {
        flex-direction: column !important;
        gap: 0 !important;
    }

    /* Pix section stacked */
    .pix-qr-section {
        flex-direction: column !important;
        gap: 16px !important;
        align-items: center !important;
    }

    .pix-qr-box {
        width: 140px !important;
        height: 140px !important;
    }

    .pix-qr-box i { font-size: 64px !important; }

    /* Make confirm button huge for mobile */
    .btn-pix-confirm {
        font-size: 18px !important;
        padding: 18px !important;
        border-radius: 12px !important;
        box-shadow: 0 6px 20px rgba(0,150,60,0.35) !important;
    }

    .order-summary-card, .contact-card, .delivery-card, .payment-option {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        margin-bottom: 8px !important;
    }

    .pix-total-value { font-size: 28px !important; }

    /* Sticky bottom: Confirm button */
    .mobile-checkout-cta {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
        background: #fff;
        border-top: 1px solid #eee;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        z-index: 500;
        display: none;
    }
}

/* ── POLICY PAGES MOBILE ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .content {
        padding: 20px 16px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    h1 { font-size: 22px !important; }
    h2 { font-size: 15px !important; margin-top: 24px !important; }
    p, ul { font-size: 14px !important; }

    .page-header {
        padding: 14px 16px !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    .step-card {
        padding: 14px 14px !important;
        gap: 10px !important;
    }

    .step-num {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        font-size: 14px !important;
    }

    .step-body h3 { font-size: 14px !important; }
    .step-body p { font-size: 13px !important; }
}

/* ── SAFE AREA INSETS (notch devices) ─────────────────────────────────────────── */
@supports (padding: max(0px)) {
    .mobile-bottom-nav {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    .mobile-bottom-nav-inner {
        height: calc(58px + max(0px, env(safe-area-inset-bottom)));
        align-items: flex-start;
        padding-top: 0;
    }
}

/* ── SMOOTH SCROLL ─────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

/* ── INPUT IMPROVEMENTS ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    input, select, textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
}

/* ── LOADING SKELETON for mobile ─────────────────────────────────────────────── */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 400px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 8px;
}

/* ── PREVENT OVERFLOW ISSUES ─────────────────────────────────────────────────── */
.container {
    max-width: 100%;
    overflow-x: hidden;
}

@media (max-width: 600px) {
    .container { padding: 0 12px !important; }
}
