/* ============================================================
   COOKIE CONSENT BANNER — MyRH France
   Conforme RGPD / Recommandations CNIL
   ============================================================ */

/* ---------- Overlay (modal personnalisation) ---------- */
.cookie-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99998;
    backdrop-filter: blur(3px);
    animation: cookieFadeIn 0.25s ease;
}
.cookie-overlay.active { display: block; }

/* ---------- Bannière principale (bas de page) ---------- */
#cookie-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #ffffff;
    border-top: 3px solid #8000ff;
    box-shadow: 0 -4px 30px rgba(128, 0, 255, 0.15);
    padding: 20px 32px;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    animation: cookieSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#cookie-banner.visible { display: block; }

.cookie-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.cookie-banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
    color: #8000ff;
}

.cookie-banner-text {
    flex: 1;
    min-width: 240px;
}
.cookie-banner-text h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
    color: #1e1e2e;
}
.cookie-banner-text p {
    margin: 0;
    font-size: 0.82rem;
    color: #5c5c7a;
    line-height: 1.5;
}
.cookie-banner-text a {
    color: #8000ff;
    text-decoration: underline;
    font-weight: 500;
}
.cookie-banner-text a:hover { color: #6000cc; }

/* ---------- Boutons bannière ---------- */
.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 9px 20px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
}

.cookie-btn-accept {
    background: #8000ff;
    color: #ffffff;
    border-color: #8000ff;
}
.cookie-btn-accept:hover {
    background: #6000cc;
    border-color: #6000cc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(128, 0, 255, 0.35);
}

.cookie-btn-refuse {
    background: transparent;
    color: #5c5c7a;
    border-color: #d0d0e0;
}
.cookie-btn-refuse:hover {
    background: #f6f5ff;
    border-color: #8000ff;
    color: #8000ff;
    transform: translateY(-1px);
}

.cookie-btn-customize {
    background: transparent;
    color: #8000ff;
    border-color: #8000ff;
}
.cookie-btn-customize:hover {
    background: #f6f5ff;
    transform: translateY(-1px);
}

/* ---------- Modal personnalisation ---------- */
.cookie-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100000;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(128, 0, 255, 0.2), 0 4px 16px rgba(0,0,0,0.12);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    animation: cookieModalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.cookie-modal.active { display: block; }

.cookie-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #f0eaff;
    display: flex;
    align-items: center;
    gap: 12px;
}
.cookie-modal-header i {
    font-size: 1.4rem;
    color: #8000ff;
}
.cookie-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e1e2e;
}

.cookie-modal-body {
    padding: 16px 24px;
}

/* ---------- Catégories de cookies ---------- */
.cookie-category {
    padding: 14px 0;
    border-bottom: 1px solid #f0eaff;
}
.cookie-category:last-child { border-bottom: none; }

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

.cookie-category-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #1e1e2e;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cookie-category-title i { color: #8000ff; font-size: 0.85rem; }

.cookie-category-desc {
    font-size: 0.78rem;
    color: #5c5c7a;
    line-height: 1.5;
    margin: 0;
}

/* Badge "Toujours actif" */
.cookie-badge-required {
    font-size: 0.7rem;
    font-weight: 600;
    color: #28a745;
    background: #e8f5e9;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Toggle switch */
.cookie-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.cookie-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d0d0e0;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.25s ease;
}
.cookie-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.cookie-toggle input:checked + .cookie-toggle-slider { background: #8000ff; }
.cookie-toggle input:checked + .cookie-toggle-slider::before { transform: translateX(20px); }
.cookie-toggle input:disabled + .cookie-toggle-slider { opacity: 0.5; cursor: not-allowed; }

/* ---------- Footer modal ---------- */
.cookie-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ---------- Bouton flottant "Mes préférences" ---------- */
#cookie-preferences-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9990;
    background: #ffffff;
    color: #8000ff;
    border: 2px solid #8000ff;
    border-radius: 50px;
    padding: 8px 14px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(128, 0, 255, 0.18);
    transition: all 0.2s ease;
    gap: 6px;
    align-items: center;
}
#cookie-preferences-btn.visible { display: flex; }
#cookie-preferences-btn:hover {
    background: #8000ff;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(128, 0, 255, 0.3);
}

/* ---------- Animations ---------- */
@keyframes cookieSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes cookieFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes cookieModalIn {
    from { transform: translate(-50%, -48%); opacity: 0; }
    to   { transform: translate(-50%, -50%); opacity: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    #cookie-banner { padding: 16px 16px 20px; }
    .cookie-banner-inner { gap: 14px; }
    .cookie-banner-icon { display: none; }
    .cookie-banner-actions { width: 100%; }
    .cookie-btn { flex: 1; text-align: center; padding: 10px 12px; font-size: 0.8rem; }
    .cookie-modal { width: 95%; }
    .cookie-modal-footer { justify-content: stretch; }
    .cookie-modal-footer .cookie-btn { flex: 1; text-align: center; }
}
