/* =====================================================
   Click & Dine – Modal Styles
   width/height/border-radius/background du panel et
   du backdrop sont injectés en inline style par PHP
   ===================================================== */

/* ── Button (structure only — couleurs/taille via inline style PHP) ── */
.cad-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

/* Default hover (overridden per-button via <style> tag if hover colours are set) */
.cad-open-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.cad-open-btn:active {
    transform: translateY(0);
    filter: brightness(0.96);
}

.cad-open-btn svg { flex-shrink: 0; }

.cad-full-width { display: flex; }
.cad-full-width .cad-open-btn { width: 100%; justify-content: center; }

/* ── Modal overlay ── */
.cad-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}
.cad-modal.is-open { display: flex; }

/* Backdrop — background injected via inline style */
.cad-modal__backdrop {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: cad-fade-in 0.25s ease forwards;
    cursor: pointer;
}

/* Panel — width/height/border-radius injected via inline style */
.cad-modal__panel {
    position: relative;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    animation: cad-slide-up 0.3s cubic-bezier(0.34, 1.28, 0.64, 1) forwards;
    z-index: 1;
}

/* Close button — simple, no animation */
.cad-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.cad-modal__close:hover { background: #f5f5f5; color: #111; }

/* Iframe */
.cad-modal__iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    display: block;
}

/* Loader */
.cad-modal__loader {
    position: absolute;
    inset: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}
.cad-modal__loader.is-hidden { opacity: 0; pointer-events: none; }

.cad-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8e0d6;
    border-top-color: #c8a96e;
    border-radius: 50%;
    animation: cad-spin 0.8s linear infinite;
}

/* ── Animations ── */
@keyframes cad-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes cad-spin     { to { transform: rotate(360deg); } }
@keyframes cad-slide-up {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.cad-modal.is-closing .cad-modal__backdrop { animation: cad-fade-out  0.22s ease forwards; }
.cad-modal.is-closing .cad-modal__panel    { animation: cad-slide-down 0.22s ease forwards; }

@keyframes cad-fade-out   { to { opacity: 0; } }
@keyframes cad-slide-down { to { opacity: 0; transform: translateY(16px) scale(0.97); } }

body.cad-modal-open { overflow: hidden; }

/* ── Mobile ── */
@media (max-width: 600px) {
    .cad-modal { align-items: flex-end; }

    .cad-modal__panel {
        /* Override PHP inline width/height on mobile */
        width: 100vw !important;
        height: 92svh !important;
        border-radius: 20px 20px 0 0 !important;
        animation: cad-slide-up-mobile 0.3s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
    }

    @keyframes cad-slide-up-mobile {
        from { opacity: 0; transform: translateY(100%); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .cad-modal.is-closing .cad-modal__panel {
        animation: cad-slide-down-mobile 0.22s ease forwards;
    }

    @keyframes cad-slide-down-mobile {
        to { opacity: 0; transform: translateY(100%); }
    }
}
