/* ═══════════════════════════════════════════════════════════
   MODAL COMMANDE WHATSAPP — LeMarchand.CI
   Design "pro" : carte blanche, coins arrondis, ombre douce,
   CTA vert WhatsApp, cohérent avec les variables --lm2-* du thème.
═══════════════════════════════════════════════════════════ */

:root{
    --lmw-blue:#1858D8;
    --lmw-blue-dark:#123F9E;
    --lmw-blue-light:#EAF1FF;
    --lmw-dark:#0f172a;
    --lmw-gray:#64748b;
    --lmw-border:#E5E7EB;
    --lmw-bg:#f8fafc;
    --lmw-green:#25d366;
    --lmw-green-dark:#128c7e;
    --lmw-radius:18px;
    --lmw-shadow:0 8px 30px rgba(15,23,42,.10), 0 2px 8px rgba(15,23,42,.06);
}

/* ── Reset bouton (le bouton "Commander via WhatsApp" fiche produit est un <button>) ── */
.lm-whatsapp-btn{ border:none !important; width:100% !important; cursor:pointer !important; font-family:inherit !important; }

/* ── Bouton flottant WhatsApp ── */
.lmw-float-btn{
    position:fixed; right:20px; bottom:88px; z-index:940; /* sous la tabbar (950) : ne bloque jamais ses taps */
    width:56px; height:56px; border-radius:50%;
    background:linear-gradient(135deg,var(--lmw-green),var(--lmw-green-dark));
    color:#fff; display:flex; align-items:center; justify-content:center;
    box-shadow:0 6px 20px rgba(37,211,102,.4);
    border:none; cursor:pointer; transition:transform .2s, box-shadow .2s;
}
.lmw-float-btn:hover{ transform:translateY(-2px); box-shadow:0 10px 28px rgba(37,211,102,.5); }
.lmw-float-badge{
    position:absolute; top:-4px; right:-4px; background:#ef4444; color:#fff;
    font-size:10px; font-weight:800; min-width:18px; height:18px; border-radius:50%;
    display:flex; align-items:center; justify-content:center; border:2px solid #fff; padding:0 3px;
}
/* Sur mobile, la tabbar fixe (footer.php, ~60px + zone tactile) occupe le bas de l'écran.
   On pousse le bouton nettement au-dessus, en tenant compte de l'encoche iOS (safe-area). */
@media(max-width:600px){
    .lmw-float-btn{
        bottom: calc(66px + env(safe-area-inset-bottom, 0px) + 14px);
        right:14px; width:50px; height:50px;
    }
}

/* ── Overlay ── */
.lmw-overlay{
    position:fixed; inset:0; background:rgba(15,23,42,.55);
    backdrop-filter:blur(2px);
    display:none; align-items:flex-end; justify-content:center;
    z-index:2000; opacity:0; transition:opacity .25s;
}
.lmw-overlay.active{ display:flex; opacity:1; }
@media(min-width:661px){ .lmw-overlay{ align-items:center; } }

/* ── Carte modal ── */
.lmw-modal{
    background:#fff; width:100%; max-width:480px;
    max-height:92vh; overflow-y:auto;
    border-radius:var(--lmw-radius) var(--lmw-radius) 0 0;
    box-shadow:var(--lmw-shadow);
    transform:translateY(24px); transition:transform .28s cubic-bezier(.22,1,.36,1);
    font-family:'Inter','Plus Jakarta Sans',sans-serif;
}
.lmw-overlay.active .lmw-modal{ transform:translateY(0); }
@media(min-width:661px){
    .lmw-modal{ border-radius:var(--lmw-radius); max-height:88vh; }
}

/* ── Header modal ── */
.lmw-head{
    display:flex; align-items:center; justify-content:space-between;
    padding:18px 20px; border-bottom:1px solid var(--lmw-border);
    position:sticky; top:0; background:#fff; z-index:5;
    border-radius:var(--lmw-radius) var(--lmw-radius) 0 0;
}
.lmw-head h3{ margin:0; font-size:16px; font-weight:800; color:var(--lmw-dark); display:flex; align-items:center; gap:8px; }
.lmw-close{
    width:32px; height:32px; border-radius:50%; border:none; background:var(--lmw-bg);
    color:var(--lmw-gray); font-size:16px; cursor:pointer; display:flex; align-items:center; justify-content:center;
    transition:background .2s;
}
.lmw-close:hover{ background:#e2e8f0; }

/* ── Corps ── */
.lmw-body{ padding:18px 20px 6px; }
.lmw-section{ margin-bottom:18px; }
.lmw-label{
    display:block; font-size:11px; font-weight:700; text-transform:uppercase;
    letter-spacing:.5px; color:var(--lmw-gray); margin-bottom:6px;
}
.lmw-grid2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.lmw-input, .lmw-textarea{
    width:100%; border:1.5px solid var(--lmw-border); border-radius:10px;
    padding:11px 13px; font-size:14px; font-family:inherit; color:var(--lmw-dark);
    background:var(--lmw-bg); outline:none; transition:border-color .18s, box-shadow .18s, background .18s;
}
.lmw-input:focus, .lmw-textarea:focus{
    border-color:var(--lmw-blue); background:#fff; box-shadow:0 0 0 3px rgba(24,88,216,.12);
}
.lmw-textarea{ resize:vertical; min-height:68px; }
.lmw-input.lmw-error, .lmw-textarea.lmw-error{ border-color:#ef4444 !important; box-shadow:0 0 0 3px rgba(239,68,68,.1) !important; }

/* ── Ville : chips ── */
.lmw-chips{ display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.lmw-chip{
    padding:5px 12px; border-radius:20px; font-size:11px; font-weight:700;
    border:1.5px solid var(--lmw-border); background:var(--lmw-bg); color:var(--lmw-gray);
    cursor:pointer; transition:all .18s; user-select:none;
}
.lmw-chip:hover{ border-color:var(--lmw-blue); color:var(--lmw-blue); }
.lmw-chip.selected{ border-color:var(--lmw-blue); background:var(--lmw-blue); color:#fff; }

/* ── Livraison ── */
.lmw-ship-box{
    display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
    background:var(--lmw-bg); border:1.5px solid var(--lmw-border); border-radius:12px; padding:12px 14px; margin-top:4px;
}
.lmw-ship-label{ font-size:12.5px; font-weight:600; color:var(--lmw-dark); }
.lmw-ship-label small{ display:block; font-size:10.5px; color:var(--lmw-gray); font-weight:400; margin-top:1px; }
.lmw-ship-cost{ font-size:14px; font-weight:800; color:var(--lmw-dark); white-space:nowrap; }
.lmw-muted{ color:var(--lmw-gray) !important; font-style:italic; font-weight:400 !important; font-size:12px !important; }

/* ── Paiement ── */
.lmw-pay-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.lmw-pay-option{ cursor:pointer; }
.lmw-pay-option input{ position:absolute; opacity:0; width:0; height:0; }
.lmw-pay-card{
    display:flex; flex-direction:column; align-items:center; gap:4px; padding:12px 8px;
    border:1.5px solid var(--lmw-border); border-radius:12px; background:var(--lmw-bg); text-align:center; transition:all .18s;
}
.lmw-pay-option input:checked ~ .lmw-pay-card{
    border-color:var(--lmw-blue); background:var(--lmw-blue-light); box-shadow:0 0 0 3px rgba(24,88,216,.1);
}
.lmw-pay-icon{ font-size:22px; line-height:1; }
.lmw-pay-name{ font-size:12px; font-weight:700; color:var(--lmw-dark); }
.lmw-pay-sub{ font-size:10px; color:var(--lmw-gray); }

/* ── Récap panier ── */
.lmw-cart-list{ display:flex; flex-direction:column; }
.lmw-cart-row{ display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--lmw-border); }
.lmw-cart-row:last-child{ border-bottom:none; }
.lmw-cart-thumb{ width:42px; height:42px; object-fit:cover; border-radius:8px; border:1px solid var(--lmw-border); background:var(--lmw-bg); flex-shrink:0; }
.lmw-cart-name{ font-size:12.5px; font-weight:600; color:var(--lmw-dark); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lmw-cart-qty{ font-size:11px; color:var(--lmw-gray); margin-top:1px; }
.lmw-cart-price{ font-size:12.5px; font-weight:700; color:var(--lmw-blue); white-space:nowrap; flex-shrink:0; margin-left:auto; }
.lmw-cart-empty{ text-align:center; padding:24px 0; color:var(--lmw-gray); font-size:13px; }

.lmw-totals{ border-top:1px solid var(--lmw-border); margin-top:8px; padding-top:10px; }
.lmw-total-row{ display:flex; justify-content:space-between; font-size:12.5px; color:var(--lmw-gray); padding:3px 0; }
.lmw-total-row b{ color:var(--lmw-dark); }
.lmw-grand{ display:flex; justify-content:space-between; align-items:center; padding-top:8px; margin-top:4px; border-top:2px solid var(--lmw-dark); }
.lmw-grand span:first-child{ font-size:13px; font-weight:700; color:var(--lmw-dark); }
.lmw-grand span:last-child{ font-size:19px; font-weight:800; color:var(--lmw-blue); }

/* ── Erreur / validation ── */
.lmw-alert{
    display:none; background:#fef2f2; border:1px solid #fecaca; border-radius:10px;
    padding:10px 13px; font-size:12px; color:#b91c1c; margin:0 20px 12px; line-height:1.5;
}
.lmw-alert.visible{ display:block; }

/* ── Footer / CTA ── */
.lmw-footer{ padding:14px 20px 20px; position:sticky; bottom:0; background:#fff; }
.lmw-cta{
    width:100%; background:linear-gradient(135deg,var(--lmw-green),var(--lmw-green-dark));
    color:#fff; border:none; border-radius:13px; padding:15px 18px; font-size:15px; font-weight:800;
    font-family:inherit; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:9px;
    box-shadow:0 4px 18px rgba(37,211,102,.35); transition:transform .18s, box-shadow .18s, opacity .18s;
}
.lmw-cta:hover{ transform:translateY(-1px); box-shadow:0 8px 24px rgba(37,211,102,.45); }
.lmw-cta:disabled{ opacity:.6; cursor:not-allowed; transform:none; }
.lmw-secure{ text-align:center; font-size:11px; color:var(--lmw-gray); margin-top:10px; }

@keyframes lmw-spin{ to{ transform:rotate(360deg); } }
.lmw-spinner{ width:16px; height:16px; border-radius:50%; border:2px solid rgba(255,255,255,.35); border-top-color:#fff; animation:lmw-spin .7s linear infinite; }

/* ── Body scroll lock ── */
body.lmw-modal-open{ overflow:hidden; }
