/**
 * StreamVault - TV Shows Browse Page Styles
 * Premium cinematic styling that integrates with color theme system
 */

/* Page-specific header styles */
.browse-header {
    background: linear-gradient(135deg, 
        rgba(var(--primary-rgb), 0.1) 0%, 
        rgba(var(--secondary-rgb), 0.05) 50%, 
        rgba(var(--accent-rgb), 0.1) 100%
    );
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.recent-header {
    background: linear-gradient(135deg, 
        rgba(var(--primary-rgb), 0.1) 0%, 
        rgba(var(--secondary-rgb), 0.05) 50%, 
        rgba(var(--accent-rgb), 0.1) 100%
    );
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.2);
}

.featured-header {
    background: linear-gradient(135deg, 
        rgba(var(--primary-rgb), 0.1) 0%, 
        rgba(var(--secondary-rgb), 0.05) 50%, 
        rgba(var(--accent-rgb), 0.1) 100%
    );
    border-bottom: 1px solid rgba(var(--secondary-rgb), 0.2);
}

.trending-header {
    background: linear-gradient(135deg, 
        rgba(var(--primary-rgb), 0.1) 0%, 
        rgba(var(--secondary-rgb), 0.05) 50%, 
        rgba(var(--accent-rgb), 0.1) 100%
    );
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.2);
}

/* TV show cards container */
#tvshows-grid {
    perspective: 1000px;
}

/* Enhanced TV show card styling - Updated to match HTML classes */
.modern-card,
.tvshow-card {
    transform-style: preserve-3d;
    backdrop-filter: blur(10px);
    border: none !important;
    outline: none !important;
    position: relative;
    overflow: hidden;
}

.modern-card *,
.tvshow-card * {
    outline: none !important;
}

.modern-card:focus,
.tvshow-card:focus {
    outline: none !important;
    border: none !important;
}

/* Remove focus outlines from buttons and links */
.modern-card button,
.modern-card a,
.tvshow-card button,
.tvshow-card a {
    outline: none !important;
    border: none;
}

.modern-card button:focus,
.modern-card a:focus,
.tvshow-card button:focus,
.tvshow-card a:focus {
    outline: none !important;
    box-shadow: none !important;
}

.modern-card::before,
.tvshow-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(var(--primary-rgb), 0.6),
        rgba(var(--secondary-rgb), 0.6),
        rgba(var(--accent-rgb), 0.6)
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-card:hover::before,
.tvshow-card:hover::before {
    opacity: 1;
}

/* Main card container */
.main-card {
    background: linear-gradient(145deg, 
        rgba(15, 23, 42, 0.8), 
        rgba(30, 41, 59, 0.6)
    );
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.main-card:hover {
    transform: translateY(-8px) rotateX(5deg);
    border-color: rgba(var(--primary-rgb), 0.4);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(var(--primary-rgb), 0.3);
}

/* Poster image styling */
.poster-wrapper img {
    filter: contrast(1.1) saturate(1.2);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-card:hover .poster-wrapper img,
.tvshow-card:hover .poster-wrapper img {
    filter: contrast(1.2) saturate(1.3) brightness(1.1);
}

/* Badge styling */
.type-badge {
    background: linear-gradient(45deg, 
        rgba(var(--primary-rgb), 0.9), 
        rgba(var(--secondary-rgb), 0.8)
    );
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.rating-badge {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Content info badges */
.content-info {
    background: linear-gradient(45deg, 
        rgba(var(--secondary-rgb), 0.8), 
        rgba(var(--accent-rgb), 0.7)
    );
    backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--secondary-rgb), 0.3);
}

/* Play button styling */
.play-button {
    background: linear-gradient(45deg, 
        rgba(255, 255, 255, 0.95), 
        rgba(255, 255, 255, 0.85)
    );
    backdrop-filter: blur(10px);
    border: 2px solid rgba(var(--primary-rgb), 0.3);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(var(--primary-rgb), 0.4);
}

.play-button:hover {
    background: linear-gradient(45deg, 
        rgba(255, 255, 255, 1), 
        rgba(var(--primary-rgb), 0.1)
    );
    transform: scale(1.1);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(var(--primary-rgb), 0.6);
}

/* Hover popup overlay */
.hover-popup-overlay {
    background: linear-gradient(145deg, 
        rgba(17, 24, 39, 0.95), 
        rgba(31, 41, 55, 0.9)
    );
    backdrop-filter: blur(25px);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Action buttons in popup */
.action-buttons a {
    background: linear-gradient(45deg, 
        rgba(var(--primary-rgb), 1), 
        rgba(var(--secondary-rgb), 0.9)
    );
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.action-buttons a:hover {
    background: linear-gradient(45deg, 
        rgba(var(--secondary-rgb), 1), 
        rgba(var(--primary-rgb), 0.9)
    );
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.5);
}

.watchlist-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.watchlist-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(var(--primary-rgb), 0.5);
    transform: translateY(-2px);
}

/* Animation keyframes */
@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.6s ease-out forwards;
}

/* Quick type switcher */
.bg-primary {
    background: linear-gradient(45deg, 
        rgba(var(--primary-rgb), 1), 
        rgba(var(--secondary-rgb), 0.8)
    ) !important;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.4);
}

/* Pagination styling */
.bg-gray-800:hover {
    background: linear-gradient(45deg, 
        rgba(var(--primary-rgb), 0.2), 
        rgba(var(--secondary-rgb), 0.1)
    ) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modern-card:hover,
    .tvshow-card:hover {
        transform: translateY(-4px);
    }
    
    .hover-popup-overlay {
        position: relative;
        opacity: 1;
        visibility: visible;
        background: rgba(17, 24, 39, 0.9);
    }
    
    .main-card {
        min-height: 300px !important;
    }
}

@media (max-width: 640px) {
    .main-card {
        min-height: 280px !important;
    }
    
    .hover-popup-overlay .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
}

/* Theme-specific adjustments */
[data-theme="dark"] .hover-popup-overlay {
    background: linear-gradient(145deg, 
        rgba(15, 23, 42, 0.95), 
        rgba(30, 41, 59, 0.9)
    );
}

[data-theme="light"] .hover-popup-overlay {
    background: linear-gradient(145deg, 
        rgba(248, 250, 252, 0.95), 
        rgba(241, 245, 249, 0.9)
    );
    color: #1f2937;
}

[data-theme="light"] .hover-popup-overlay .text-white {
    color: #1f2937 !important;
}

[data-theme="light"] .hover-popup-overlay .text-gray-300 {
    color: #6b7280 !important;
}

[data-theme="light"] .hover-popup-overlay .text-gray-400 {
    color: #9ca3af !important;
}

/* Loading states */
.skeleton-card {
    background: linear-gradient(90deg, 
        rgba(var(--primary-rgb), 0.1) 25%, 
        rgba(var(--secondary-rgb), 0.1) 50%, 
        rgba(var(--primary-rgb), 0.1) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Enhanced focus states for accessibility */
.modern-card:focus-within,
.tvshow-card:focus-within {
    outline: 2px solid rgba(var(--primary-rgb), 0.8);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .modern-card,
    .tvshow-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .hover-popup-overlay {
        display: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .modern-card,
    .tvshow-card {
        border: 2px solid #fff;
    }
    
    .type-badge,
    .rating-badge,
    .content-info {
        border: 2px solid #fff;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .modern-card,
    .tvshow-card,
    .main-card,
    .poster-wrapper img,
    .play-button,
    .action-buttons a {
        transition: none;
        animation: none;
    }
    
    .modern-card:hover,
    .tvshow-card:hover {
        transform: none;
    }
}
