/**
 * BCS Alert Widget v2 — Formulaire natif (sans WPForms)
 * Basé sur alerte_immobiliere_v2.html, adapté au thème Houzez dark footer.
 *
 * Tokens CSS réels (Houzez palette + BCS brand) :
 *   --bcs-brand       : #2c5f8a  (bleu Bonapars)
 *   --bcs-brand-hover : #1e3a5f
 *   --bcs-accent      : #e8a039  (orange CTA footer)
 *   --bcs-radius      : 8px
 *
 * @package BCS\Alerts
 * @since   2.2.1
 */

/* ── BOUTON DÉCLENCHEUR ──────────────────────────────────────────────────── */
.bcs-v2-trigger-wrap {
    text-align: center;
    padding: 8px 0;
}

.bcs-v2-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: #e8a039;
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .1s;
    font-family: inherit;
    line-height: 1.4;
}

.bcs-v2-trigger-btn:hover,
.bcs-v2-trigger-btn:focus {
    background: #cf8a2a;
    color: #ffffff !important;
    text-decoration: none;
    transform: translateY(-1px);
    outline: none;
}

.bcs-v2-trigger-btn:active {
    transform: scale(.98);
}

.bcs-v2-trigger-btn .bcs-v2-icon {
    font-style: normal;
    font-size: 17px;
    line-height: 1;
}

.bcs-v2-trigger-note {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
}

/* ── OVERLAY POPUP ───────────────────────────────────────────────────────── */
.bcs-v2-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2147483647;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.bcs-v2-overlay.bcs-v2-open {
    display: flex;
}

body.bcs-v2-modal-active {
    overflow: hidden;
}

/* ── MODALE ──────────────────────────────────────────────────────────────── */
.bcs-v2-modal {
    background: #ffffff;
    border-radius: 12px;
    border: 0.5px solid #e5e7eb;
    width: 100%;
    max-width: 490px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    font-family: inherit;
    font-size: 14px;
    color: #1a1a2e;
}

/* Scrollbar fine dans la modale */
.bcs-v2-modal::-webkit-scrollbar { width: 4px; }
.bcs-v2-modal::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* ── EN-TÊTE MODALE ──────────────────────────────────────────────────────── */
.bcs-v2-modal-header {
    padding: 1.25rem 1.25rem 0.875rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 2;
    border-bottom: 0.5px solid #e5e7eb;
}

.bcs-v2-modal-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #eef4fb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    color: #2c5f8a;
}

.bcs-v2-modal-title-wrap {
    flex: 1;
}

.bcs-v2-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.3;
    margin: 0;
}

.bcs-v2-modal-intro {
    font-size: 12.5px;
    color: #6b7280;
    margin-top: 3px;
    line-height: 1.4;
}

.bcs-v2-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background .12s, color .12s;
    flex-shrink: 0;
    line-height: 1;
}

.bcs-v2-close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ── CORPS MODALE ────────────────────────────────────────────────────────── */
.bcs-v2-modal-body {
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

/* ── CHAMPS FORM ─────────────────────────────────────────────────────────── */
.bcs-v2-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bcs-v2-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bcs-v2-field label,
.bcs-v2-field-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    display: block;
    margin-bottom: 0;
}

.bcs-v2-req {
    color: #dc2626;
    margin-left: 2px;
}

.bcs-v2-field input,
.bcs-v2-field select {
    width: 100%;
    padding: 9px 11px;
    border: 0.5px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    font-size: 13.5px;
    color: #1f2937;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
    box-sizing: border-box;
}

.bcs-v2-field input::placeholder {
    color: #9ca3af;
}

.bcs-v2-field input:focus,
.bcs-v2-field select:focus {
    border-color: #2c5f8a;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(44, 95, 138, 0.12);
}

.bcs-v2-field input.bcs-v2-err,
.bcs-v2-field select.bcs-v2-err {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

.bcs-v2-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    cursor: pointer;
}

/* Champ téléphone avec préfixe */
.bcs-v2-phone-row {
    display: flex;
    gap: 0;
}

.bcs-v2-phone-prefix {
    padding: 9px 10px;
    border: 0.5px solid #d1d5db;
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: #f3f4f6;
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
}

.bcs-v2-phone-row input {
    border-radius: 0 8px 8px 0 !important;
}

/* Champ budget avec suffixe FCFA */
.bcs-v2-budget-wrap {
    display: flex;
    gap: 0;
}

.bcs-v2-budget-wrap input {
    border-radius: 8px 0 0 8px !important;
    flex: 1;
    min-width: 0;
}

.bcs-v2-budget-suffix {
    padding: 9px 12px;
    border: 0.5px solid #d1d5db;
    border-left: none;
    border-radius: 0 8px 8px 0;
    background: #f3f4f6;
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.bcs-v2-budget-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 3px;
    min-height: 16px;
}

/* ── MULTI-SELECT TYPE DE BIEN ───────────────────────────────────────────── */
.bcs-v2-ms-wrap {
    position: relative;
}

.bcs-v2-ms-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 11px;
    border: 0.5px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    font-size: 13.5px;
    color: #1f2937;
    cursor: pointer;
    min-height: 39px;
    transition: border-color .15s, box-shadow .15s;
    user-select: none;
    box-sizing: border-box;
}

.bcs-v2-ms-trigger:focus,
.bcs-v2-ms-trigger.bcs-v2-ms-open {
    outline: none;
    border-color: #2c5f8a;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(44, 95, 138, 0.12);
}

.bcs-v2-ms-trigger.bcs-v2-ms-open {
    border-radius: 8px 8px 0 0;
}

.bcs-v2-ms-trigger.bcs-v2-err {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

.bcs-v2-ms-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-height: 22px;
}

.bcs-v2-ms-placeholder {
    color: #9ca3af;
    font-size: 13.5px;
    line-height: 22px;
}

.bcs-v2-ms-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eef4fb;
    color: #2c5f8a;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}

.bcs-v2-ms-tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #2c5f8a;
    font-size: 13px;
    padding: 0;
    line-height: 1;
    opacity: .6;
    display: flex;
    align-items: center;
}

.bcs-v2-ms-tag-remove:hover {
    opacity: 1;
}

.bcs-v2-ms-arrow {
    font-size: 14px;
    color: #9ca3af;
    transition: transform .2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.bcs-v2-ms-arrow.bcs-v2-ms-open {
    transform: rotate(180deg);
}

.bcs-v2-ms-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 0.5px solid #2c5f8a;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 30;
    display: none;
    box-shadow: 0 6px 16px rgba(0,0,0,0.10);
    max-height: 220px;
    overflow-y: auto;
}

.bcs-v2-ms-dropdown.bcs-v2-ms-open {
    display: block;
}

.bcs-v2-ms-group {
    padding: 7px 11px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-top: 0.5px solid #f3f4f6;
}

.bcs-v2-ms-group:first-child {
    border-top: none;
}

.bcs-v2-ms-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    font-size: 13.5px;
    color: #374151;
    cursor: pointer;
    transition: background .1s;
}

.bcs-v2-ms-option:hover {
    background: #f9fafb;
}

.bcs-v2-ms-option.bcs-v2-selected {
    color: #2c5f8a;
    background: #f0f7ff;
}

.bcs-v2-ms-checkbox {
    width: 15px;
    height: 15px;
    border: 0.5px solid #d1d5db;
    border-radius: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: background .1s, border-color .1s;
    background: #ffffff;
}

.bcs-v2-ms-option.bcs-v2-selected .bcs-v2-ms-checkbox {
    background: #2c5f8a;
    border-color: #2c5f8a;
    color: #ffffff;
}

.bcs-v2-ms-count {
    font-size: 12px;
    color: #6b7280;
    margin-top: 3px;
}

/* ── BOUTON SUBMIT ───────────────────────────────────────────────────────── */
.bcs-v2-submit-btn {
    width: 100%;
    padding: 11px;
    background: #2c5f8a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s, transform .1s;
    margin-top: 2px;
    font-family: inherit;
}

.bcs-v2-submit-btn:hover {
    background: #1e3a5f;
}

.bcs-v2-submit-btn:active {
    transform: scale(.98);
}

.bcs-v2-submit-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.bcs-v2-submit-btn .bcs-v2-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: bcs-v2-spin .6s linear infinite;
}

@keyframes bcs-v2-spin {
    to { transform: rotate(360deg); }
}

/* ── MENTION LÉGALE ──────────────────────────────────────────────────────── */
.bcs-v2-privacy {
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    line-height: 1.5;
    margin-top: -4px;
}

.bcs-v2-privacy a {
    color: #2c5f8a;
    text-decoration: none;
}

.bcs-v2-privacy a:hover {
    text-decoration: underline;
}

/* ── MESSAGE D'ERREUR GLOBAL ─────────────────────────────────────────────── */
.bcs-v2-error-banner {
    padding: 10px 12px;
    background: #fef2f2;
    border: 0.5px solid #fecaca;
    border-radius: 6px;
    font-size: 13px;
    color: #dc2626;
    display: none;
}

.bcs-v2-field-error {
    font-size: 12px;
    color: #dc2626;
    margin-top: 3px;
    display: none;
}

/* ── VUE DE SUCCÈS ───────────────────────────────────────────────────────── */
.bcs-v2-success-view {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1.5rem 1.5rem;
    gap: 12px;
}

.bcs-v2-success-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #f0fdf4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #16a34a;
}

.bcs-v2-success-title {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}

.bcs-v2-success-msg {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.55;
    margin: 0;
}

.bcs-v2-summary-box {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px 14px;
    width: 100%;
    text-align: left;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.9;
    border: 0.5px solid #e5e7eb;
}

.bcs-v2-summary-box strong {
    color: #374151;
    font-weight: 500;
}

.bcs-v2-close-success-btn {
    width: 100%;
    padding: 11px;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}

.bcs-v2-close-success-btn:hover {
    background: #e5e7eb;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
    .bcs-v2-modal {
        max-height: 96vh;
        border-radius: 10px;
    }

    .bcs-v2-modal-body {
        padding: 0.875rem 1rem 1rem;
    }

    .bcs-v2-field-row {
        grid-template-columns: 1fr;
    }

    .bcs-v2-field input,
    .bcs-v2-field select,
    .bcs-v2-ms-trigger {
        font-size: 16px; /* Empêche le zoom iOS */
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SÉLECTEUR D'INDICATIF PAYS (WhatsApp dial selector)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Remplace .bcs-v2-phone-prefix statique */
.bcs-v2-phone-row {
    display: flex;
    gap: 0;
    align-items: stretch;
}

.bcs-v2-dial-select-wrap {
    position: relative;
    flex-shrink: 0;
}

/* Bouton déclencheur indicatif */
.bcs-v2-dial-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 9px 10px;
    border: 0.5px solid #d1d5db;
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: #f3f4f6;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s;
    min-width: 80px;
    box-sizing: border-box;
    font-family: inherit;
}

.bcs-v2-dial-trigger:hover {
    background: #e9ecf0;
    border-color: #9ca3af;
}

.bcs-v2-dial-trigger:focus {
    outline: none;
    border-color: #2c5f8a;
    box-shadow: 0 0 0 3px rgba(44, 95, 138, 0.12);
    z-index: 1;
}

.bcs-v2-dial-flag {
    font-size: 16px;
    line-height: 1;
}

.bcs-v2-dial-code {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    letter-spacing: -0.01em;
}

.bcs-v2-dial-arrow {
    font-size: 11px;
    color: #9ca3af;
    margin-left: 2px;
}

/* Champ numéro local (suite du phone-row) */
.bcs-v2-phone-row input[type="tel"] {
    flex: 1;
    border-radius: 0 8px 8px 0 !important;
    min-width: 0;
}

/* Dropdown indicatifs */
.bcs-v2-dial-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    width: 280px;
    background: #ffffff;
    border: 0.5px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    z-index: 40;
    display: none;
    overflow: hidden;
}

.bcs-v2-dial-dropdown.bcs-v2-dial-open {
    display: block;
}

/* Champ de recherche dans le dropdown */
.bcs-v2-dial-search-wrap {
    padding: 8px 10px;
    border-bottom: 0.5px solid #f3f4f6;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 2;
}

.bcs-v2-dial-search {
    width: 100%;
    padding: 7px 10px;
    border: 0.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #f9fafb;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

.bcs-v2-dial-search:focus {
    border-color: #2c5f8a;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(44, 95, 138, 0.10);
}

/* Liste des pays */
.bcs-v2-dial-list {
    max-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.bcs-v2-dial-list::-webkit-scrollbar { width: 4px; }
.bcs-v2-dial-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* En-têtes de groupe */
.bcs-v2-dial-group {
    padding: 6px 12px 4px;
    font-size: 10.5px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #f9fafb;
    border-top: 0.5px solid #f3f4f6;
}

/* ─── SÉLECTEUR LOCALITÉ (Basé sur le Dial / Multi-Select) ─── */
.bcs-v2-loc-wrap {
    position: relative;
    width: 100%;
}

.bcs-v2-loc-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    border: 0.5px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    text-align: left;
    transition: background .15s, border-color .15s;
    font-family: inherit;
    box-sizing: border-box;
    height: 42px;
}

.bcs-v2-loc-trigger:hover {
    background: #ffffff;
    border-color: #9ca3af;
}

.bcs-v2-loc-trigger:focus,
.bcs-v2-loc-trigger[aria-expanded="true"] {
    outline: none;
    background: #ffffff;
    border-color: #2c5f8a;
    box-shadow: 0 0 0 3px rgba(44, 95, 138, 0.12);
    z-index: 1;
}

.bcs-v2-loc-trigger.bcs-v2-err {
    border-color: #dc2626;
    background: #fef2f2;
}

.bcs-v2-loc-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bcs-v2-loc-arrow {
    font-size: 11px;
    color: #9ca3af;
    margin-left: 8px;
    flex-shrink: 0;
}

.bcs-v2-loc-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 0.5px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    z-index: 40;
    display: none;
    overflow: hidden;
}

.bcs-v2-loc-dropdown.bcs-v2-loc-open {
    display: block;
}

.bcs-v2-loc-search-wrap {
    padding: 8px 10px;
    border-bottom: 0.5px solid #f3f4f6;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 2;
}

.bcs-v2-loc-search {
    width: 100%;
    padding: 7px 10px;
    border: 0.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #f9fafb;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

.bcs-v2-loc-search:focus {
    border-color: #2c5f8a;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(44, 95, 138, 0.10);
}

.bcs-v2-loc-list {
    max-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.bcs-v2-loc-list::-webkit-scrollbar { width: 4px; }
.bcs-v2-loc-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

.bcs-v2-loc-option {
    padding: 8px 12px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: background .1s;
}

.bcs-v2-loc-option:hover {
    background: #f3f4f6;
}

.bcs-v2-dial-group:first-child {
    border-top: none;
}

/* Options */
.bcs-v2-dial-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    font-size: 13.5px;
    color: #374151;
    cursor: pointer;
    transition: background .1s;
}

.bcs-v2-dial-option:hover {
    background: #f0f7ff;
    color: #2c5f8a;
}

.bcs-v2-dial-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bcs-v2-dial-num {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    flex-shrink: 0;
}

/* Hint sous le champ téléphone */
.bcs-v2-field-hint {
    display: block;
    font-size: 11.5px;
    color: #9ca3af;
    margin-top: 3px;
}

/* Responsive mobile */
@media (max-width: 420px) {
    .bcs-v2-dial-dropdown {
        width: 240px;
    }
    .bcs-v2-dial-trigger {
        min-width: 70px;
        padding: 9px 7px;
    }
    .bcs-v2-dial-code {
        font-size: 11px;
    }
}
