/* ===== SYSTÈME DE THÈMES ===== */

/* Modal thèmes */
.theme-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.theme-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.theme-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    cursor: pointer;
}

.theme-modal {
    position: relative;
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.98), rgba(20, 20, 20, 0.98));
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 25px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(212, 175, 55, 0.2);
    animation: themeModalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes themeModalSlideIn {
    from {
        transform: scale(0.9) translateY(30px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.theme-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px 35px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.2);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.05), transparent);
}

.theme-modal-header h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 900;
    background: linear-gradient(135deg, #d4af37, #f0d77e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-modal-close {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    color: #d4af37;
    font-size: 26px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-modal-close:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
    transform: rotate(90deg);
}

.theme-modal-body {
    padding: 35px;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

/* Sections */
.theme-section {
    margin-bottom: 40px;
}

.theme-section:last-child {
    margin-bottom: 0;
}

.theme-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Grille de thèmes */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* Carte de thème */
.theme-card {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.theme-card:hover {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.5);
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(212, 175, 55, 0.3);
}

.theme-card.active {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.12);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}

.theme-preview {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.theme-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(0, 0, 0, 0.3));
}

.theme-emoji {
    font-size: 48px;
    filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.5));
    animation: themeEmojiFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@keyframes themeEmojiFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.theme-info {
    padding: 18px;
    background: rgba(0, 0, 0, 0.4);
}

.theme-name {
    font-size: 15px;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
}

.theme-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 5px;
    margin-top: 5px;
}

.theme-badge.seasonal {
    background: linear-gradient(135deg, #c41e3a, #165b33);
    color: white;
}

.theme-badge.minimal {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

.theme-badge.active-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.theme-badge.custom-badge {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
}

/* Bouton supprimer thème custom */
.theme-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    background: rgba(239, 68, 68, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.theme-delete:hover {
    background: #dc2626;
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.6);
}

/* Bouton créer thème */
.theme-create-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #d4af37, #c9a428);
    border: none;
    border-radius: 15px;
    color: rgba(0, 0, 0, 0.9);
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.theme-create-btn:hover {
    background: linear-gradient(135deg, #f0d77e, #d4af37);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.5);
}

/* ===== CRÉATEUR DE THÈME PERSONNALISÉ ===== */

.custom-theme-creator {
    max-width: 700px;
}

.custom-theme-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input[type="text"] {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input[type="text"]:focus {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.08);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

/* Grille de sélecteurs de couleur */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.color-picker-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-picker-item label {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-picker-item input[type="color"] {
    width: 100%;
    height: 60px;
    border: 3px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
}

.color-picker-item input[type="color"]:hover {
    border-color: #d4af37;
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
}

/* Aperçu du thème */
.custom-theme-preview {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(212, 175, 55, 0.2);
    border-radius: 15px;
    padding: 30px;
}

.preview-box {
    padding: 25px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.preview-title {
    font-size: 22px;
    font-weight: 900;
}

.preview-button {
    padding: 12px 30px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
}

.preview-text {
    font-size: 14px;
}

/* ===== MODE CINÉMA ===== */

body.cinema-mode .header-minimal,
body.cinema-mode .tv-header-premium,
body.cinema-mode .week-selector-modern,
body.cinema-mode .tv-content-section,
body.cinema-mode .floating-dock-bar,
body.cinema-mode .bottom-nav,
body.cinema-mode .floating-share-button {
    display: none !important;
}

body.cinema-mode .tv-video-section {
    height: 100vh;
}

body.cinema-mode .tv-video-container {
    height: 100vh;
}

/* Badge mode cinéma */
body.cinema-mode::before {
    content: '🎬 Mode Cinéma';
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #ffd700;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    z-index: 9999;
    pointer-events: none;
    animation: cinemaBadgeFade 3s ease;
}

@keyframes cinemaBadgeFade {
    0%, 80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Bouton sortir mode cinéma */
body.cinema-mode::after {
    content: '✕';
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.8);
    color: #ffd700;
    border: 2px solid #ffd700;
    border-radius: 50%;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s ease;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .theme-modal {
        max-width: 98%;
        border-radius: 20px;
    }
    
    .theme-modal-header {
        padding: 25px;
    }
    
    .theme-modal-header h2 {
        font-size: 22px;
    }
    
    .theme-modal-body {
        padding: 25px;
    }
    
    .theme-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .theme-preview {
        height: 100px;
    }
    
    .theme-emoji {
        font-size: 40px;
    }
    
    .color-picker-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .theme-modal-header {
        padding: 20px;
    }
    
    .theme-modal-header h2 {
        font-size: 20px;
    }
    
    .theme-modal-body {
        padding: 20px;
    }
    
    .theme-grid {
        grid-template-columns: 1fr;
    }
    
    .color-picker-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== ANIMATIONS THÉMATIQUES ===== */

@keyframes fall {
    from {
        transform: translateY(0) rotate(0deg);
    }
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

@keyframes slideAndSpin {
    from {
        left: -50px;
        transform: rotate(0deg);
    }
    to {
        left: 110%;
        transform: rotate(720deg);
    }
}

@keyframes fallRotate {
    from {
        transform: translateY(0) rotate(0deg);
    }
    to {
        transform: translateY(100vh) rotate(-360deg);
    }
}

@keyframes explode {
    0% {
        transform: scale(0) translateY(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) translateY(-100px);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.5) translateY(-200px);
        opacity: 0;
    }
}

@keyframes shootingStar {
    from {
        left: -50px;
        top: var(--start-top);
        transform: scale(1);
        opacity: 1;
    }
    to {
        left: 110%;
        top: calc(var(--start-top) + 30vh);
        transform: scale(0.5);
        opacity: 0;
    }
}

/* ===== CONTAINER ANIMATIONS ===== */

.theme-animation-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

/* ✅ Masquer animations sur la vidéo */
.theme-animation-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;  /* ✅ Sous le dock (1000) mais au-dessus du contenu */
    overflow: hidden;
}

/* ✅ Vidéo au-dessus des animations */
.tv-video-section {
    position: relative;
    z-index: 200 !important;
}

.tv-video-container {
    position: relative;
    z-index: 201 !important;
    background: #000;
}

/* ✅ Dock reste au-dessus de tout */
.floating-dock-bar {
    z-index: 1000 !important;
}

.bottom-nav {
    z-index: 999 !important;
}

/* ✅ Header et autres éléments UI */
.tv-header-premium {
    position: relative;
    z-index: 50;
}

.week-selector-modern {
    position: relative;
    z-index: 50;
}

.tv-content-section {
    position: relative;
    z-index: 10;
}

/* Empêcher les animations de passer au-dessus de la vidéo */
.theme-animation-container > div {
    z-index: 1;
}

/* Animation confettis Nouvel An */
@keyframes confettiFall {
    from {
        transform: translateY(0) rotate(0deg);
    }
    to {
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Animation "2026" qui apparaît */
@keyframes yearPop {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.5) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 0;
    }
}

/* Bouton réinitialiser thème */
.theme-reset-btn {
    width: 100%;
    padding: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 15px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.theme-reset-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: #d4af37;
    color: #d4af37;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
}