/* Cookie consent — Amiantix (public site) */

#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    display: none;
    background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.45);
    padding: 20px 22px 22px;
    font-family: Inter, system-ui, sans-serif;
    color: #e2e8f0;
    animation: cookieSlideUp 0.32s ease;
}

#cookie-banner.is-visible {
    display: block;
}

@keyframes cookieSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-banner__inner {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px 28px;
    align-items: start;
}

.cookie-banner__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #34d399;
    margin-bottom: 8px;
}

.cookie-banner__title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.02em;
}

.cookie-banner__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
    color: #94a3b8;
    max-width: 640px;
}

.cookie-banner__text strong {
    color: #cbd5e1;
    font-weight: 600;
}

.cookie-banner__links {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    font-size: 12px;
    font-weight: 600;
}

.cookie-banner__links a {
    color: #34d399;
    text-decoration: none;
    border-bottom: 1px solid rgba(52, 211, 153, 0.35);
    padding-bottom: 1px;
}

.cookie-banner__links a:hover {
    color: #6ee7b7;
    border-bottom-color: rgba(110, 231, 183, 0.55);
}

.cookie-banner__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.cookie-btn {
    font-size: 13px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    padding: 11px 16px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
    font-family: inherit;
    box-sizing: border-box;
    max-width: 100%;
}

.cookie-btn:active {
    transform: scale(0.99);
}

.cookie-btn--primary {
    background: #10b981;
    color: #022c22;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.cookie-btn--primary:hover {
    background: #34d399;
}

.cookie-btn--secondary {
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
    border: 1px solid #334155;
}

.cookie-btn--secondary:hover {
    border-color: #475569;
    color: #f8fafc;
}

.cookie-btn--ghost {
    background: transparent;
    color: #64748b;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 12px;
    padding: 8px 10px;
}

.cookie-btn--ghost:hover {
    color: #94a3b8;
}

/* Preferences dialog */

#cookie-prefs {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(4px);
}

#cookie-prefs.is-open {
    display: flex;
}

.cookie-prefs__dialog {
    width: min(520px, calc(100vw - 40px));
    max-width: calc(100vw - 40px);
    min-width: 0;
    max-height: min(88vh, 640px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 10px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    box-sizing: border-box;
}

.cookie-prefs__head {
    padding: 18px 20px 14px;
    border-bottom: 1px solid #1e293b;
}

.cookie-prefs__head .cookie-prefs__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
}

.cookie-prefs__head p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #64748b;
}

.cookie-prefs__body {
    padding: 16px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.cookie-prefs__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #1e293b;
}

.cookie-prefs__row:last-of-type {
    border-bottom: none;
}

.cookie-prefs__row h3 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
    color: #e2e8f0;
}

.cookie-prefs__row p {
    margin: 0;
    font-size: 12px;
    line-height: 1.55;
    color: #64748b;
}

.cookie-prefs__tag {
    display: inline-block;
    margin-top: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #34d399;
}

.cookie-switch {
    position: relative;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-switch__ui {
    position: absolute;
    inset: 0;
    background: #334155;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s;
}

.cookie-switch__ui::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #f8fafc;
    border-radius: 50%;
    transition: transform 0.2s;
}

.cookie-switch input:checked + .cookie-switch__ui {
    background: #059669;
}

.cookie-switch input:checked + .cookie-switch__ui::after {
    transform: translateX(18px);
}

.cookie-switch input:disabled + .cookie-switch__ui {
    opacity: 0.45;
    cursor: not-allowed;
}

.cookie-prefs__foot {
    padding: 14px 20px 18px;
    border-top: 1px solid #1e293b;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    min-width: 0;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .cookie-banner__inner {
        grid-template-columns: 1fr;
    }

    .cookie-banner__actions {
        flex-direction: column;
        flex-wrap: nowrap;
        min-width: 0;
        width: 100%;
    }

    .cookie-banner__actions .cookie-btn {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        min-height: 48px;
    }

    .cookie-banner__title {
        font-size: 16px;
    }

    .cookie-banner__text {
        font-size: 14px;
    }
}

/* Étroit / tablette : modale cookies sans débordement (pied en colonne) */
@media (max-width: 960px) {
    #cookie-prefs {
        padding: 16px;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .cookie-prefs__dialog {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .cookie-prefs__head {
        padding: 16px 16px 12px;
    }

    .cookie-prefs__head .cookie-prefs__title {
        font-size: 17px;
        line-height: 1.25;
    }

    .cookie-prefs__head p {
        font-size: 14px;
        line-height: 1.55;
        color: #94a3b8;
    }

    .cookie-prefs__body {
        padding: 12px 16px;
    }

    .cookie-prefs__row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px 0;
    }

    .cookie-prefs__row h3 {
        font-size: 15px;
    }

    .cookie-prefs__row p {
        font-size: 13px;
        line-height: 1.55;
    }

    .cookie-switch {
        align-self: flex-start;
    }

    .cookie-prefs__foot {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: stretch;
        gap: 10px;
        padding: 12px 16px 16px;
    }

    .cookie-prefs__foot .cookie-btn {
        width: 100%;
        max-width: 100%;
        min-height: 48px;
        font-size: 14px;
        white-space: normal;
        line-height: 1.25;
        padding: 12px 14px;
    }

    .cookie-prefs__foot .cookie-btn--ghost {
        order: -1;
        width: auto;
        align-self: flex-start;
        min-height: 0;
        padding: 6px 0;
        margin-bottom: 2px;
    }

    .cookie-prefs__foot .cookie-btn--primary {
        order: 1;
    }
}

/* Très petit écran : feuille bas de page + encoches */
@media (max-width: 640px) {
    #cookie-banner {
        padding: 16px 14px calc(18px + env(safe-area-inset-bottom, 0px));
    }

    #cookie-prefs {
        padding: 0;
        align-items: flex-end;
        justify-content: center;
        background: rgba(2, 6, 23, 0.78);
    }

    .cookie-prefs__dialog {
        max-height: min(92dvh, 900px);
        border-radius: 16px 16px 0 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }

    .cookie-prefs__foot {
        padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    }
}
