/**
 * Cookie Consent Banner - Premium Design
 * Intégration harmonieuse avec thomas-gauriat-avocat.fr
 * Conforme RGPD - Sans dark patterns
 */

/* ============================================
   VARIABLES - Reprend la charte graphique
   ============================================ */
:root {
    --cookie-primary: #0A192F;      /* Bleu marine du site */
    --cookie-accent: #C5A879;       /* Or/Beige du site */
    --cookie-text: #333;            /* Texte principal */
    --cookie-light-text: #666;      /* Texte secondaire */
    --cookie-bg: #ffffff;           /* Fond blanc */
    --cookie-overlay: rgba(0, 0, 0, 0.02); /* Overlay très subtil */
    --cookie-border: rgba(10, 25, 47, 0.1); /* Bordure subtile */
    --cookie-shadow: 0 8px 32px rgba(10, 25, 47, 0.12); /* Ombre premium */
    --cookie-shadow-hover: 0 12px 48px rgba(10, 25, 47, 0.18);
    --cookie-border-radius: 8px;    /* Border radius du site */
    --cookie-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --cookie-font: 'Libre Baskerville', serif; /* Police du site */
}

/* ============================================
   BANNIÈRE PRINCIPALE
   ============================================ */
#cookie-consent-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 420px;
    width: calc(100% - 48px);
    background: var(--cookie-bg);
    border-radius: var(--cookie-border-radius);
    box-shadow: var(--cookie-shadow);
    padding: 28px;
    z-index: 9999;
    font-family: var(--cookie-font);
    transform: translateY(120%);
    opacity: 0;
    transition: var(--cookie-transition);
    backdrop-filter: blur(8px);
    border: 1px solid var(--cookie-border);
}

/* Animation d'apparition douce */
#cookie-consent-banner.show {
    transform: translateY(0);
    opacity: 1;
    animation: slideInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInUp {
    from {
        transform: translateY(120%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Effet de flottement subtil */
#cookie-consent-banner.show {
    animation: slideInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1),
               float 6s ease-in-out 0.5s infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ============================================
   EN-TÊTE AVEC ICÔNE
   ============================================ */
.cookie-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.cookie-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    opacity: 0.9;
}

.cookie-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--cookie-primary);
    margin: 0;
    line-height: 1.3;
    font-family: var(--cookie-font);
}

/* ============================================
   CONTENU TEXTUEL
   ============================================ */
.cookie-description {
    font-size: 14px;
    line-height: 1.65;
    color: var(--cookie-light-text);
    margin: 0 0 20px 0;
}

.cookie-description a {
    color: var(--cookie-accent);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: var(--cookie-transition);
}

.cookie-description a:hover {
    color: var(--cookie-primary);
    border-bottom-color: var(--cookie-accent);
}

/* ============================================
   BOUTONS D'ACTION
   ============================================ */
.cookie-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.cookie-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--cookie-font);
    cursor: pointer;
    transition: var(--cookie-transition);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cookie-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.cookie-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* Bouton principal - Accepter */
.cookie-btn-accept {
    background: var(--cookie-accent);
    color: var(--cookie-primary);
    box-shadow: 0 2px 8px rgba(197, 168, 121, 0.25);
}

.cookie-btn-accept:hover {
    background: var(--cookie-primary);
    color: #fff;
    box-shadow: 0 4px 16px rgba(10, 25, 47, 0.3);
    transform: translateY(-2px);
}

.cookie-btn-accept:focus {
    outline: 3px solid var(--cookie-accent);
    outline-offset: 2px;
}

/* Boutons secondaires */
.cookie-secondary-actions {
    display: flex;
    gap: 10px;
}

/* Masquer les boutons secondaires quand le panneau de préférences est ouvert */
#cookie-consent-banner.preferences-open .cookie-secondary-actions {
    display: none;
}

.cookie-btn-refuse,
.cookie-btn-customize {
    flex: 1;
    background: transparent;
    color: var(--cookie-primary);
    border: 2px solid var(--cookie-border);
    padding: 10px 16px;
}

.cookie-btn-refuse:hover,
.cookie-btn-customize:hover {
    background: var(--cookie-primary);
    color: #fff;
    border-color: var(--cookie-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(10, 25, 47, 0.15);
}

.cookie-btn-refuse:focus,
.cookie-btn-customize:focus {
    outline: 3px solid var(--cookie-accent);
    outline-offset: 2px;
}

/* ============================================
   PANNEAU DE PERSONNALISATION
   ============================================ */
.cookie-preferences {
    display: none;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--cookie-border);
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-preferences.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cookie-preference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(10, 25, 47, 0.05);
}

.cookie-preference-item:last-child {
    border-bottom: none;
}

.cookie-preference-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--cookie-primary);
    font-family: var(--cookie-font);
}

.cookie-preference-info p {
    margin: 0;
    font-size: 12px;
    color: var(--cookie-light-text);
    line-height: 1.5;
}

/* ============================================
   TOGGLE SWITCH PREMIUM
   ============================================ */
.cookie-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e0e0e0;
    transition: var(--cookie-transition);
    border-radius: 26px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cookie-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--cookie-transition);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background-color: var(--cookie-accent);
}

.cookie-toggle input:checked + .cookie-toggle-slider:before {
    transform: translateX(22px);
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.cookie-toggle input:focus + .cookie-toggle-slider {
    box-shadow: 0 0 0 3px rgba(197, 168, 121, 0.3);
}

/* ============================================
   BOUTONS DU PANNEAU DE PERSONNALISATION
   ============================================ */
.cookie-preferences-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.cookie-btn-save,
.cookie-btn-cancel {
    flex: 1;
}

.cookie-btn-save {
    background: var(--cookie-accent);
    color: var(--cookie-primary);
}

.cookie-btn-save:hover {
    background: var(--cookie-primary);
    color: #fff;
}

.cookie-btn-cancel {
    background: transparent;
    color: var(--cookie-primary);
    border: 2px solid var(--cookie-border);
}

.cookie-btn-cancel:hover {
    background: #f5f5f5;
    border-color: var(--cookie-primary);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    #cookie-consent-banner {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
        width: auto;
        padding: 24px;
    }

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

    .cookie-description {
        font-size: 13px;
    }

    .cookie-secondary-actions {
        flex-direction: column;
    }

    .cookie-btn-refuse,
    .cookie-btn-customize {
        width: 100%;
    }
}

@media (max-width: 480px) {
    #cookie-consent-banner {
        bottom: 12px;
        right: 12px;
        left: 12px;
        padding: 20px;
    }

    .cookie-header {
        gap: 10px;
    }

    .cookie-icon {
        width: 24px;
        height: 24px;
    }

    .cookie-title {
        font-size: 15px;
    }

    .cookie-description {
        font-size: 12px;
        margin-bottom: 16px;
    }

    .cookie-btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    .cookie-preference-info h4 {
        font-size: 13px;
    }

    .cookie-preference-info p {
        font-size: 11px;
    }
}

/* ============================================
   ANIMATIONS DE MICROINTERACTIONS
   ============================================ */
.cookie-btn:active {
    transform: scale(0.98);
}

.cookie-toggle-slider {
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    animation: pulseGold 0.4s ease;
}

@keyframes pulseGold {
    0%, 100% { box-shadow: 0 0 0 0 rgba(197, 168, 121, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(197, 168, 121, 0); }
}

/* ============================================
   ACCESSIBILITÉ - FOCUS VISIBLE
   ============================================ */
.cookie-btn:focus-visible,
.cookie-toggle input:focus-visible + .cookie-toggle-slider {
    outline: 3px solid var(--cookie-accent);
    outline-offset: 3px;
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    #cookie-consent-banner {
        border: 2px solid var(--cookie-primary);
    }

    .cookie-btn {
        border: 2px solid currentColor;
    }
}

/* Réduction des animations */
@media (prefers-reduced-motion: reduce) {
    #cookie-consent-banner,
    .cookie-btn,
    .cookie-toggle-slider,
    .cookie-toggle-slider:before {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================
   PRINT - Masquer le bandeau à l'impression
   ============================================ */
@media print {
    #cookie-consent-banner {
        display: none !important;
    }
}
