/**
 * COOKIE BANNER & MODAL - Styles RGPD
 * KIREVA INVEST - Design moderne et accessible
 */

/* ========================================
   BANDEAU COOKIE (bas de page)
   ======================================== */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(30, 41, 59, 0.98), rgba(30, 41, 59, 0.95));
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 -4px 20px rgba(0, 0, 0, 0.15),
        0 -1px 0 rgba(255, 255, 255, 0.05) inset;
    z-index: 99999;
    display: none;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    padding: clamp(1.25rem, 3vw, 1.75rem) 0;
}

.cookie-banner.show {
    opacity: 1;
    transform: translateY(0);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: clamp(1rem, 2vw, 1.5rem);
    align-items: center;
}

/* Icône cookie */
.cookie-icon {
    font-size: 2rem;
    color: #fbbf24;
    flex-shrink: 0;
}

/* Texte du bandeau */
.cookie-text {
    color: white;
}

.cookie-text h4 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.375rem 0;
    color: white;
}

.cookie-text p {
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

/* Boutons d'action */
.cookie-actions {
    display: flex;
    gap: 0.625rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Styles de base pour tous les boutons de cookies */
.btn-cookie {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    cursor: pointer;
    border: none;
}

/* Bouton primaire "Tout accepter" */
.btn-cookie-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-cookie-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Bouton secondaire "Refuser l'analyse" */
.btn-cookie-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.btn-cookie-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Bouton ghost "Personnaliser" */
.btn-cookie-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 0.625rem 0.875rem;
}

.btn-cookie-ghost:hover {
    color: white;
    text-decoration: underline;
}

/* ========================================
   MODAL DE PRÉFÉRENCES - HARMONISÉE AVEC LE SITE
   ======================================== */

.cookie-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: none !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
    overflow-y: auto;
}

.cookie-modal-overlay.show {
    display: flex !important;
    opacity: 1;
}

.cookie-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.25);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    margin: auto;
    position: relative;
}

.cookie-modal-overlay.show .cookie-modal {
    transform: scale(1);
}

/* Header modal - harmonisé avec les modales du site */
.cookie-modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cookie-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cookie-modal-header h3 i {
    color: #3b82f6;
    font-size: 1.1em;
}

.cookie-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.cookie-modal-close:hover {
    background: #f1f5f9;
    color: #475569;
    transform: scale(1.1);
}

/* Body modal */
.cookie-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

/* Catégorie de cookies - harmonisée */
.cookie-category {
    background: #fafbfc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
}

.cookie-category:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.cookie-category:last-child {
    margin-bottom: 0;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.category-header .category-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.category-header h4 i,
.category-header .category-info i {
    color: #3b82f6;
    font-size: 1.1em;
}

/* Badge "Toujours actif" */
.always-active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .slider {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.toggle input:checked + .slider:before {
    transform: translateX(22px);
}

/* Description catégorie */
.cookie-category p {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.cookie-category small {
    display: block;
    margin-top: 0.5rem;
    color: #3b82f6;
    font-weight: 500;
}

/* Footer modal - harmonisé */
.cookie-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.cookie-modal-footer .btn-cookie {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.cookie-modal-footer .btn-cookie-secondary {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.cookie-modal-footer .btn-cookie-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.cookie-modal-footer .btn-cookie-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.cookie-modal-footer .btn-cookie-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

/* ========================================
   NOTIFICATIONS
   ======================================== */

.cookie-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 100001;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 300px;
    max-width: 400px;
}

.cookie-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.cookie-notification-content {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.cookie-notification-content i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.cookie-notification-success {
    border-left: 4px solid #10b981;
}

.cookie-notification-success i {
    color: #10b981;
}

.cookie-notification-info {
    border-left: 4px solid #3b82f6;
}

.cookie-notification-info i {
    color: #3b82f6;
}

.cookie-notification-content span {
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Bandeau cookie */
    .cookie-content {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }

    .cookie-icon {
        display: none; /* Masquer icône sur mobile pour gagner de la place */
    }

    .cookie-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.625rem !important;
        width: 100% !important;
    }

    /* Les 2 boutons principaux sur la même ligne - 50% chacun */
    .cookie-actions .btn-cookie-primary,
    .cookie-actions .btn-cookie-secondary {
        flex: 1 1 calc(50% - 0.3125rem) !important;
        min-width: 0 !important;
        max-width: calc(50% - 0.3125rem) !important;
    }

    /* Bouton "Personnaliser" sur une ligne séparée, centré, largeur complète */
    .cookie-actions .btn-cookie-ghost {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        text-align: center !important;
    }

    /* Modal */
    .cookie-modal {
        width: 95%;
        max-height: 90vh;
    }

    .cookie-modal-header,
    .cookie-modal-body,
    .cookie-modal-footer {
        padding: 1.25rem;
    }

    .cookie-modal-footer {
        flex-direction: column;
    }

    .cookie-modal-footer .btn {
        width: 100%;
    }

    /* Notification */
    .cookie-notification {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .cookie-text h4 {
        font-size: 0.9375rem;
    }

    .cookie-text p {
        font-size: 0.8125rem;
    }

    /* Ajustements pour très petits écrans - boutons principaux */
    .cookie-actions .btn-cookie-primary,
    .cookie-actions .btn-cookie-secondary {
        padding: 0.5rem 0.625rem !important;
        font-size: 0.8125rem !important;
    }

    /* Bouton personnaliser */
    .cookie-actions .btn-cookie-ghost {
        padding: 0.5rem 0.875rem !important;
        font-size: 0.8125rem !important;
    }

    /* Réduire les icônes pour gagner de l'espace */
    .cookie-actions .btn-cookie-primary i,
    .cookie-actions .btn-cookie-ghost i {
        font-size: 0.875em !important;
    }
}
