/* Dans public/style.css */

/* ==========================================================================
   --- 1. Styles Globaux & Mise en page principale ---
   ========================================================================== */
   body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
    padding: 20px;
}

.main-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.series-panel { /* Colonne de gauche */ }
.playlist-panel { /* Colonne de droite */ }


/* ==========================================================================
   --- 2. Composants de Contrôle (Recherche, Filtres, Reset) ---
   ========================================================================== */
.search-controls, .reset-controls {
    text-align: center;
    margin-bottom: 15px;
}

.search-controls input, .search-controls select {
    padding: 10px;
    font-size: 1em;
    width: 300px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin: 5px;
}

.search-controls button {
    padding: 10px 15px;
    font-size: 1em;
    border: none;
    background-color: #3498db;
    color: white;
    border-radius: 5px;
    cursor: pointer;
}

.reset-controls button {
    background-color: #e74c3c;
    border: none;
    color: white;
    padding: 10px 15px;
    font-size: 1em;
    border-radius: 5px;
    cursor: pointer;
}


/* ==========================================================================
   --- 3. Grille des Séries (Vue Liste) ---
   ========================================================================== */
.series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

.tv-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.tv-card > div { /* La partie cliquable pour voir les détails */
    cursor: pointer;
}

.tv-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.tv-card img {
    width: 100%;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.tv-card h3 {
    font-size: 1.1em;
    padding: 15px 10px;
    margin: 0;
    color: #2c3e50;
}

.add-button {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 10px;
    width: 100%;
    cursor: pointer;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    font-size: 1em;
}


/* ==========================================================================
   --- 4. Vue Détaillée d'une Série ---
   ========================================================================== */
.detail-view {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.detail-view .back-button {
    padding: 10px 15px;
    font-size: 1em;
    cursor: pointer;
    margin-bottom: 20px;
    background: #eee;
    border: none;
    border-radius: 5px;
}

.detail-view h1 {
    margin-top: 0;
}


/* ==========================================================================
   --- 5. Liste des Saisons (Interactive) ---
   ========================================================================== */
.season-header {
    background-color: #2c3e50;
    color: white;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.season-header:hover {
    background-color: #34495e;
}

.season-header.active {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.episodes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}

.episodes-list.visible {
    max-height: 2000px; /* Hauteur suffisante pour contenir les épisodes */
    padding: 15px;
    border: 1px solid #eee;
    border-top: none;
}

.episodes-list li {
    background-color: #f9f9f9;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
}

.episodes-list p {
    margin: 5px 0 0 0;
    font-size: 0.9em;
    color: #555;
}


/* ==========================================================================
   --- 6. Manager de Playlists (Colonne de Droite) ---
   ========================================================================== */
.playlist-container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* --- 6.1 Editeur de la Playlist en Cours --- */
.playlist-editor {
    margin-bottom: 25px;
}

.playlist-editor input {
    width: calc(100% - 22px);
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.current-playlist {
    list-style: none;
    padding: 0;
}

.current-playlist li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 5px;
}

.remove-item {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2em;
}

/* --- 6.2 Liste des Playlists Sauvegardées --- */
.saved-list {
    list-style: none;
    padding: 0;
}

.saved-list li {
    background-color: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 5px;
    padding: 8px;
}

.saved-playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist-name {
    flex-grow: 1;
    cursor: pointer;
    font-weight: bold;
}

.playlist-name.expanded {
    color: #3498db;
}

.saved-actions button {
    margin-left: 5px;
    font-size: 0.8em;
    padding: 4px 8px;
    cursor: pointer;
}

.delete-button {
    background-color: #e74c3c;
    color: white;
    border: none;
}

.edit-name-form {
    display: flex;
    width: 100%;
}

.edit-name-form input {
    flex-grow: 1;
    border: 1px solid #3498db;
    padding: 4px;
}

.edit-name-form button {
    padding: 4px 8px;
}

.saved-playlist-items {
    list-style: disc;
    padding-left: 30px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.saved-playlist-items.visible {
    max-height: 500px;
    margin-top: 10px;
}


/* ==========================================================================
   --- 7. Utilitaires ---
   ========================================================================== */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 50px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* ==========================================================================
   --- 8. Fenêtre Modale (Pop-up) ---
   ========================================================================== */
   .modal-overlay {
    position: fixed; /* Reste en place même si on scrolle */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Fond noir semi-transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Pour être au-dessus de tout le reste */
}

.modal-content {
    background-color: white;
    padding: 20px 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #aaa;
}
.close-button:hover {
    color: #333;
}

.modal-series-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

.modal-series-list li a {
    display: block;
    padding: 10px;
    background-color: #f9f9f9;
    margin-bottom: 5px;
    border-radius: 4px;
    text-decoration: none;
    color: #2c3e50;
    font-weight: bold;
}

.modal-series-list li a:hover {
    background-color: #e9e9e9;
}