/* =========================================================
   RevPTC Frontend — Responsive Fixes (added 2026-08-11)
   Loaded after main.css on public + user-dashboard pages
   ========================================================= */

/* 1. Fluid media — prevent images/videos/maps from forcing horizontal scroll */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* 2. Cookie consent card (was fixed 520px -> overflowed on mobile) */
@media (max-width: 575.98px) {
    .cookies-card {
        width: calc(100vw - 30px) !important;
        max-width: 520px;
        left: 15px;
        right: auto;
    }
}

/* 3. Contact page map iframe */
.maps iframe {
    width: 100%;
    height: 100%;
    min-height: 300px;
}

/* 4. Touch-friendly table scrolling everywhere */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* 5. Typography + section spacing on mobile */
@media (max-width: 767.98px) {
    h1 { font-size: 1.7rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }
    body { font-size: 15px; }
    .pt-120 { padding-top: 60px; }
    .pb-120 { padding-bottom: 60px; }
    .pt-100 { padding-top: 50px; }
    .pb-100 { padding-bottom: 50px; }
}

/* 6. Banner headings on phones */
@media (max-width: 575.98px) {
    .banner-content h1,
    .banner-content-premium h1,
    .hero-content h1 {
        font-size: 1.6rem !important;
        line-height: 1.3;
    }
    .banner-content p,
    .hero-content p {
        font-size: 0.95rem;
    }
}

/* 7. Sidebar safe width on very small screens (off-canvas drawer) */
@media (max-width: 575.98px) {
    .sidebar {
        width: 250px !important;
    }
}

/* 8. Filter bars / inline forms: wrap instead of overflowing */
@media (max-width: 575.98px) {
    form.d-flex,
    .d-flex.align-items-center.gap-2 {
        flex-wrap: wrap;
    }
    .btn {
        white-space: normal;
    }
}

/* 9. Cards / stat grids never exceed viewport */
.card,
.widget {
    min-width: 0;
}

/* 10. Header logo safety — custom.css already sizes it (160x40),
   just guard against any overflow / stretching on narrow screens */
.site-logo {
    display: inline-block;
    max-width: 100%;
}
.site-logo img {
    max-width: 100%;
}

/* 11. Scroll-to-top button safety */
.scrollToTop {
    right: 15px !important;
    bottom: 60px !important;
}

/* 12. Chat widget (tawk) stays inside viewport */
[id^="tawkchat"],
[class*="tawk-min"] {
    max-width: 100%;
}

/* 13. fs-7 utility (Bootstrap only ships fs-1..fs-6) */
.fs-7 {
    font-size: 0.8rem;
}

/* ============================================================
   14. UNIVERSAL RESPONSIVE ENGINE (MOBILE, TABLET, DESKTOP)
   ============================================================ */

/* 1. Prevent Horizontal Viewport Overflow Globally */
html, body {
    max-width: 100vw !important;
    overflow-x: clip !important;
}

/* 2. Universal Table Swipe & Container Safety */
.table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}
.table-responsive > .table {
    margin-bottom: 0 !important;
}

/* 3. Small Screen & Phone Adaptations (< 576px) */
@media (max-width: 575.98px) {
    /* Safe container padding */
    .container, .container-fluid, .p2p-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Modals never exceed viewport */
    .modal-dialog {
        max-width: calc(100vw - 20px) !important;
        margin: 10px auto !important;
    }
    .modal-content {
        border-radius: 16px !important;
    }
    .modal-body {
        padding: 16px 14px !important;
    }

    /* Buttons & Toolbars wrap smoothly */
    .d-flex.gap-2,
    .d-flex.gap-3,
    .btn-group,
    .p2p-filter-group {
        flex-wrap: wrap !important;
    }

    /* Touch-friendly buttons */
    .btn, button, input[type="submit"], a.btn {
        min-height: 38px;
    }

    /* P2P Deal cards & stat boxes adapt */
    .deal-stat-box {
        padding: 8px 10px !important;
    }
    .deal-stat-val {
        font-size: 0.88rem !important;
    }

    /* Table text scaling */
    .table td, .table th {
        padding: 8px 10px !important;
        font-size: 0.82rem !important;
    }

    /* Forms */
    .form-control, .form-select {
        font-size: 15px !important; /* Prevents auto-zoom on iOS */
    }
}

/* 4. Tablet Adaptations (576px - 991px) */
@media (min-width: 576px) and (max-width: 991.98px) {
    .container, .container-fluid {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }
    .modal-dialog {
        max-width: 520px !important;
        margin: 1.5rem auto !important;
    }
}
