/* ==========================================================================
   FILENAME: mobile_contact.css
   DESCRIPTION: Fully Media-Wrapped Mobile Styles for CAPPS Contact Page
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TABLET & BELOW (max-width: 991px)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 991px) {

    /* Global Resets */
    html, body {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        -webkit-text-size-adjust: 100%;
    }

    .contact-page,
    .contact-page__root,
    .page-main {
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Header Adjustments */
    .matek-site-header__inner {
        flex-wrap: wrap !important;
        padding: 10px 15px !important;
    }

    .matek-nav {
        display: none !important;
    }

    .matek-header-actions {
        width: 100% !important;
        justify-content: space-between !important;
        margin-top: 10px !important;
        gap: 8px !important;
    }

    .matek-phone {
        font-size: 0.85rem !important;
    }

    /* Hero Section */
    .contact-page-hero {
        padding: 30px 15px 20px !important;
    }

    .contact-page-hero__title {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }

    .contact-page-hero__lead {
        font-size: 0.95rem !important;
    }

    /* Form Container Cards */
    .contact-ui__card {
        padding: 20px 15px !important;
        margin: 0 10px !important;
        border-radius: 12px !important;
    }

    /* Experts Grid Collapse */
    .contact-experts__grid {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 20px !important;
    }

    .contact-experts__visual,
    .contact-experts__content {
        width: 100% !important;
    }

    .contact-experts__img {
        max-width: 280px !important;
        height: auto !important;
    }

    .contact-experts__actions {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .contact-experts__btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Map & Agency Grid Wrappers */
    .portages_contact_bloc_17 .row {
        flex-direction: column !important;
    }

    .portages_contact_bloc_49,
    .portages_contact_bloc_50,
    .map-image,
    .portages-table-agences,
    .col-4, .col-5, .col-6, .col-7, .col-8, .col-12 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    #container_map {
        height: 300px !important;
        margin-bottom: 20px !important;
    }
}

/* --------------------------------------------------------------------------
   2. LANDSCAPE MOBILE & SMALL TABLETS (max-width: 767px)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {

    /* Form Layout Grid Breakdown */
    .contact-ui__grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    .contact-ui__cell,
    .contact-ui__full {
        width: 100% !important;
    }

    .contact-ui__head {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    .contact-ui__select,
    .contact-ui__input,
    .contact-ui__textarea {
        width: 100% !important;
        font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
        padding: 12px 14px !important;
        box-sizing: border-box !important;
    }

    .contact-ui__submit {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 1rem !important;
    }

    .contact-ui__legal p {
        font-size: 0.78rem !important;
        text-align: center !important;
    }

    /* Footer Layout Collapse */
    #footer_div .row {
        flex-direction: column !important;
        gap: 25px !important;
    }

    .portages_footer_bloc_8 {
        width: 100% !important;
        text-align: center !important;
    }

    /* Agences Table Adjustments */
    .portages-table-agences table tr {
        display: flex !important;
        flex-direction: column !important;
        padding: 15px 0 !important;
        border-bottom: 1px solid #eee !important;
    }

    .portages-agences-col-1,
    .portages-agences-col-3 {
        width: 100% !important;
        text-align: center !important;
    }

        .portages-agences-col-1 svg {
            max-width: 120px !important;
            height: auto !important;
            margin: 0 auto 10px !important;
        }

    /* Chat Box Responsiveness */
    .chatbox-wrapper {
        right: 15px !important;
        bottom: 15px !important;
    }

    .chatbox-message-wrapper {
        width: calc(100vw - 30px) !important;
        right: -10px !important;
        bottom: 70px !important;
        max-height: 80vh !important;
    }

    .chatbox-message-form textarea {
        width: 100% !important;
    }
}

/* --------------------------------------------------------------------------
   3. STANDARD PHONES (max-width: 575px)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 575px) {

    /* Container Spacing */
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Hero Adjustments */
    .contact-page-hero__title {
        font-size: 1.75rem !important;
    }

    .eyebrow-tag {
        font-size: 0.75rem !important;
        letter-spacing: 1px !important;
    }

    /* Floating Widgets Stack Management */
    .phonebox-wrapper {
        bottom: 20px !important;
        left: 15px !important;
    }

    .whatsapp-wrapper {
        bottom: 20px !important;
        right: 15px !important;
    }

    .mailbox-wrapper {
        bottom: 75px !important;
        right: 15px !important;
    }

    .agendabox-wrapper {
        bottom: 130px !important;
        right: 15px !important;
    }

    .cookiesbox-wrapper {
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        border-radius: 0 !important;
    }

    .cookiesbox-toggle {
        width: 100% !important;
        justify-content: center !important;
        border-radius: 0 !important;
        padding: 8px 0 !important;
    }

    /* Language Selector Flags */
    .matek-lang {
        gap: 4px !important;
    }

    .flag-item img {
        width: 22px !important;
        height: auto !important;
    }

    /* Modal Adjustments */
    .portages_contact_modal_bloc_2,
    .portages_contact_modal_bloc_7 {
        width: 100% !important;
        padding: 15px !important;
    }

    .portages_contact_modal_bloc_12 {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .portages_contact_modal_bloc_14,
    .portages_contact_modal_bloc_13 {
        width: 100% !important;
    }
}

/* --------------------------------------------------------------------------
   4. SMALL PHONES (max-width: 414px)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 414px) {

    .matek-brand__logo {
        width: 140px !important;
        height: auto !important;
    }

    .btn-cta {
        font-size: 0.85rem !important;
        padding: 10px 14px !important;
    }

    .contact-page-hero__title {
        font-size: 1.5rem !important;
    }

    .contact-ui__title {
        font-size: 1rem !important;
    }
}

/* --------------------------------------------------------------------------
   5. ULTRA-SMALL SCREENS (max-width: 360px)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 360px) {

    .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .contact-ui__card {
        padding: 15px 10px !important;
        margin: 0 !important;
    }

    .matek-header-actions {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .matek-btn--primary,
    .matek-phone {
        text-align: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .contact-page-hero__title {
        font-size: 1.35rem !important;
    }

    .contact-experts__title {
        font-size: 1.2rem !important;
    }
}

/* --------------------------------------------------------------------------
   6. TOUCH & IOS SPECIFIC MEDIA FEATURE OVERRIDE
   -------------------------------------------------------------------------- */
@media screen and (max-width: 991px) and (pointer: coarse) {

    /* Fixes iOS Safari auto-zoom on focused fields */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important;
    }
}


/****/

/* Mobile Responsive Adjustments (Max-Width 768px) */
@media screen and (max-width: 768px) {

    /* 1. Hide Floating Buttons on the Right Side */
    .chatbox-wrapper,
    .phonebox-wrapper,
    .whatsapp-wrapper,
    .mailbox-wrapper,
    .agendabox-wrapper,
    .cookiesbox-wrapper,
    .spinner,
    .spinner_wahatsapp {
        display: none !important;
    }

    /* 2. Fix Header Layout & "Être rappelé" Button on Mobile */
    .matek-site-header__inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 1rem;
    }

    .matek-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

        /* Compact Contact Button for Mobile Header */
        .matek-header-actions .matek-btn--primary {
            display: inline-block !important;
            padding: 6px 12px;
            font-size: 13px;
            white-space: nowrap;
            border-radius: 4px;
        }

        /* Hide raw phone number text in desktop header actions if overlapping */
        .matek-header-actions .matek-phone {
            display: none;
        }
}

/****/

/* 1. Prevent internal scrolling containers */
html,
body {
    height: auto !important;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto !important; /* Forces standard browser window scrollbar */
}

/* 2. Neutralize any scrollable main wrapper or layout containers */
.matek-site-wrapper,
.main-content,
main,
#app-root,
.wrapper {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* 3. Hide webkit/firefox scrollbars on any nested scroll containers if forced */
* {
    box-sizing: border-box;
}

    *:not(html):not(body) {
        -ms-overflow-style: none; /* IE and Edge */
        scrollbar-width: none; /* Firefox */
    }

        *:not(html):not(body)::-webkit-scrollbar {
            display: none; /* Chrome, Safari, Opera */
        }

/* Mobile Responsive Adjustments (Max-Width 768px) */
@media screen and (max-width: 768px) {

    /* Hide header actions (button/contact info) on mobile */
    .matek-header-actions {
        display: none !important;
    }
}