/* TV Episodes AJAX Styles */

.tv-episodes-container {
    font-family: Arial, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    background-color: #1a1d20;
    color: #fff;
    padding: 20px;
    position: relative;
}

/* Tabs Styling */
.tv-episodes-tabs {
    display: flex;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
}

.tv-episodes-tabs .tab {
    padding: 10px 20px;
    color: #aaa;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
}

.tv-episodes-tabs .tab.active {
    color: #fff;
    border-bottom: 2px solid #fff;
}

/* Season Selector Styling */
.tv-episodes-season-selector {
    margin-bottom: 30px;
    position: relative;
}

.season-dropdown {
    position: relative;
    width: 250px;
    cursor: pointer;
}

.season-dropdown select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.season-dropdown-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #2c2f33;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
}

.season-dropdown-display svg {
    fill: #fff;
}

/* Season buttons styling */
.season-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.season-btn {
    padding: 8px 16px;
    background-color: #2c2f33;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.season-btn:hover {
    background-color: #3a3d41;
}

.season-btn.active {
    background-color: #4a4d52;
    border-left: 3px solid #fff;
}

/* Episodes Grid Styling */
.tv-episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    min-height: 300px; /* Minimum height to prevent layout jumps during loading */
    position: relative;
    transition: opacity 0.3s ease;
}

.tv-episodes-grid.loading {
    opacity: 0.5;
}

.tv-episode-card {
    background-color: #24272b;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.tv-episode-card:hover {
    transform: translateY(-5px);
}

.tv-episode-thumbnail {
    position: relative;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
}

.tv-episode-thumbnail img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tv-episode-card:hover .tv-episode-thumbnail img {
    transform: scale(1.05);
}

/* YouTube Container */
.youtube-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: #000;
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
}

.placeholder-image {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #3a3d40;
}

.episode-menu-dots {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.episode-menu-dots svg {
    fill: #fff;
}

.tv-episode-info {
    padding: 15px;
}

.episode-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: normal;
    color: #aaa;
}

.episode-title a {
    color: #aaa;
    text-decoration: none;
}

.episode-name {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: bold;
}

.episode-name a {
    color: #fff;
    text-decoration: none;
}

.episode-description {
    font-size: 14px;
    line-height: 1.4;
    color: #ccc;
}

/* Loading Indicator */
.episodes-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    z-index: 100;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #fff;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .tv-episodes-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .tv-episodes-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .tv-episodes-tabs .tab {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .season-buttons {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .tv-episodes-grid {
        grid-template-columns: 1fr;
    }
}