/**
 * Swim Smart - Feuille de style partagée
 * Contient uniquement ce qui ne peut pas etre fait en classes Tailwind :
 * anti-Astra, animations, scrollbar, locked-cards, systeme de roles CSS.
 */

/* =============================================================================
   BOUCLIER ANTI-ASTRA
   Force le fond sombre sur tous les conteneurs Astra/WordPress
   ============================================================================= */

html, body,
#page, .site,
#content, .site-content,
.ast-container, .ast-plain-container,
.ast-page-builder-template .site-content {
    background-color: #263238 !important;
    background-image: none !important;
    color: #ECEFF1 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

h1, h2, h3, h4, h5, h6,
p, span, li, ul, a, div {
    color: inherit;
}

/* =============================================================================
   TYPOGRAPHIE
   ============================================================================= */

body {
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

.transition-all-custom {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

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

/* Modale generique */
.modal-hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

/* =============================================================================
   SCROLLBAR PERSONNALISEE
   ============================================================================= */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #263238;
}

::-webkit-scrollbar-thumb {
    background: #455A64;
    border-radius: 4px;
}

/* Scrollbar fine pour les sidebars et zones de texte */
.sidebar-scroll {
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: #4FC3F7;
    border-radius: 10px;
}

.audio-text-scroll {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 15px;
}

.audio-text-scroll::-webkit-scrollbar {
    width: 4px;
}

.audio-text-scroll::-webkit-scrollbar-thumb {
    background: #37474F;
    border-radius: 10px;
}

/* =============================================================================
   CARTES VERROUILLEES (Upsell Premium)
   ============================================================================= */

.locked-card {
    position: relative;
    overflow: hidden;
}

.locked-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(38, 50, 56, 0.6);
    backdrop-filter: blur(3px);
    z-index: 10;
    pointer-events: none;
    transition: all 0.3s ease;
}

.locked-card:hover::after {
    background: rgba(38, 50, 56, 0.8);
    backdrop-filter: blur(5px);
}

.locked-content {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.locked-card:hover .locked-content {
    opacity: 1;
}

/* =============================================================================
   LECTEUR AUDIO/VIDEO (Espaces connectes)
   ============================================================================= */

audio::-webkit-media-controls-panel,
video::-webkit-media-controls-panel {
    background-color: #37474F;
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    color: #B0BEC5;
}

/* =============================================================================
   VUES ESPACES CONNECTES
   ============================================================================= */

.view-section {
    display: none;
}

.view-section.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.4s ease-out forwards;
}

/* Navigation active dans les espaces */
.nav-active {
    color: #4FC3F7 !important;
    border-bottom: 2px solid #4FC3F7;
}

/* Sidebar lecons */
.lesson-btn.active-lesson {
    background-color: rgba(79, 195, 247, 0.1);
    border-left: 3px solid #4FC3F7;
    color: white;
}

/* Modules depliables */
.module-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.module-content.open {
    max-height: 3000px;
}

.chevron-rotate {
    transition: transform 0.3s ease;
}

.chevron-rotate.open {
    transform: rotate(180deg);
}

/* =============================================================================
   GRADIENT ACCENT (Titres avec degrade)
   ============================================================================= */

.gradient-accent {
    background: linear-gradient(135deg, #4FC3F7 0%, #29B6F6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* =============================================================================
   GLASS CARD (Effet vitre)
   ============================================================================= */

.glass-card {
    background: rgba(55, 71, 79, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(69, 90, 100, 0.8);
}

/* =============================================================================
   CONTENU ARTICLE (Pages episodes)
   ============================================================================= */

.article-content p {
    margin-bottom: 1.5rem;
    line-height: 1.75;
    color: #B0BEC5;
    font-weight: 300;
    font-size: 1.125rem;
}

.article-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.article-content strong {
    color: #ECEFF1;
    font-weight: 600;
}

.flow-arrow {
    font-size: 1.5rem;
    color: #4FC3F7;
    text-align: center;
    line-height: 1;
    margin: 0.5rem 0;
}

/* =============================================================================
   FORMULAIRE MAILERLITE (Surcharge des styles injectes par MailerLite)
   ============================================================================= */

.ml-error input {
    border-color: #ef4444 !important;
}

.ml-error .label-description {
    color: #ef4444 !important;
}

.ml-form-embedSubmitLoad {
    display: inline-block;
    width: 20px;
    height: 20px;
}

.ml-form-embedSubmitLoad:after {
    content: " ";
    display: block;
    width: 16px;
    height: 16px;
    margin: 2px;
    border-radius: 50%;
    border: 2px solid #263238;
    border-color: #263238 transparent #263238 transparent;
    animation: ml-form-embedSubmitLoad 1.2s linear infinite;
}

@keyframes ml-form-embedSubmitLoad {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ml-form-successContent h4,
.ml-form-successContent p {
    color: white !important;
}

/* Surcharges pour le formulaire MailerLite embarque dans les espaces connectes (mlb2-35041137) */
#mlb2-35041137.ml-form-embedContainer .ml-form-embedWrapper { background-color: transparent !important; }
#mlb2-35041137.ml-form-embedContainer .ml-form-embedBody { padding: 0 !important; }
#mlb2-35041137.ml-form-embedContainer .ml-form-embedContent h4 { color: white !important; font-weight: bold !important; font-size: 1.2rem !important; margin-bottom: 0.5rem !important; }
#mlb2-35041137.ml-form-embedContainer .ml-form-embedContent p { color: #B0BEC5 !important; font-size: 0.875rem !important; }
#mlb2-35041137.ml-form-embedContainer .ml-form-embedBody .ml-form-fieldRow input { background-color: #263238 !important; color: white !important; border-color: rgba(255,255,255,0.1) !important; border-radius: 0.5rem !important; padding: 0.75rem 1rem !important; }
#mlb2-35041137.ml-form-embedContainer .ml-form-embedBody .ml-form-embedSubmit button { background-color: #E07B54 !important; color: white !important; border-radius: 0.5rem !important; font-weight: bold !important; text-transform: uppercase !important; letter-spacing: 0.05em !important; font-size: 0.75rem !important; padding: 1rem !important; transition: all 0.3s ease; }
#mlb2-35041137.ml-form-embedContainer .ml-form-embedBody .ml-form-embedSubmit button:hover { background-color: white !important; color: #E07B54 !important; }

/* =============================================================================
   FILTRE BIBLIOTHEQUE (page-bibli)
   ============================================================================= */

.cat-btn.active {
    background-color: #4FC3F7;
    color: #263238;
    border-color: #4FC3F7;
}

/* =============================================================================
   FOND FORCE (Bibli - securite anti flash blanc)
   ============================================================================= */

.force-dark-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #263238 !important;
    z-index: -9999;
    pointer-events: none;
}

/* =============================================================================
   ORBITE AGITATEURS AQUATIQUES
   ============================================================================= */

.orbit-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5rem;
    height: 5rem;
    margin: -2.5rem;
    animation: orbit 40s linear infinite;
    --radius: 130px;
}

@media (min-width: 768px) {
    .orbit-item {
        width: 5.5rem;
        height: 5.5rem;
        margin: -2.75rem;
        --radius: 170px;
    }
}

@keyframes orbit {
    0%   { transform: rotate(var(--angle)) translateX(var(--radius)) rotate(calc(var(--angle) * -1)); }
    100% { transform: rotate(calc(var(--angle) + 360deg)) translateX(var(--radius)) rotate(calc((var(--angle) + 360deg) * -1)); }
}

.orbit-container.paused .orbit-item {
    animation-play-state: paused !important;
}

.orbit-item.active {
    z-index: 30;
}

.orbit-item img {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.orbit-item:hover img,
.orbit-item.active img {
    opacity: 1 !important;
}

.orbit-item::before {
    content: '';
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    z-index: -1;
}

/* =============================================================================
   SYSTEME DE ROLES CSS - ESPACE CONNECTE MULTI-ROLES
   Applique sur <body data-roles="premium formation_brasse ...">
   ============================================================================= */

/* --- 1. Sections visibles uniquement pour les Premium --- */
body:not([data-roles~="premium"]) .role-premium-only {
    display: none !important;
}

/* --- 2. Sections upsell (cachees si Premium) --- */
body[data-roles~="premium"] .role-membre-only {
    display: none !important;
}

/* --- 3. Verrouillage par defaut des formations --- */
.lock-overlay {
    display: flex;
}

.btn-course-open {
    display: none;
}

.btn-course-locked {
    display: block;
}

/* --- 4. Deverrouillage Premium (ouvre tout) --- */
body[data-roles~="premium"] .lock-overlay {
    display: none !important;
}

body[data-roles~="premium"] .btn-course-open {
    display: block !important;
}

body[data-roles~="premium"] .btn-course-locked {
    display: none !important;
}

/* --- 5. Deverrouillage a la carte par formation --- */

/* Formation Brasse */
body[data-roles~="formation_brasse"] .course-brasse .lock-overlay {
    display: none !important;
}
body[data-roles~="formation_brasse"] .course-brasse .btn-course-open {
    display: block !important;
}
body[data-roles~="formation_brasse"] .course-brasse .btn-course-locked {
    display: none !important;
}

/* Formation Planifie ta saison */
body[data-roles~="formation_planifie"] .course-planifie .lock-overlay {
    display: none !important;
}
body[data-roles~="formation_planifie"] .course-planifie .btn-course-open {
    display: block !important;
}
body[data-roles~="formation_planifie"] .course-planifie .btn-course-locked {
    display: none !important;
}

/* Formation Reprendre le controle */
body[data-roles~="formation_reprendre"] .course-reprendre .lock-overlay {
    display: none !important;
}
body[data-roles~="formation_reprendre"] .course-reprendre .btn-course-open {
    display: block !important;
}
body[data-roles~="formation_reprendre"] .course-reprendre .btn-course-locked {
    display: none !important;
}

/* --- 6. Acces aux plans mensuels (Premium ou Brief) --- */
body:not([data-roles~="premium"]):not([data-roles~="brief_quotidien"]) .req-plan {
    display: none !important;
}

/* --- 7. Elements specifiques au Brief (caches pour les Premium) --- */
body[data-roles~="premium"] .role-brief-only {
    display: none !important;
}
