/* ===================================
   SYSTÈME DE GESTION DES COOKIES RGPD
   MotoWest - 2025
   =================================== */

/* Variables CSS pour faciliter la personnalisation */
:root {
    --cookie-primary: #2c3e50;
    --cookie-secondary: #34495e;
    --cookie-accent: #3498db;
    --cookie-success: #27ae60;
    --cookie-text: #2c3e50;
    --cookie-text-light: #7f8c8d;
    --cookie-bg: #ffffff;
    --cookie-bg-overlay: rgba(0, 0, 0, 0.7);
    --cookie-border: #e0e0e0;
    --cookie-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --cookie-radius: 8px;
    --cookie-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================
   BANDEAU COOKIES
   ================== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--cookie-bg);
    box-shadow: var(--cookie-shadow);
    z-index: 9999;
    padding: 20px;
    border-top: 3px solid var(--cookie-accent);
    animation: slideUp 0.4s ease-out;
}

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

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

.cookie-banner-text h2 {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    color: var(--cookie-text);
    font-weight: 600;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--cookie-text-light);
    line-height: 1.5;
}

.cookie-banner-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* ==================
   BOUTONS
   ================== */

.cookie-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--cookie-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--cookie-transition);
    white-space: nowrap;
}

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

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

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

.cookie-btn-primary:hover {
    background: #2980b9;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.cookie-btn-secondary {
    background: var(--cookie-secondary);
    color: white;
}

.cookie-btn-secondary:hover {
    background: #2c3e50;
}

.cookie-btn-tertiary {
    background: #95a5a6;
    color: white;
}

.cookie-btn-tertiary:hover {
    background: #7f8c8d;
}

.cookie-link {
    color: var(--cookie-accent);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid transparent;
    transition: var(--cookie-transition);
}

.cookie-link:hover {
    border-bottom-color: var(--cookie-accent);
}

.cookie-link:focus {
    outline: 2px solid var(--cookie-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ==================
   MODAL
   ================== */

.cookie-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cookie-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cookie-bg-overlay);
    animation: fadeIn 0.3s ease-out;
}

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

.cookie-modal-content {
    position: relative;
    background: var(--cookie-bg);
    border-radius: var(--cookie-radius);
    max-width: 800px;
    max-height: 90vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--cookie-shadow);
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.cookie-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--cookie-border);
}

.cookie-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--cookie-text);
}

.cookie-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--cookie-text-light);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--cookie-transition);
}

.cookie-modal-close:hover {
    background: #f5f5f5;
    color: var(--cookie-text);
}

.cookie-modal-close:focus {
    outline: 2px solid var(--cookie-accent);
    outline-offset: 2px;
}

.cookie-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.cookie-modal-intro {
    margin: 0 0 24px 0;
    color: var(--cookie-text-light);
    line-height: 1.6;
}

/* ==================
   CATÉGORIES DE COOKIES
   ================== */

.cookie-category {
    margin-bottom: 24px;
    padding: 20px;
    border: 1px solid var(--cookie-border);
    border-radius: var(--cookie-radius);
    background: #fafafa;
}

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

.cookie-category-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cookie-category-title h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--cookie-text);
}

.cookie-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.cookie-badge-always {
    background: var(--cookie-success);
    color: white;
}

.cookie-category-description {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--cookie-text-light);
    line-height: 1.6;
}

/* ==================
   TOGGLE SWITCH
   ================== */

.cookie-toggle {
    position: relative;
}

.cookie-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-toggle-label {
    display: block;
    width: 52px;
    height: 28px;
    background: #ccc;
    border-radius: 34px;
    cursor: pointer;
    position: relative;
    transition: var(--cookie-transition);
}

.cookie-toggle-label:hover {
    background: #b0b0b0;
}

.cookie-checkbox:checked + .cookie-toggle-label {
    background: var(--cookie-success);
}

.cookie-checkbox:disabled + .cookie-toggle-label {
    cursor: not-allowed;
    opacity: 0.6;
}

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

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

.cookie-checkbox:focus + .cookie-toggle-label {
    outline: 2px solid var(--cookie-accent);
    outline-offset: 2px;
}

/* ==================
   DÉTAILS DES COOKIES
   ================== */

.cookie-details-toggle {
    background: none;
    border: none;
    color: var(--cookie-accent);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--cookie-transition);
}

.cookie-details-toggle:hover {
    color: #2980b9;
}

.cookie-details-toggle:focus {
    outline: 2px solid var(--cookie-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.cookie-details-toggle .arrow {
    transition: transform 0.3s ease;
}

.cookie-details-toggle[aria-expanded="true"] .arrow {
    transform: rotate(180deg);
}

.cookie-details {
    margin-top: 12px;
    animation: slideDown 0.3s ease-out;
}

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

.cookie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: white;
    border-radius: var(--cookie-radius);
    overflow: hidden;
}

.cookie-table th {
    background: var(--cookie-secondary);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.cookie-table td {
    padding: 12px;
    border-bottom: 1px solid var(--cookie-border);
}

.cookie-table tr:last-child td {
    border-bottom: none;
}

.cookie-table tr:nth-child(even) {
    background: #f9f9f9;
}

/* ==================
   FOOTER MODAL
   ================== */

.cookie-modal-footer {
    display: flex;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid var(--cookie-border);
    background: #fafafa;
}

/* ==================
   RESPONSIVE
   ================== */

@media (max-width: 768px) {
    .cookie-banner-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .cookie-banner-buttons {
        width: 100%;
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        text-align: center;
    }

    .cookie-link {
        text-align: center;
        display: block;
        padding: 8px 0;
    }

    .cookie-modal-content {
        max-height: 95vh;
    }

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

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

    .cookie-table {
        font-size: 0.75rem;
    }

    .cookie-table th,
    .cookie-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .cookie-banner {
        padding: 16px;
    }

    .cookie-banner-text h2 {
        font-size: 1.1rem;
    }

    .cookie-banner-text p {
        font-size: 0.9rem;
    }

    .cookie-modal-header,
    .cookie-modal-body,
    .cookie-modal-footer {
        padding: 16px;
    }

    .cookie-modal-header h2 {
        font-size: 1.2rem;
    }

    .cookie-table {
        display: block;
        overflow-x: auto;
    }
}

/* ==================
   ACCESSIBILITÉ
   ================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    .cookie-banner {
        border-top-width: 5px;
    }

    .cookie-btn:focus,
    .cookie-link:focus,
    .cookie-toggle-label:focus {
        outline-width: 3px;
    }
}

/* ==================
   UTILITIES
   ================== */

.cookie-hidden {
    display: none !important;
}

.cookie-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

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