/**
 * International Phone Prefix v7 - PrestaShop Override CSS
 * Full mobile support: handles iti-mobile dropdown-in-body behavior
 */

/* =============================================
   CONTAINER
   ============================================= */
.iti {
    display: block !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
}

/* =============================================
   INPUT FIELD
   ============================================= */
.iti input.form-control,
.iti input[type="tel"],
.iti input[type="text"] {
    width: 100% !important;
    height: 44px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px !important; /* 16px prevents iOS auto-zoom */
    box-sizing: border-box;
}

.iti--separate-dial-code input.form-control,
.iti--separate-dial-code input[type="tel"],
.iti--separate-dial-code input[type="text"] {
    padding-left: 100px !important;
}

.iti input.form-control:focus,
.iti input[type="tel"]:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* =============================================
   FLAG BUTTON - large touch target
   ============================================= */
.iti__flag-container {
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 2 !important;
}

.iti__selected-flag {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    min-height: 44px !important;
    min-width: 70px !important;
    padding: 0 8px 0 10px !important;
    background: transparent !important;
    border-right: 1px solid #ced4da !important;
    border-radius: 4px 0 0 4px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
    user-select: none !important;
    -webkit-user-select: none !important;
}

.iti__selected-flag:hover,
.iti__selected-flag:active {
    background-color: #f0f0f0 !important;
}

/* Flag images local */
.iti__flag {
    background-image: url('../img/flags.png') !important;
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .iti__flag {
        background-image: url('../img/flags@2x.png') !important;
    }
}

.iti__selected-dial-code {
    margin-left: 6px !important;
    font-size: 14px !important;
    color: #333 !important;
    font-weight: 500 !important;
}

.iti__arrow {
    margin-left: 6px !important;
    border-left: 4px solid transparent !important;
    border-right: 4px solid transparent !important;
    border-top: 5px solid #999 !important;
}

.iti__arrow--up {
    border-top: none !important;
    border-bottom: 5px solid #999 !important;
}

/* =============================================
   DROPDOWN - DESKTOP (dropdown inside .iti)
   ============================================= */
.iti__country-list {
    position: absolute !important;
    z-index: 2147483647 !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    top: auto!important;
    left: 0 !important;
    background-color: #fff !important;
    border: 1px solid #bbb !important;
    border-radius: 6px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25) !important;
    max-height: 220px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 340px !important;
    -webkit-overflow-scrolling: touch !important;
}

.iti__country-list.iti__hide {
    display: none !important;
}

/* Country row */
.iti__country-list .iti__country {
    display: flex !important;
    align-items: center !important;
    padding: 10px 14px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    background: #fff !important;
}

.iti__country-list .iti__country:hover,
.iti__country-list .iti__country:active {
    background-color: #eef3f8 !important;
}

.iti__country-list .iti__country.iti__highlight {
    background-color: #dbe7f2 !important;
}

.iti__country-list .iti__country.iti__active {
    background-color: #d0e2f3 !important;
    font-weight: 600 !important;
}

.iti__country-name {
    margin-left: 8px !important;
    color: #333 !important;
}

.iti__country .iti__dial-code {
    color: #777 !important;
    margin-left: 6px !important;
}

.iti__country .iti__flag-box {
    display: inline-block !important;
    width: 20px !important;
    min-width: 20px !important;
}

.iti__country-list .iti__divider {
    border-bottom: 2px solid #ccc !important;
    margin: 2px 0 !important;
    padding: 0 !important;
}

/* =============================================
   MOBILE: iti-mobile class on body
   intl-tel-input moves dropdown to body > .iti--container
   and shows it as a fullscreen overlay
   ============================================= */

/* The container that wraps the dropdown on mobile */
.iti--container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 2147483647 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.5) !important;
    padding: 20px !important;
}

/* On mobile, the country list inside the container */
.iti--container .iti__country-list {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 360px !important;
    max-height: 70vh !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
    border: none !important;
}

/* Bigger touch targets on mobile */
.iti--container .iti__country-list .iti__country {
    padding: 14px 16px !important;
    min-height: 48px !important;
    font-size: 16px !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}

/* =============================================
   OVERFLOW FIXES FOR PRESTASHOP (desktop)
   ============================================= */
.form-group,
.form-group > div,
.form-group [class*="col-"] {
    overflow: visible !important;
}

#delivery-address,
#invoice-address,
.address-form,
#customer-form {
    overflow: visible !important;
}

#delivery-address .form-group,
#invoice-address .form-group,
.address-form .form-group,
#customer-form .form-group,
#delivery-address .row,
#invoice-address .row,
.address-form .row,
#customer-form .row {
    overflow: visible !important;
}

.checkout-step,
.checkout-step .step-content,
.checkout-step .content,
.card-body,
.panel-body,
.page-content,
.page-addresses,
.address-body {
    overflow: visible !important;
}

/* =============================================
   RESPONSIVE adjustments
   ============================================= */
@media (max-width: 767px) {
    /* Non-mobile-detected browsers on small screens */
    .iti__country-list {
        width: calc(100vw - 40px) !important;
        max-width: 340px !important;
        max-height: 200px !important;
    }

    .iti__country-list .iti__country {
        padding: 12px 14px !important;
        min-height: 44px !important;
    }

    .iti--separate-dial-code input.form-control,
    .iti--separate-dial-code input[type="tel"] {
        padding-left: 90px !important;
    }

    .iti__selected-flag {
        min-width: 80px !important;
    }
}

/* =============================================
   Z-INDEX for modals
   ============================================= */
.modal .iti__country-list,
.modal .iti--container {
    z-index: 2147483647 !important;
}
