/**
 * RGPD Styles — v2.0.0
 * Cohérent avec le thème GEMINI Pro
 *
 * CORRECTIONS v2.0.0 :
 * - Styles inline PHP supprimés → intégrés ici (footer btn, retractation)
 * - Nouveau : .rgpd-checkout-warning (bandeau jaune si RGPD non traité)
 * - Nouveau : .rgpd-checkout-error (erreur JS inline sur place_order)
 * - Nouveau : .rgpd-retractation-note (texte légal sous la CGV)
 * - Amélioration : animation footer btn
 *
 * @package GEMINI_Theme_Pro
 * @version 2.0.0
 */

/* ==========================================================================
   1. BANDEAU RGPD STICKY (top)
   ========================================================================== */

.rgpd-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1E40AF 0%, #2563EB 100%);
    color: white;
    padding: 16px 0;
    z-index: 10000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    animation: rgpdSlideDown 0.4s ease-out;
}

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

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

.rgpd-banner-text {
    flex: 1;
}

.rgpd-banner-text p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.rgpd-banner-text a {
    color: #DBEAFE;
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.rgpd-banner-text a:hover {
    color: white;
}

.rgpd-banner-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

/* ==========================================================================
   2. BOUTONS RGPD
   ========================================================================== */

.rgpd-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.4;
}

.rgpd-btn-primary {
    background: white;
    color: #2563EB;
}

.rgpd-btn-primary:hover {
    background: #F1F5F9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.rgpd-btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.rgpd-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.rgpd-btn-settings {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.rgpd-btn-settings:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

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

.rgpd-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

/* ==========================================================================
   3. MODAL DE PARAMÉTRAGE
   ========================================================================== */

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

.rgpd-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: rgpdFadeIn 0.3s ease;
}

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

.rgpd-modal-container {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: rgpdModalSlideUp 0.4s ease-out;
}

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

/* Header */
.rgpd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 2px solid #E2E8F0;
}

.rgpd-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1E293B;
    margin: 0;
}

.rgpd-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #64748B;
    transition: all 0.2s ease;
    border-radius: 6px;
    line-height: 1;
}

.rgpd-modal-close:hover {
    background: #F1F5F9;
    color: #1E293B;
}

.rgpd-modal-close:focus-visible {
    outline: 3px solid #2563EB;
    outline-offset: 2px;
}

/* Body */
.rgpd-modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.rgpd-modal-intro {
    font-size: 0.95rem;
    color: #64748B;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Catégories */
.rgpd-cookie-category {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.rgpd-cookie-category:hover {
    border-color: #CBD5E1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

.rgpd-category-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.rgpd-category-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1E293B;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rgpd-category-info h3 svg {
    color: #2563EB;
    flex-shrink: 0;
}

.rgpd-required-badge {
    background: #10B981;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.rgpd-category-description {
    font-size: 0.9rem;
    color: #64748B;
    line-height: 1.6;
    margin: 0;
}

/* Toggle Switch */
.rgpd-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

.rgpd-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

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

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

.rgpd-toggle input:checked + .rgpd-toggle-slider {
    background-color: #2563EB;
}

.rgpd-toggle input:checked + .rgpd-toggle-slider::before {
    transform: translateX(24px);
}

.rgpd-toggle input:focus-visible + .rgpd-toggle-slider {
    outline: 3px solid #2563EB;
    outline-offset: 2px;
}

.rgpd-toggle-disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.rgpd-toggle-disabled .rgpd-toggle-slider {
    cursor: not-allowed;
    background-color: #10B981;
}

/* Détails cookies */
.rgpd-cookie-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #E2E8F0;
}

.rgpd-cookie-details summary {
    font-weight: 600;
    color: #2563EB;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    list-style: none;
    padding: 2px 0;
}

.rgpd-cookie-details summary::-webkit-details-marker {
    display: none;
}

.rgpd-cookie-details summary::before {
    content: "▶ ";
    display: inline-block;
    transition: transform 0.2s;
    font-size: 0.75rem;
}

.rgpd-cookie-details[open] summary::before {
    transform: rotate(90deg);
}

.rgpd-cookie-details ul {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}

.rgpd-cookie-details li {
    padding: 8px 0;
    font-size: 0.85rem;
    color: #64748B;
    line-height: 1.5;
    border-bottom: 1px solid #F1F5F9;
}

.rgpd-cookie-details li:last-child {
    border-bottom: none;
}

.rgpd-cookie-details code {
    background: #1E293B;
    color: #DBEAFE;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
}

/* Liens légaux */
.rgpd-legal-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #E2E8F0;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.rgpd-legal-links a {
    color: #2563EB;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.rgpd-legal-links a:hover {
    color: #1E40AF;
    text-decoration: underline;
}

.rgpd-legal-links span {
    color: #CBD5E1;
}

/* Footer modal */
.rgpd-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 2px solid #E2E8F0;
    background: #F8FAFC;
    border-radius: 0 0 12px 12px;
}

/* ==========================================================================
   4. BOUTON FOOTER "GÉRER LES COOKIES"
   ──────────────────────────────────────────────────────────────────────────
   DÉPLACÉ depuis l'inline PHP (rgpd.php section 3).
   Visible uniquement après que le choix RGPD a été fait (géré par JS).
   ========================================================================== */

.rgpd-footer-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    /* display:none est géré par JS → ne pas mettre ici */
}

.rgpd-footer-btn {
    background: #2563EB;
    color: white;
    padding: 11px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.rgpd-footer-btn:hover {
    background: #1E40AF;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

.rgpd-footer-btn:focus-visible {
    outline: 3px solid #2563EB;
    outline-offset: 3px;
}

.rgpd-footer-btn svg {
    flex-shrink: 0;
}

/* ==========================================================================
   5. CHECKOUT — AVERTISSEMENT RGPD NON TRAITÉ
   ──────────────────────────────────────────────────────────────────────────
   Bandeau jaune affiché si l'utilisateur arrive sur le checkout
   sans avoir encore fait son choix RGPD. Non bloquant → il peut
   toujours naviguer mais la commande sera bloquée à la soumission.
   ========================================================================== */

.rgpd-checkout-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #FFFBEB;
    border: 2px solid #F59E0B;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 0 0 14px;
}

.rgpd-checkout-warning p {
    margin: 0;
    font-size: 0.88rem;
    color: #92400E;
    line-height: 1.55;
}

.rgpd-checkout-warning strong {
    font-weight: 700;
}

.rgpd-checkout-warning-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ==========================================================================
   6. CHECKOUT — MESSAGE D'ERREUR JS (inline, sans rechargement)
   ──────────────────────────────────────────────────────────────────────────
   Affiché par rgpd.js quand place_order est cliqué sans choix RGPD.
   ========================================================================== */

.rgpd-checkout-error {
    display: none; /* Contrôlé par JS */
    align-items: flex-start;
    gap: 10px;
    background: #FEF2F2;
    border: 2px solid #EF4444;
    border-left: 5px solid #DC2626;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 0 0 14px;
    font-size: 0.9rem;
    color: #991B1B;
    font-weight: 600;
    line-height: 1.5;
    animation: rgpdErrorShake 0.4s ease;
}

@keyframes rgpdErrorShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.rgpd-error-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
}

/* ==========================================================================
   7. CHECKOUT — NOTE LÉGALE RÉTRACTATION (sous la case CGV)
   ──────────────────────────────────────────────────────────────────────────
   DÉPLACÉ depuis l'inline PHP (rgpd.php section 4).
   Remplace l'ancienne .rgpd-retractation-wrapper (qui était une 2e checkbox).
   Désormais c'est un simple texte informatif sous la CGV.
   ========================================================================== */

.rgpd-retractation-note {
    margin: 8px 0 0;
    padding: 10px 14px;
    background: #F0FDF4;
    border-left: 4px solid #10B981;
    border-radius: 0 6px 6px 0;
    font-size: 0.82rem;
    color: #065F46;
    line-height: 1.55;
}

.rgpd-retractation-note strong {
    font-weight: 700;
}

/* ==========================================================================
   8. COMPENSATION HEADER STICKY QUAND BANDEAU AFFICHÉ
   ========================================================================== */

body.rgpd-banner-visible {
    padding-top: 80px;
    transition: padding-top 0.2s ease;
}

body.rgpd-banner-visible .site-header-premium {
    top: 80px;
    transition: top 0.2s ease;
}

/* ==========================================================================
   9. ANIMATIONS DE FERMETURE
   ========================================================================== */

.rgpd-banner.fade-out {
    animation: rgpdSlideUp 0.4s ease-out forwards;
}

@keyframes rgpdSlideUp {
    to { transform: translateY(-100%); opacity: 0; }
}

.rgpd-modal.fade-out .rgpd-modal-overlay {
    animation: rgpdFadeOut 0.3s ease forwards;
}

.rgpd-modal.fade-out .rgpd-modal-container {
    animation: rgpdModalSlideDown 0.4s ease-out forwards;
}

@keyframes rgpdFadeOut {
    to { opacity: 0; }
}

@keyframes rgpdModalSlideDown {
    to { transform: translateY(50px); opacity: 0; }
}

/* ==========================================================================
   10. RESPONSIVE — Mobile & Tablette
   ========================================================================== */

@media (max-width: 768px) {

    /* Bandeau */
    .rgpd-banner-content {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .rgpd-banner-text p {
        font-size: 0.85rem;
        text-align: center;
    }

    .rgpd-banner-actions {
        flex-direction: column;
        gap: 8px;
    }

    .rgpd-btn {
        width: 100%;
        padding: 12px 16px;
        text-align: center;
        justify-content: center;
    }

    body.rgpd-banner-visible {
        padding-top: 200px;
    }

    body.rgpd-banner-visible .site-header-premium {
        top: 200px;
    }

    /* Modal : slide depuis le bas sur mobile */
    .rgpd-modal {
        padding: 0;
        align-items: flex-end;
    }

    .rgpd-modal-container {
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        width: 100%;
    }

    .rgpd-modal-header {
        padding: 20px 18px;
    }

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

    .rgpd-modal-body {
        padding: 18px;
    }

    .rgpd-modal-footer {
        flex-direction: column;
        padding: 14px 18px 20px;
        gap: 10px;
    }

    .rgpd-modal-footer .rgpd-btn {
        width: 100%;
    }

    .rgpd-cookie-category {
        padding: 14px;
    }

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

    .rgpd-category-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .rgpd-legal-links {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .rgpd-legal-links span {
        display: none;
    }

    /* Footer btn */
    .rgpd-footer-link {
        bottom: 12px;
        right: 12px;
    }

    .rgpd-footer-btn {
        padding: 9px 14px;
        font-size: 0.82rem;
    }

    /* Checkout */
    .rgpd-checkout-warning,
    .rgpd-checkout-error {
        flex-direction: column;
        gap: 6px;
        padding: 12px 14px;
    }

    .rgpd-retractation-note {
        font-size: 0.8rem;
        padding: 9px 12px;
    }
}

@media (max-width: 480px) {
    .rgpd-modal-header h2 {
        font-size: 1.1rem;
    }

    .rgpd-banner-text p {
        font-size: 0.82rem;
    }
}

/* ==========================================================================
   11. PRINT — Masquer tous les éléments RGPD à l'impression
   ========================================================================== */

@media print {
    .rgpd-banner,
    .rgpd-modal,
    .rgpd-footer-link,
    .rgpd-checkout-warning,
    .rgpd-checkout-error {
        display: none !important;
    }
}