/* --- Page Layout & Blur Effect --- */
#page-wrapper {
    transition: filter 0.3s ease-in-out;
}
#page-wrapper.blur {
    filter: blur(5px) brightness(0.7);
    /* Prevents interaction with the blurred background */
    pointer-events: none;
}
.episodes-page {
    /* We remove all width constraints from the main container */
    margin: 40px 0; /* Margin top/bottom, no side margin */
    padding: 0;     /* No side padding */
}
.episodes-page h1 {
    text-align: center;
    font-size: 2.8rem;
    color: var(--text-color);
    margin-bottom: 40px;
}

/* --- New Filter Bar with Sliding Underline --- */
.filters {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px;
    gap: 15px;
}

.filter-nav {
    position: relative; 
    display: flex;
    width: 100%; /* This is correct, it spans the full width */
    background-color: var(--primary-color);
    border-bottom: 1px solid var(--secondary-color);
}
/* --- Find and replace this rule --- */
.filter-btn {
    flex: 1; /* This is the key: tells each button to take up 1 equal share of space */
    padding: 15px 5px; /* Taller padding, less horizontal padding */
    text-align: center; /* Ensures the text is centered within the larger button area */
    font-size: 1.1rem;
    font-weight: bold;
    color: #aaa;
    background: none;
    border: none;
    border-radius: 0; /* Removes any rounded corners so they sit flush */
    cursor: pointer;
    transition: color 0.3s, background-color 0.3s; /* Added background-color to transition */
}
.filter-btn.active {
    color: var(--text-color); /* Active button is bright */
}
/* --- Find and replace this rule --- */
.filter-btn:hover {
    color: var(--text-color);
    background-color: var(--secondary-color); /* Add a hover background */
}
.sliding-underline {
    position: absolute;
    bottom: 0;
    left: 0; /* Will be updated by JS */
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 2px;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
#season-select {
    padding: 8px;
    font-size: 1rem;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid #777;
    border-radius: 5px;
}

/* --- Episode Item Styling --- */
#episode-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.episode-item {
    background-color: var(--secondary-color);
    border-radius: 8px;
    border-left: 5px solid var(--accent-color);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    max-width: 900px; /* Control max width here instead of the whole page */
    margin: 0 auto 15px auto; /* Center the item and add bottom margin */
    width: 100%; /* Ensure it fills the container */
}
.episode-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
.episode-summary { /* The visible part of the episode item */
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
}
.episode-thumbnail {
    width: 150px;
    height: 84px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.episode-title {
    margin: 0;
    font-size: 1.5rem;
}
.episode-meta {
    margin: 5px 0 0;
    color: #ccc;
}
/* We HIDE the details div with CSS, as it's only for data now */
.episode-details {
    display: none;
}

/* --- Modal / Lightbox Styling --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: var(--secondary-color);
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content {
    transform: scale(1);
}
.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #aaa;
    cursor: pointer;
}
.modal-content #modal-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 20px;
}
.modal-content h2 {
    margin-top: 0;
}

/* --- Admin Controls --- */

/* Hide admin buttons by default for all normal visitors */
.admin-controls {
    display: none;
    gap: 10px; /* Adds space between buttons */
    margin-top: 10px;
}

/* BUT, if the body has the 'admin-logged-in' class, show them! */
body.admin-logged-in .admin-controls {
    display: flex; /* Or 'block' if it's a single button */
    justify-content: center;
}

/* Style the buttons */
.admin-controls button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.admin-controls .delete-btn {
    background-color: #555;
}