/* Crépy Auto Services — Popup Annonces v5.2 */

.cas-overlay {
    display: none; /* JS gère l'affichage via .show() */
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    transition: opacity .3s ease;
}
/* Quand JS ajoute display:flex via .show() */
.cas-overlay[style*="display: flex"],
.cas-overlay[style*="display:flex"] {
    display: flex !important;
}
.cas-overlay.active {
    opacity: 1;
}

/* Container */
.cas-popup {
    position: relative;
    width: 100%;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0,0,0,.35);
    overflow: hidden;
    margin: auto;
    transform: translateY(40px);
    transition: transform .4s cubic-bezier(.22,1,.36,1);
}
.cas-overlay.active .cas-popup  { transform: translateY(0); }
.cas-popup.fadeInDown            { transform: translateY(-40px); }
.cas-popup.zoomIn                { transform: scale(.5); }
.cas-overlay.active .cas-popup.zoomIn { transform: scale(1); }

/* Barre top */
.cas-topbar { height: 4px; width: 100%; }

/* Bouton fermer */
.cas-close {
    position: absolute !important; top: 13px !important; right: 13px !important; left: auto !important;
    width: 36px !important; height: 36px !important; min-width: 0 !important; border: none !important;
    background: #d91415 !important; border-radius: 50% !important;
    font-size: 1rem !important; line-height: 1 !important; cursor: pointer;
    display: grid !important; place-items: center !important; padding: 0 !important; margin: 0 !important;
    z-index: 10; color: #fff !important; box-shadow: 0 2px 8px rgba(0,0,0,.25) !important;
    transition: background .2s !important;
}
.cas-close:hover, .cas-close:focus, .cas-close:active {
    background: #b30f10 !important; color: #fff !important;
    transform: none !important; opacity: 1 !important; outline: none !important;
}

/* Image */
.cas-img-wrap { width: 100%; overflow: hidden; background: #f5f5f5; }
.cas-img { width: 100%; height: auto; max-height: 300px; object-fit: cover; display: block; }

/* Header */
.cas-header { padding: 26px 26px 12px; text-align: center; position: relative; }
.cas-header::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 54px; height: 4px; border-radius: 2px;
    background: linear-gradient(90deg, #d91415, #16181d);
}
.cas-icon { font-size: 40px; display: inline-block; margin-bottom: 8px; animation: casFloat 3s ease-in-out infinite; }
@keyframes casFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
.cas-title { font-size: 1.45rem; font-weight: 700; color: #d91415; margin: 0; line-height: 1.3; }

/* Body */
.cas-body { padding: 0 26px 22px; text-align: center; }
.cas-message { font-size: .94rem; line-height: 1.7; color: #555; margin-bottom: 18px; }
.cas-message p { margin: 0 0 8px; }
.cas-message p:last-child { margin-bottom: 0; }

.cas-btn {
    display: inline-block; padding: 12px 28px;
    font-size: .93rem; font-weight: 700; border-radius: 50px;
    border: none; cursor: pointer; text-decoration: none;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    transition: transform .2s, box-shadow .2s;
}
.cas-btn:hover { transform: translateY(-2px); box-shadow: 0 7px 20px rgba(0,0,0,.25); }

/* Slides */
.cas-slide { display: none; }
.cas-slide.active { display: block; animation: casIn .32s ease; }
@keyframes casIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }

/* Navigation */
.cas-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; background: rgba(255,255,255,.88);
    border: 1px solid rgba(0,0,0,.08); border-radius: 50%;
    font-size: .9rem; cursor: pointer; display: grid; place-items: center;
    z-index: 5; box-shadow: 0 2px 8px rgba(0,0,0,.1);
    transition: background .2s;
}
.cas-nav:hover { background: #fff; }
.cas-prev { left: 8px; }
.cas-next { right: 8px; }

/* Points */
.cas-dots { display: flex; justify-content: center; gap: 7px; padding: 8px 0 4px; }
.cas-dot { width: 10px; height: 10px; border-radius: 50%; border: none; cursor: pointer; padding: 0; transition: transform .2s, background .25s; }
.cas-dot.active { transform: scale(1.4); }

/* Compteur */
.cas-counter { text-align: center; font-size: .73rem; font-weight: 700; letter-spacing: .05em; margin: 0 0 14px; opacity: .7; }

/* Responsive */
@media(max-width:560px) {
    .cas-overlay { padding: 10px; }
    .cas-popup { border-radius: 14px; }
    .cas-header { padding: 20px 14px 10px; }
    .cas-body { padding: 0 14px 18px; }
    .cas-title { font-size: 1.15rem; }
    .cas-btn { width: 100%; padding: 11px 20px; font-size: .88rem; }
    .cas-nav { width: 26px; height: 26px; font-size: .8rem; }
}
@media(prefers-reduced-motion:reduce) {
    .cas-overlay,.cas-popup { transition: none; }
    .cas-icon { animation: none; }
    .cas-slide.active { animation: none; }
}
@media print { .cas-overlay { display: none !important; } }
