/**
 * Styles pour le gestionnaire de cookies
 * Design moderne et accessible
 */

/* Bandeau de cookies */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    animation: slideUp 0.3s ease-out;
}

.cookie-banner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.cookie-banner-content {
    position: relative;
    background: var(--bg-card, #1a1a2e);
    border-top: 3px solid var(--primary, #8b5cf6);
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.cookie-banner-header h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    color: var(--text-primary, #ffffff);
}

.cookie-banner-body {
    margin-bottom: 1.5rem;
    color: var(--text-secondary, #a0a0a0);
    line-height: 1.6;
}

.cookie-banner-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.cookie-banner-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accept-all {
    background: linear-gradient(135deg, var(--primary, #8b5cf6), var(--accent, #ec4899));
    color: white;
}

.btn-accept-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-reject-all {
    background: var(--bg-secondary, #2a2a3e);
    color: var(--text-primary, #ffffff);
    border: 2px solid var(--border, #3a3a4e);
}

.btn-reject-all:hover {
    background: var(--bg-tertiary, #3a3a4e);
}

.btn-customize {
    background: transparent;
    color: #a78bfa;
    border: 2px solid #a78bfa;
    min-height: 44px;
    min-width: 44px;
}

.btn-customize:hover {
    background: rgba(167, 139, 250, 0.15);
}

/* Modal de paramètres */
#cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.cookie-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.cookie-modal-content {
    position: relative;
    background: var(--bg-card, #1a1a2e);
    border: 2px solid var(--border, #3a3a4e);
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease-out;
}

.cookie-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border, #3a3a4e);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary, #a0a0a0);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #ffffff);
}

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

.cookie-category {
    background: var(--bg-secondary, #2a2a3e);
    border: 2px solid var(--border, #3a3a4e);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cookie-category-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--text-primary, #ffffff);
}

.cookie-category-header p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary, #a0a0a0);
}

.cookie-category-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border, #3a3a4e);
}

.cookie-category-details ul {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-secondary, #a0a0a0);
    font-size: 0.9rem;
    line-height: 1.8;
}

/* Switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    flex-shrink: 0;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary, #3a3a4e);
    transition: 0.3s;
    border-radius: 34px;
    border: 2px solid var(--border, #4a4a5e);
}

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

input:checked + .slider {
    background: linear-gradient(135deg, var(--primary, #8b5cf6), var(--accent, #ec4899));
    border-color: var(--primary, #8b5cf6);
}

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

.switch.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.switch.disabled .slider {
    cursor: not-allowed;
}

/* Footer du modal */
.cookie-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 2px solid var(--border, #3a3a4e);
    display: flex;
    gap: 1rem;
    background: var(--bg-secondary, #2a2a3e);
}

.cookie-modal-footer button {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save {
    background: linear-gradient(135deg, var(--primary, #8b5cf6), var(--accent, #ec4899));
    color: white;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-cancel {
    background: transparent;
    color: var(--text-secondary, #a0a0a0);
    border: 2px solid var(--border, #3a3a4e);
}

.btn-cancel:hover {
    background: var(--bg-tertiary, #3a3a4e);
    color: var(--text-primary, #ffffff);
}

/* Notifications */
.cookie-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card, #1a1a2e);
    border: 2px solid var(--border, #3a3a4e);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10002;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease-out;
}

.cookie-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.cookie-notification.success {
    border-color: #10b981;
}

.cookie-notification.info {
    border-color: var(--primary, #8b5cf6);
}

.cookie-notification button {
    background: none;
    border: none;
    color: var(--text-secondary, #a0a0a0);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.cookie-notification button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #ffffff);
}

/* Animations */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .cookie-banner-content {
        padding: 1.5rem;
    }

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

    .cookie-banner-actions button {
        width: 100%;
    }

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

    .cookie-modal-header,
    .cookie-modal-body,
    .cookie-modal-footer {
        padding: 1rem;
    }

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

    .cookie-category {
        padding: 1rem;
    }

    .cookie-category-header {
        flex-direction: column;
    }

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

    .cookie-notification {
        right: 10px;
        left: 10px;
        top: 10px;
    }
}

/* 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-content,
    .cookie-modal-content,
    .cookie-category {
        border-width: 3px;
    }

    .slider {
        border-width: 3px;
    }
}


/* Styles détaillés pour le modal enrichi */
.cookie-intro {
    background: rgba(139, 92, 246, 0.05);
    border-left: 4px solid var(--primary, #8b5cf6);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.cookie-category-info {
    flex: 1;
}

.cookie-category-desc {
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary, #a0a0a0);
    line-height: 1.6;
}

.cookie-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cookie-badge.required {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.cookie-badge.optional {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary, #8b5cf6);
    border: 1px solid var(--primary, #8b5cf6);
}

.cookie-details-toggle {
    width: 100%;
    background: var(--bg-tertiary, #3a3a4e);
    border: none;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    border-radius: 8px;
    color: var(--text-primary, #ffffff);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.cookie-details-toggle:hover {
    background: var(--bg-card, #2a2a3e);
}

.toggle-icon {
    transition: transform 0.3s;
}

.cookie-category.expanded .toggle-icon {
    transform: rotate(180deg);
}

.cookie-category.expanded .toggle-text::after {
    content: ' les détails';
}

.cookie-category:not(.expanded) .toggle-text::after {
    content: ' les détails';
}

.cookie-category-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.cookie-category.expanded .cookie-category-details {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
}

.cookie-table {
    margin-top: 1rem;
}

.cookie-item {
    background: var(--bg-tertiary, #3a3a4e);
    border: 1px solid var(--border, #4a4a5e);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.cookie-item:last-child {
    margin-bottom: 0;
}

.cookie-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border, #4a4a5e);
}

.cookie-name strong {
    color: var(--primary, #8b5cf6);
    font-size: 1rem;
}

.cookie-type {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-secondary, #a0a0a0);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.cookie-info {
    font-size: 0.9rem;
    line-height: 1.6;
}

.cookie-info p {
    margin: 0.5rem 0;
    color: var(--text-secondary, #a0a0a0);
}

.cookie-info strong {
    color: var(--text-primary, #ffffff);
}

.cookie-info a {
    color: var(--primary, #8b5cf6);
    text-decoration: underline;
}

.cookie-info a:hover {
    color: var(--accent, #ec4899);
}

.cookie-analytics-info {
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid var(--border, #4a4a5e);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.cookie-analytics-info h4 {
    margin: 0 0 0.75rem 0;
    color: var(--text-primary, #ffffff);
    font-size: 1rem;
}

.cookie-analytics-info ul {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-secondary, #a0a0a0);
    line-height: 1.8;
}

.cookie-footer-info {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    border: 2px solid var(--border, #3a3a4e);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.cookie-footer-info p {
    margin: 0 0 0.75rem 0;
    color: var(--text-primary, #ffffff);
    font-weight: 600;
}

.cookie-footer-info ul {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-secondary, #a0a0a0);
    line-height: 1.8;
}

.cookie-footer-info li {
    margin: 0.5rem 0;
}

/* Boutons supplémentaires dans le footer du modal */
.btn-accept-all-modal,
.btn-reject-all-modal {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accept-all-modal {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-accept-all-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-reject-all-modal {
    background: var(--bg-tertiary, #3a3a4e);
    color: var(--text-secondary, #a0a0a0);
    border: 2px solid var(--border, #3a3a4e);
}

.btn-reject-all-modal:hover {
    background: var(--bg-secondary, #2a2a3e);
    color: var(--text-primary, #ffffff);
}

/* Ajustements responsive pour le contenu détaillé */
@media (max-width: 768px) {
    .cookie-modal-body {
        padding: 1rem;
    }

    .cookie-intro {
        padding: 0.75rem 1rem;
    }

    .cookie-category {
        padding: 1rem;
    }

    .cookie-item {
        padding: 0.75rem;
    }

    .cookie-name {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .cookie-info {
        font-size: 0.85rem;
    }

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

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

    .cookie-analytics-info {
        padding: 0.75rem;
    }

    .cookie-footer-info {
        padding: 1rem;
    }
}

/* Animation pour l'expansion des détails */
@keyframes expandDetails {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cookie-category.expanded .cookie-table {
    animation: expandDetails 0.3s ease-out;
}

/* Amélioration du scroll dans le modal */
.cookie-modal-body::-webkit-scrollbar {
    width: 8px;
}

.cookie-modal-body::-webkit-scrollbar-track {
    background: var(--bg-secondary, #2a2a3e);
    border-radius: 4px;
}

.cookie-modal-body::-webkit-scrollbar-thumb {
    background: var(--primary, #8b5cf6);
    border-radius: 4px;
}

.cookie-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent, #ec4899);
}

/* Highlight pour les liens externes */
.cookie-info a[target="_blank"]::after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.7;
}
