/**
 * Styles pour le système de gestion des cookies RGPD
 * Bannière de consentement et modal de préférences
 */

/* Bannière de cookies */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1f1814 0%, #8d5b3b 100%);
    color: white;
    padding: 1.5rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    border-top: 2px solid rgba(199, 128, 87, 0.55);
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.cookie-banner-text h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(251, 247, 241, 0.82);
    max-width: 600px;
}

.cookie-banner-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Boutons de cookies */
.btn-cookie {
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    white-space: nowrap;
}

.btn-refuse {
    background: #fbf7f1;
    color: #211d1a;
    border-color: #fbf7f1;
    box-shadow: 0 10px 20px rgba(22, 18, 15, 0.14);
}

.btn-refuse:hover {
    background: #fffdf8;
    color: #211d1a;
    border-color: #fffdf8;
    transform: translateY(-1px);
}

.btn-customize {
    background: rgba(255, 255, 255, 0.08);
    color: #fbf7f1;
    border-color: rgba(255, 255, 255, 0.22);
}

.btn-customize:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.32);
    transform: translateY(-1px);
}

.btn-accept {
    background: #211d1a;
    color: white;
    border-color: #211d1a;
}

.btn-accept:hover {
    background: #7b3d22;
    border-color: #7b3d22;
    transform: translateY(-1px);
}

.btn-save {
    background: #7b3d22;
    color: white;
    border: 1px solid #7b3d22;
}

.btn-save:hover {
    background: #aa5a33;
    border-color: #aa5a33;
    transform: translateY(-1px);
}

/* Modal de préférences */
.cookie-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cookie-modal.show {
    opacity: 1;
    visibility: visible;
}

.cookie-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(19, 15, 12, 0.5);
}

.cookie-modal-content {
    position: relative;
    background: #fbf7f1;
    border-radius: 20px;
    box-shadow: 0 24px 56px rgba(22, 18, 15, 0.18);
    border: 1px solid rgba(123, 61, 34, 0.08);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.cookie-modal.show .cookie-modal-content {
    transform: scale(1);
}

.cookie-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(123, 61, 34, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8efe3 0%, #f3e7d8 100%);
}

.cookie-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #211d1a;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #655c54;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: rgba(123, 61, 34, 0.08);
    color: #211d1a;
}

.cookie-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.cookie-modal-body > p {
    margin: 0 0 1.5rem 0;
    color: #655c54;
    line-height: 1.6;
}

.cookie-categories {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Catégories de cookies */
.cookie-category {
    border: 1px solid rgba(123, 61, 34, 0.1);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.2s ease;
    background: rgba(255, 252, 247, 0.72);
}

.cookie-category:hover {
    border-color: rgba(170, 90, 51, 0.24);
    box-shadow: 0 8px 20px rgba(22, 18, 15, 0.06);
}

.category-header {
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: rgba(255, 252, 247, 0.72);
}

.category-info {
    flex: 1;
}

.category-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #211d1a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-info p {
    margin: 0 0 0.75rem 0;
    color: #655c54;
    font-size: 0.9rem;
    line-height: 1.5;
}

.required-label {
    background: #fbbf24;
    color: #92400e;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

/* Switch toggle */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-top: 2px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d9cec3;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background-color: #10b981;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

input:disabled + .slider {
    background-color: #10b981;
    opacity: 0.6;
    cursor: not-allowed;
}

input:disabled + .slider:before {
    transform: translateX(26px);
}

/* Détails des cookies */
details {
    margin-top: 0.5rem;
}

summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: #7b3d22;
    font-weight: 500;
    padding: 0.25rem 0;
    border-radius: 4px;
    transition: color 0.2s ease;
}

summary:hover {
    color: #aa5a33;
}

details ul {
    margin: 0.5rem 0 0 0;
    padding: 0;
    list-style: none;
    background: #f3eadf;
    border-radius: 4px;
    padding: 0.75rem;
}

details li {
    margin: 0.25rem 0;
    font-size: 0.8rem;
}

details code {
    background: #eadfd2;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #211d1a;
}

.cookie-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(123, 61, 34, 0.1);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    background: #f6eee4;
    flex-wrap: wrap;
}

/* Lien de gestion des préférences */
#cookie-preferences-link {
    font-size: 0.85rem;
    color: #7b3d22 !important;
    text-decoration: underline;
    transition: color 0.2s ease;
}

#cookie-preferences-link:hover {
    color: #aa5a33 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .cookie-banner {
        padding: 1rem;
    }
    
    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .cookie-banner-actions {
        justify-content: center;
        width: 100%;
    }
    
    .btn-cookie {
        flex: 1;
        min-width: auto;
    }
    
    .cookie-modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .cookie-modal-header,
    .cookie-modal-body,
    .cookie-modal-footer {
        padding: 1rem;
    }
    
    .category-header {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .cookie-modal-footer {
        flex-direction: column;
    }
    
    .btn-cookie {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .cookie-banner-actions {
        flex-direction: column;
    }
    
    .cookie-modal-header h2 {
        font-size: 1.1rem;
    }
    
    .cookie-banner-text h3 {
        font-size: 1rem;
    }
    
    .category-info h4 {
        font-size: 0.9rem;
    }
}

/* Animation de chargement */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cookie-category {
    animation: fadeInUp 0.3s ease forwards;
}

.cookie-category:nth-child(2) { animation-delay: 0.1s; }
.cookie-category:nth-child(3) { animation-delay: 0.2s; }
.cookie-category:nth-child(4) { animation-delay: 0.3s; }

/* Focus et accessibilité */
.btn-cookie:focus,
.close-modal:focus,
summary:focus {
    outline: 2px solid #aa5a33;
    outline-offset: 2px;
}

.cookie-switch input:focus + .slider {
    box-shadow: 0 0 0 2px rgba(170, 90, 51, 0.45);
}

/* États de hover améliorés */
.btn-cookie:active {
    transform: translateY(0);
}

.cookie-category:hover .category-info h4 {
    color: #aa5a33;
}

/* Indicateur de cookies bloqués */
.cookies-blocked-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fbbf24;
    color: #92400e;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
    z-index: 9999;
    animation: fadeInUp 0.3s ease;
}

/* Style pour les cookies expirés */
.consent-expired {
    border-left: 4px solid #f59e0b;
    background: #fef3c7;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 6px 6px 0;
}

.consent-expired p {
    margin: 0;
    color: #92400e;
    font-size: 0.9rem;
}