/* ==================== Movies & TV Manager - Frontend Styles (FIXED) ==================== */

.mtm-plugin { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #E6EEF8;
    background: transparent;
    padding: 20px 0;
}

/* ==================== GRID LAYOUT ==================== */
.mtm-grid { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* ==================== CONTENT CARDS ==================== */
.mtm-card, .mtm-card-tv { 
    display: block;
    text-decoration: none;
    color: inherit;
    background: rgba(14, 26, 43, 0.6);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(166, 183, 216, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.mtm-card:hover, .mtm-card-tv:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(124, 92, 255, 0.5);
    text-decoration: none;
}

.mtm-poster { 
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    background: #0B1220;
    transition: transform 0.3s ease;
}

.mtm-card:hover .mtm-poster,
.mtm-card-tv:hover .mtm-poster {
    transform: scale(1.05);
}

.mtm-poster.error { 
    object-fit: contain;
    padding: 20px;
    background: #0E1A2B;
    opacity: 0.5;
}

.mtm-info { 
    padding: 15px;
    background: rgba(15, 23, 42, 0.8);
}

.mtm-info h3 { 
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #E6EEF8;
}

.mtm-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.mtm-year {
    color: rgba(166, 183, 216, 0.8);
}

.mtm-rating {
    color: #FFC107;
    font-weight: 600;
}

/* ==================== VIDEO PLAYER ==================== */
.mtm-video-player { 
    position: relative;
    padding-top: 56.25%;
    background: #000;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.mtm-video-player iframe { 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ==================== STREAMING AREA ==================== */
#mtm_stream_area {
    animation: fadeIn 0.3s ease;
}

.mtm-stream-header {
    margin-bottom: 20px;
}

.mtm-stream-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 15px 0;
    color: #E6EEF8;
}

/* ==================== SERVER TABS ==================== */
.server-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.server-tab {
    padding: 10px 20px;
    background: rgba(14, 26, 43, 0.8);
    border: 1px solid rgba(166, 183, 216, 0.1);
    border-radius: 8px;
    color: #E6EEF8;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.server-tab:hover {
    background: rgba(124, 92, 255, 0.2);
    border-color: rgba(124, 92, 255, 0.5);
}

.server-tab.active {
    background: linear-gradient(135deg, #FF5A5F, #7C5CFF);
    border-color: #FF5A5F;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 90, 95, 0.3);
}

/* ==================== DETAILS SECTION ==================== */
.movie-details,
.tvshow-info {
    background: rgba(14, 26, 43, 0.6);
    border: 1px solid rgba(166, 183, 216, 0.1);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.movie-meta,
.tvshow-meta { 
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    color: rgba(166, 183, 216, 0.9);
    font-size: 0.95rem;
}

.movie-meta span,
.tvshow-meta span { 
    padding-right: 15px;
    border-right: 1px solid rgba(166, 183, 216, 0.2);
}

.movie-meta span:last-child,
.tvshow-meta span:last-child { 
    border-right: none;
}

.movie-description,
.tvshow-description { 
    line-height: 1.8;
    color: rgba(166, 183, 216, 0.9);
    margin-bottom: 20px;
}

.detail-row { 
    display: flex;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.detail-label { 
    font-weight: 600;
    min-width: 120px;
    color: #FF5A5F;
}

.detail-value { 
    flex: 1;
    color: rgba(166, 183, 216, 0.9);
}

/* ==================== DOWNLOAD SECTION ==================== */
.mtm-downloads { 
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(166, 183, 216, 0.1);
}

.mtm-downloads h3 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    color: #E6EEF8;
}

.download-btn { 
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #2DD4BF, #14B8A6);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(45, 212, 191, 0.3);
}

.download-btn:hover { 
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 212, 191, 0.5);
    color: white;
    text-decoration: none;
}

/* ==================== TV SHOW / ANIME DETAILS ==================== */
.tvshow-header {
    margin-bottom: 30px;
}

.tvshow-poster {
    max-width: 300px;
    float: left;
    margin-right: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.tvshow-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 15px;
    line-height: 1.2;
    color: #E6EEF8;
}

/* ==================== SEASON NAVIGATION ==================== */
.season-nav { 
    margin: 30px 0 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.season-btn { 
    padding: 12px 24px;
    background: rgba(14, 26, 43, 0.8);
    border: 1px solid rgba(166, 183, 216, 0.1);
    border-radius: 8px;
    color: #E6EEF8;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.season-btn:hover {
    background: rgba(124, 92, 255, 0.2);
    border-color: rgba(124, 92, 255, 0.5);
}

.season-btn.active { 
    background: linear-gradient(135deg, #FF5A5F, #7C5CFF);
    border-color: #FF5A5F;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 90, 95, 0.3);
}

/* ==================== EPISODES GRID ==================== */
.episodes-grid { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.episode-card { 
    background: rgba(14, 26, 43, 0.6);
    border: 1px solid rgba(166, 183, 216, 0.1);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.episode-card:hover {
    transform: translateY(-5px);
    border-color: rgba(124, 92, 255, 0.5);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.episode-card.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.episode-card.disabled:hover {
    transform: none;
}

.episode-thumbnail { 
    width: 100%;
    height: 130px;
    object-fit: cover;
    background: #0B1220;
    transition: transform 0.3s ease;
}

.episode-card:not(.disabled):hover .episode-thumbnail {
    transform: scale(1.05);
}

.episode-info { 
    padding: 12px;
    background: rgba(15, 23, 42, 0.8);
}

.episode-number { 
    font-size: 0.8rem;
    color: #FF5A5F;
    font-weight: 700;
    margin-bottom: 5px;
}

.episode-title { 
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #E6EEF8;
}

/* ==================== MODAL ==================== */
.mtm-modal { 
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 999999;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.mtm-modal-content { 
    width: 90%;
    max-width: 1000px;
    background: rgba(15, 23, 42, 0.98);
    padding: 30px;
    border-radius: 16px;
    color: #E6EEF8;
    border: 1px solid rgba(124, 92, 255, 0.3);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
}

.mtm-modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #E6EEF8;
}

#mtm_modal_close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 90, 95, 0.2);
    border: 1px solid #FF5A5F;
    color: #FF5A5F;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

#mtm_modal_close:hover {
    background: #FF5A5F;
    color: white;
}

/* ==================== EPISODE VIDEO CONTAINER ==================== */
.episode-video-container {
    position: relative;
    padding-top: 56.25%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.episode-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ==================== BACK BUTTON ==================== */
.mtm-detail-back {
    background: rgba(14, 26, 43, 0.8);
    border: 1px solid rgba(166, 183, 216, 0.1);
    color: #E6EEF8;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.mtm-detail-back:hover {
    background: rgba(124, 92, 255, 0.2);
    border-color: rgba(124, 92, 255, 0.5);
    transform: translateX(-5px);
}

/* ==================== LOADING STATE ==================== */
.mtm-loading {
    position: relative;
    min-height: 200px;
    opacity: 0.6;
}

.mtm-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(124, 92, 255, 0.2);
    border-top-color: #7C5CFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ==================== NO SERVER MESSAGE ==================== */
.no-server-message {
    padding: 20px;
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    color: #FFA500;
    font-weight: 600;
}

/* ==================== EMPTY STATE ==================== */
.mtm-no-content {
    text-align: center;
    padding: 60px 20px;
    color: rgba(166, 183, 216, 0.6);
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== SCROLLBAR STYLING ==================== */
.mtm-modal-content::-webkit-scrollbar {
    width: 10px;
}

.mtm-modal-content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 10px;
}

.mtm-modal-content::-webkit-scrollbar-thumb {
    background: rgba(124, 92, 255, 0.5);
    border-radius: 10px;
}

.mtm-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 92, 255, 0.8);
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
    .mtm-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .mtm-poster {
        height: 220px;
    }
    
    .mtm-info h3 {
        font-size: 0.9rem;
    }
    
    .mtm-meta {
        font-size: 0.8rem;
    }
    
    .episodes-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }
    
    .tvshow-poster {
        float: none;
        max-width: 100%;
        margin: 0 0 20px 0;
    }
    
    .tvshow-title {
        font-size: 1.8rem;
    }
    
    .mtm-stream-header h2 {
        font-size: 1.5rem;
    }
    
    .detail-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .detail-label {
        min-width: auto;
    }
    
    .season-nav {
        gap: 8px;
    }
    
    .season-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .server-tabs {
        gap: 8px;
    }
    
    .server-tab {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .download-btn {
        display: block;
        width: 100%;
        margin-right: 0;
        text-align: center;
    }
    
    .mtm-modal-content {
        padding: 20px;
        max-height: 95vh;
    }
    
    .movie-meta,
    .tvshow-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .movie-meta span,
    .tvshow-meta span {
        border-right: none;
        padding-right: 0;
    }
}

@media (max-width: 480px) {
    .mtm-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .mtm-poster {
        height: 180px;
    }
    
    .mtm-info {
        padding: 10px;
    }
    
    .episodes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .episode-thumbnail {
        height: 100px;
    }
    
    .mtm-modal-content {
        width: 95%;
        padding: 15px;
    }
    
    .tvshow-title {
        font-size: 1.5rem;
    }
    
    .season-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    
    .server-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .mtm-modal,
    .server-tabs,
    .season-nav,
    .mtm-detail-back,
    .download-btn {
        display: none;
    }
    
    .mtm-grid {
        display: block;
    }
    
    .mtm-card,
    .mtm-card-tv {
        page-break-inside: avoid;
        margin-bottom: 20px;
    }
}