@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400;500;600;700;800&display=swap');

/* ── OVERLAY ── */
#afdl-popup-overlay {
    position:fixed; inset:0; background:rgba(0,0,0,0.65);
    z-index:999999; display:flex; align-items:center; justify-content:center;
    padding:15px; backdrop-filter:blur(3px); animation:afdlFadeIn 0.2s ease;
}
@keyframes afdlFadeIn  { from{opacity:0} to{opacity:1} }
@keyframes afdlSlideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:none} }
@keyframes afdlBounce  { 0%{transform:scale(.5);opacity:0} 70%{transform:scale(1.15)} 100%{transform:scale(1);opacity:1} }

/* ── BOÎTE POPUP ── */
#afdl-popup-box {
    background:#fff; border-radius:16px; width:100%; max-width:560px;
    max-height:92vh; overflow-y:auto; box-shadow:0 25px 80px rgba(0,0,0,.35);
    font-family:'Work Sans',sans-serif; animation:afdlSlideUp 0.25s ease;
}

/* ── HEADER bleu canard ── */
.afdl-popup-header {
    display:flex; align-items:center; justify-content:space-between;
    background:linear-gradient(135deg,#274C5B,#1d2130);
    padding:22px 28px; border-radius:16px 16px 0 0; position:sticky; top:0; z-index:2;
}
.afdl-popup-header-left { display:flex; align-items:center; gap:14px; }
.afdl-popup-logo { font-size:32px; }
.afdl-popup-title { color:#fff; font-size:17px; font-weight:800; font-family:'Work Sans',sans-serif; }
.afdl-popup-subtitle { color:rgba(255,255,255,.65); font-size:12px; margin-top:2px; }
#afdl-popup-close {
    background:rgba(255,255,255,.15); border:none; color:#fff; width:32px; height:32px;
    border-radius:50%; cursor:pointer; font-size:16px; display:flex; align-items:center;
    justify-content:center; transition:background .2s; flex-shrink:0;
}
#afdl-popup-close:hover { background:rgba(255,255,255,.3); }

/* ── BODY ── */
.afdl-popup-body { padding:28px; }

/* ── FORMULAIRE ── */
.afdl-form { font-family:'Work Sans',sans-serif; color:#1d2130; }
.afdl-intro {
    font-size:14px; color:#555; line-height:1.7; margin:0 0 22px;
    padding:14px 16px; background:#f8fbfc; border-left:3px solid #E30613; border-radius:0 8px 8px 0;
}

/* ── MONTANT ── */
.afdl-montant-wrap {
    display:flex; align-items:stretch;
    border:2px solid #e0e0e0; border-radius:10px;
    margin-bottom:18px; background:#fff; transition:border-color .2s; cursor:text;
}
.afdl-montant-wrap:focus-within { border-color:#E30613; }
.afdl-montant-editable {
    flex:1; min-width:0; padding:14px 18px;
    font-size:28px; font-weight:700; color:#1d2130;
    font-family:'Work Sans',sans-serif; outline:none;
    min-height:60px; line-height:1.2;
    white-space:nowrap; overflow:hidden;
    cursor:text; -webkit-user-select:text; user-select:text;
}
.afdl-montant-editable:empty::before {
    content:attr(data-placeholder); color:#bbb; font-weight:400; font-size:20px;
}
.afdl-montant-editable.libre { color:#E30613; caret-color:#E30613; }
.afdl-montant-symbol {
    display:flex; align-items:center; justify-content:center;
    background:#E30613; color:#fff; font-size:22px; font-weight:700;
    padding:0 22px; border-radius:0 8px 8px 0; flex-shrink:0;
}

/* ── PRESETS ── */
.afdl-presets { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:20px; }
.afdl-preset {
    flex:1; min-width:70px; padding:11px 8px;
    border:2px solid #e0e0e0; border-radius:8px;
    background:#fff; color:#1d2130; font-size:13px; font-weight:700;
    cursor:pointer; text-align:center; transition:all .18s;
    font-family:'Work Sans',sans-serif; line-height:1.3;
}
.afdl-preset:hover { border-color:#274C5B; color:#274C5B; }
.afdl-preset.active { background:#E30613; border-color:#E30613; color:#fff; }

/* ── DÉDUCTION ── */
.afdl-deduction-preview {
    display:flex; align-items:center; justify-content:space-between;
    background:#fce6e7; border-radius:8px; padding:11px 15px;
    margin-bottom:22px; font-size:13px; color:#1d2130;
}
.afdl-deduction-preview strong { color:#E30613; font-size:15px; white-space:nowrap; }

/* ── GATEWAYS ── */
.afdl-section-label {
    font-size:12px; font-weight:700; color:#999; text-transform:uppercase;
    letter-spacing:.6px; margin-bottom:10px;
}
.afdl-gateways { display:flex; flex-direction:column; gap:8px; margin-bottom:20px; }
.afdl-gateway-item {
    display:flex; align-items:center; gap:12px;
    border:2px solid #e0e0e0; border-radius:8px; padding:12px 16px; cursor:pointer;
    transition:border-color .2s; font-family:'Work Sans',sans-serif;
}
.afdl-gateway-item:has(input:checked) { border-color:#274C5B; background:#f0f7fb; }
.afdl-gateway-item input { display:none; }
.afdl-gateway-label { font-size:14px; font-weight:600; color:#1d2130; }
.afdl-gateway-icon { font-size:18px; }

/* ── BOUTONS ── */
.afdl-btn-primary {
    display:block; width:100%; padding:15px;
    background:#E30613; color:#fff; border:none; border-radius:10px;
    font-size:16px; font-weight:800; cursor:pointer;
    font-family:'Work Sans',sans-serif; transition:all .2s; text-transform:uppercase;
}
.afdl-btn-primary:hover { background:#c00510; transform:translateY(-1px); }
.afdl-btn-primary:disabled { background:#ccc; transform:none; cursor:wait; }
.afdl-btn-secondary {
    display:block; width:100%; padding:12px;
    background:transparent; color:#274C5B; border:2px solid #274C5B; border-radius:10px;
    font-size:14px; font-weight:700; cursor:pointer;
    font-family:'Work Sans',sans-serif; transition:all .2s;
}
.afdl-btn-secondary:hover { background:#274C5B; color:#fff; }

/* ── STEP BACK ── */
.afdl-step-back { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.afdl-btn-back {
    background:none; border:none; color:#274C5B; font-size:13px; font-weight:600;
    cursor:pointer; padding:6px 0; font-family:'Work Sans',sans-serif;
}
.afdl-btn-back:hover { text-decoration:underline; }
.afdl-recap-montant { font-size:20px; font-weight:800; color:#E30613; }

/* ── CHAMPS ── */
.afdl-field { margin-bottom:14px; }
.afdl-field label { display:block; font-size:12px; font-weight:700; color:#555; margin-bottom:5px; }
.afdl-field label .req { color:#E30613; }
.afdl-input {
    width:100%; padding:11px 14px; box-sizing:border-box;
    border:1.5px solid #ddd; border-radius:8px;
    font-size:14px; font-family:'Work Sans',sans-serif; color:#1d2130;
    transition:border-color .2s; -webkit-appearance:none;
}
.afdl-input:focus { outline:none; border-color:#274C5B; }
.afdl-input.error { border-color:#E30613 !important; }

/* ── LIGNES ADRESSE ── */
.afdl-row-3,
.afdl-row-addr { display:flex; gap:12px; align-items:flex-end; }
.afdl-col-grow { flex:1; }

/* ── TOTAL BAR ── */
.afdl-total-bar {
    display:flex; align-items:center; justify-content:space-between;
    background:#274C5B; color:#fff; border-radius:10px;
    padding:15px 20px; margin:20px 0 16px;
}
.afdl-total-label { font-size:14px; font-weight:600; }
.afdl-total-montant { font-size:22px; font-weight:800; }

/* ── LEGAL ── */
.afdl-legal { text-align:center; font-size:11px; color:#999; margin-top:10px; }

/* ── RÉSULTAT ── */
.afdl-result { border-radius:8px; padding:14px 18px; font-size:14px; margin-bottom:16px; }
.afdl-result.error { background:#fce6e7; color:#E30613; border:1.5px solid #E30613; }
.afdl-result.success { background:#e8f5e9; color:#27ae60; border:1.5px solid #27ae60; }

/* ── SUCCÈS ── */
.afdl-success-step { text-align:center; padding:20px 0; }
.afdl-success-icon { font-size:60px; animation:afdlBounce .5s ease; }
.afdl-success-step h3 { font-size:22px; color:#274C5B; margin:10px 0 8px; }
.afdl-success-step .afdl-success-msg { font-size:14px; color:#555; margin-bottom:16px; line-height:1.6; }
.afdl-success-recap { background:#f8fbfc; border-radius:8px; padding:14px 18px; margin-bottom:20px; font-size:14px; color:#1d2130; text-align:left; }

/* ── ENTREPRISE TOGGLE ── */
.afdl-entreprise-toggle { margin-right:6px; }

/* ── ERREUR CODE POSTAL ── */
.afdl-cp-error { display:block; margin-top:4px; }

/* ── RESPONSIVE ── */
@media(max-width:480px){
    .afdl-popup-header { padding:16px 18px; }
    .afdl-popup-body { padding:18px; }
    .afdl-montant-editable { font-size:22px; }
    .afdl-row-3, .afdl-row-addr { flex-direction:column; gap:0; }
}
