/* --- SIDEBAR (Episodi/Fonti) --- */
#sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: rgba(20, 20, 20, 0.98);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 40; /* Sopra settings (30) */
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0,0,0,0.8);
    border-left: 1px solid #333;
}
#sidebar.open { transform: translateX(0); }

.sidebar-header { padding: 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #333; }
.sidebar-title { color: white; font-size: 18px; font-weight: bold; margin: 0; }
.close-sidebar { background: none; border: none; color: #aaa; font-size: 24px; cursor: pointer; padding: 0; }
.close-sidebar:hover { color: white; }

.sidebar-tabs { display: flex; border-bottom: 1px solid #333; }
.tab-btn { flex: 1; background: none; border: none; padding: 15px; color: #888; cursor: pointer; font-weight: bold; transition: color 0.2s; border-bottom: 2px solid transparent; }
.tab-btn:hover { color: #ddd; }
.tab-btn.active { color: #2196F3; border-bottom-color: #2196F3; }

.sidebar-content { flex: 1; overflow-y: auto; padding: 0; }
.list-item { padding: 15px 20px; border-bottom: 1px solid #2a2a2a; cursor: pointer; transition: background-color 0.2s; display: flex; flex-direction: column; gap: 5px; outline: none; }
.list-item:hover { background: rgba(255,255,255,0.05); }
.list-item.active { background: rgba(33, 150, 243, 0.15); border-left: 4px solid #2196F3; }
.item-title { color: #eee; font-size: 14px; font-weight: 500; }
.item-meta { color: #888; font-size: 12px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- SERIES DETAIL PANEL --- */
#series-detail-panel {
    display: none; /* Nascosto di default */
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(20, 20, 20, 0.98); z-index: 1500;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}
.detail-header {
    padding: 20px 40px; display: flex; justify-content: space-between; align-items: center;
    background: rgba(0,0,0,0.5); border-bottom: 1px solid #333;
}
#detail-title { margin: 0; color: white; font-size: 24px; }
.close-detail { background: none; border: none; color: #aaa; font-size: 32px; cursor: pointer; }
.close-detail:hover { color: white; }

.detail-body { flex: 1; display: flex; overflow: hidden; }

.seasons-col { width: 250px; border-right: 1px solid #333; overflow-y: auto; background: rgba(0,0,0,0.3); }
.episodes-col { flex: 1; overflow-y: auto; padding: 20px; }

.season-btn {
    display: block; width: 100%; padding: 15px 20px; text-align: left;
    background: none; border: none; color: #aaa; cursor: pointer;
    border-bottom: 1px solid #2a2a2a; transition: all 0.2s; font-size: 16px;
}
.season-btn:hover { background: rgba(255,255,255,0.05); color: white; }
.season-btn.active { background: rgba(33, 150, 243, 0.15); color: #2196F3; border-left: 4px solid #2196F3; }

.episode-card {
    display: flex; gap: 20px; margin-bottom: 20px; padding: 15px;
    background: rgba(255,255,255,0.03); border-radius: 8px; cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}
.episode-card:hover, .episode-card:focus { background: rgba(255,255,255,0.08); transform: scale(1.01); outline: none; }

.ep-img {
    width: 200px; height: 112px; background: #333; border-radius: 4px; flex-shrink: 0;
    background-size: cover; background-position: center;
}
.ep-info { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.ep-title { color: white; font-size: 18px; font-weight: bold; }
.ep-meta { color: #888; font-size: 13px; display: flex; gap: 15px; }
.ep-plot { color: #ccc; font-size: 14px; margin-top: 8px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 900px) {
    #sidebar {
        width: 300px;
    }

    .seasons-col {
        width: 200px;
    }

    .ep-img {
        width: 150px;
        height: 84px;
    }

    .ep-title {
        font-size: 16px;
    }

    .ep-plot {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
}

@media (max-width: 600px) {
    #sidebar {
        width: 100%; /* Full width on very small screens */
    }
}
