/**
 * ====================================================================
 * COOKIE CONSENT SYSTEM - 1 VIE, 2 CHIENS
 * ====================================================================
 * Système de gestion du consentement cookies conforme RGPD
 * Design personnalisé avec charte graphique du site
 * 
 * Couleurs:
 * - Marron principal: #8B6F47
 * - Vert foncé: #212C21
 * - Blanc: #FFFFFF
 * - Gris clair: #F8F9FA
 * ====================================================================
 */

/* ============================================================
   VARIABLES CSS
   ============================================================ */
   :root {
    --cookie-primary: #8B5A2B;      /* Marron principal */
    --cookie-secondary: #212C21;    /* Vert foncé */
    --cookie-white: #FFFFFF;
    --cookie-light-gray: #F8F9FA;
    --cookie-border: #DEE2E6;
    --cookie-success: #28A745;
    --cookie-danger: #DC3545;
    --cookie-shadow: rgba(0, 0, 0, 0.15);
    --cookie-overlay: rgba(33, 44, 33, 0.7);
}

/* ============================================================
   RESET ET GLOBALS
   ============================================================ */
.cookie-consent-banner *,
.cookie-consent-modal * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============================================================
   MINI-BANNIÈRE (BAS À GAUCHE) - MASQUÉE PAR DÉFAUT
   ============================================================ */
.cookie-consent-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    max-width: 420px;
    background: var(--cookie-white);
    border: 2px solid var(--cookie-primary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px var(--cookie-shadow);
    z-index: 9998;
    animation: slideInLeft 0.4s ease-out;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: none !important;
}

.cookie-consent-banner.hidden {
    display: none;
}

/* Titre de la bannière */
.cookie-consent-banner h3 {
    color: var(--cookie-secondary);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cookie-consent-banner h3::before {
    content: "🍪";
    font-size: 22px;
}

/* Texte de la bannière */
.cookie-consent-banner p {
    color: #495057;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.cookie-consent-banner a {
    color: var(--cookie-primary);
    text-decoration: underline;
    font-weight: 600;
}

.cookie-consent-banner a:hover {
    color: var(--cookie-secondary);
}

/* Conteneur des boutons */
.cookie-banner-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cookie-banner-buttons button {
    flex: 1;
    min-width: 120px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

/* Bouton "Tout accepter" */
.cookie-banner-buttons .btn-accept-all {
    background: var(--cookie-primary);
    color: var(--cookie-white);
}

.cookie-banner-buttons .btn-accept-all:hover {
    background: #6d563a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 111, 71, 0.3);
}

/* Bouton "Personnaliser" */
.cookie-banner-buttons .btn-customize {
    background: var(--cookie-white);
    color: var(--cookie-secondary);
    border: 2px solid var(--cookie-secondary);
}

.cookie-banner-buttons .btn-customize:hover {
    background: var(--cookie-secondary);
    color: var(--cookie-white);
    transform: translateY(-2px);
}

/* ============================================================
   MODAL COMPLET (CENTRÉ AVEC OVERLAY)
   ============================================================ */
.cookie-consent-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cookie-overlay);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.cookie-consent-overlay.hidden {
    display: none;
}

.cookie-consent-modal {
    background: var(--cookie-white);
    border-radius: 16px;
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.4s ease-out;
}

/* Header du modal */
.cookie-modal-header {
    background: linear-gradient(135deg, var(--cookie-primary), #6d563a);
    color: var(--cookie-white);
    padding: 24px;
    border-radius: 16px 16px 0 0;
    position: relative;
}

.cookie-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cookie-modal-header h2::before {
    content: "🔒";
    font-size: 28px;
}

/* Bouton de fermeture (X) */
.cookie-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--cookie-white);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
}

/* Body du modal */
.cookie-modal-body {
    padding: 24px;
}

/* Catégorie de cookies */
.cookie-category {
    background: var(--cookie-light-gray);
    border: 1px solid var(--cookie-border);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.cookie-category:hover {
    border-color: var(--cookie-primary);
    box-shadow: 0 2px 8px rgba(139, 111, 71, 0.1);
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 12px;
    flex-wrap: wrap;
}

.cookie-category-header .cookie-toggle {
    margin-left: auto;
}

.cookie-category-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--cookie-secondary);
}

.cookie-category-icon {
    font-size: 20px;
}

/* Description de la catégorie */
.cookie-category-description {
    color: #6C757D;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 8px;
}

/* Toggle Switch */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.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: #CED4DA;
    transition: 0.4s;
    border-radius: 28px;
}

.cookie-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

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

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

/* Toggle désactivé (pour cookies essentiels) */
.cookie-toggle input:disabled + .cookie-toggle-slider {
    background-color: var(--primary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.cookie-category.required {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.cookie-category.required .cookie-category-title {
    color: var(--cookie-primary);
}

/* Badge "Obligatoire" */
.cookie-badge-required {
    display: inline-block;
    background: var(--cookie-primary);
    color: var(--cookie-white);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Footer du modal */
.cookie-modal-footer {
    padding: 20px 24px;
    background: var(--cookie-light-gray);
    border-top: 1px solid var(--cookie-border);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    border-radius: 0 0 16px 16px;
}
.cookie-modal-footer button {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

/* Bouton "Tout refuser" */
.btn-reject-all {
    background: var(--cookie-white);
    color: var(--cookie-danger);
    border: 2px solid var(--cookie-danger);
}
.btn-reject-all:hover {
    background: var(--cookie-danger);
    color: var(--cookie-white);
    transform: translateY(-2px);
}

/* ============================================================
   BOUTON "GÉRER LES COOKIES" (FOOTER SITE)
   ============================================================ */
.manage-cookies-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--cookie-primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.manage-cookies-link:hover {
    background: var(--cookie-light-gray);
    color: var(--cookie-secondary);
}

.manage-cookies-link::before {
    content: "⚙️";
    font-size: 16px;
}

/* ============================================================
   BOUTON COOKIE DOG (FOOTER)
   ============================================================ */
.cookie-dog-button {
    display: block !important;
    padding: 0 !important;
    border-radius: 50%;
    transition: transform 0.3s ease, filter 0.3s ease;
    cursor: pointer;
    margin: 0 auto !important;
    width: 70px;
    text-align: center;
}

.cookie-dog-button::before {
    content: none !important;
    display: none !important;
}

/* Supprimer l'engrenage quand c'est le cookie-dog-button */
.manage-cookies-link.cookie-dog-button::before {
    content: none !important;
    display: none !important;
}

.cookie-dog-button img {
    display: block;
    border-radius: 50%;
    transition: transform 0.3s ease;
    margin: 0 auto;
    width: 70px;
    height: 70px;
}

.cookie-dog-button:hover {
    background: transparent !important;
    transform: scale(1.1);
}

.cookie-dog-button:hover img {
    transform: rotate(10deg);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */
@media (max-width: 768px) {
    /* Bannière mobile */
    .cookie-consent-banner {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        bottom: 16px;
        max-width: 420px;
        width: calc(100% - 32px);
        padding: 16px;
    }

    .cookie-consent-banner h3 {
        font-size: 17px;
        gap: 6px;
    }

    .cookie-consent-banner h3::before {
        font-size: 20px;
    }

    .cookie-consent-banner p {
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 12px;
    }

    .cookie-banner-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .cookie-banner-buttons button {
        width: 100%;
        min-width: 0;
        padding: 12px 14px;
    }

    /* Modal mobile */
    .cookie-consent-modal {
        max-height: 95vh;
        margin: 10px;
    }

    .cookie-modal-header h2 {
        font-size: 20px;
    }

    .cookie-modal-close {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
    }

    .cookie-modal-footer {
        flex-direction: column;
    }

    .cookie-modal-footer button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .cookie-consent-banner {
        padding: 14px;
        border-radius: 14px;
    }

    .cookie-consent-banner h3 {
        font-size: 16px;
        gap: 4px;
    }

    .cookie-consent-banner h3::before {
        font-size: 18px;
    }

    .cookie-consent-banner p {
        font-size: 13px;
    }

    .cookie-banner-buttons button {
        font-size: 13px;
        padding: 11px 12px;
    }

    .cookie-category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .cookie-category-header .cookie-toggle {
        margin-left: 0;
    }

    .cookie-category-title {
        font-size: 14px;
    }

    .cookie-category-description {
        font-size: 12px;
    }
}

/* ============================================================
   SCROLLBAR PERSONNALISÉE (MODAL)
   ============================================================ */
.cookie-consent-modal::-webkit-scrollbar {
    width: 8px;
}

.cookie-consent-modal::-webkit-scrollbar-track {
    background: var(--cookie-light-gray);
}

.cookie-consent-modal::-webkit-scrollbar-thumb {
    background: var(--cookie-primary);
    border-radius: 4px;
}

.cookie-consent-modal::-webkit-scrollbar-thumb:hover {
    background: #6d563a;
}

/* ============================================================
   ACCESSIBILITÉ
   ============================================================ */
.cookie-consent-banner:focus-within,
.cookie-consent-modal:focus-within {
    outline: 3px solid var(--cookie-primary);
    outline-offset: 2px;
}

button:focus-visible {
    outline: 3px solid var(--cookie-primary);
    outline-offset: 2px;
}

/* Mode sombre (optionnel, préparé pour futur) */
@media (prefers-color-scheme: dark) {
    /* À implémenter si besoin d'un mode sombre */
}