/* Enhanced Thrifty Streamer PWA - Modern Design */

/* Import Inter font for better typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Legacy colors for compatibility */
    --primary-color: #2196F3;
    --secondary-color: #FFC107;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --dark-color: #212529;
    --light-color: #F8F9FA;
    
    /* Enhanced Modern Color System */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    --danger-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    
    /* Glass Morphism Effects */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-backdrop: blur(10px);
    
    /* Enhanced Shadows */
    --shadow-soft: 0 8px 32px rgba(31, 38, 135, 0.37);
    --shadow-hover: 0 12px 40px rgba(31, 38, 135, 0.5);
    --shadow-focus: 0 0 0 3px rgba(102, 126, 234, 0.1);
    
    /* Modern Spacing & Transitions */
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0 !important;
    padding: 0 !important;
}

/* Fix for viewport and container issues */
html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

main, .container, .container-fluid {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Ensure no containers clip dropdowns */
.container, .container-fluid {
    overflow: visible;
}

/* Enhanced Navigation Dropdown Fixes */
.navbar-nav .dropdown-menu {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow-soft) !important;
    margin-top: 0.5rem !important;
    min-width: 180px !important;
    z-index: 99999 !important;
    overflow: visible !important;
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    will-change: transform !important;
    pointer-events: auto !important;
}

/* Override Bootstrap dropdown positioning completely */
.dropdown-menu[data-bs-popper] {
    position: absolute !important;
    z-index: 99999 !important;
    top: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-top: 0.125rem !important;
}

/* Force dropdowns to appear above other content */
.navbar-nav .dropdown {
    position: relative !important;
    z-index: 99998 !important;
}

.navbar-collapse {
    position: relative !important;
    z-index: 99997 !important;
}

.navbar {
    position: relative !important;
    z-index: 99996 !important;
}

/* Ensure main content doesn't clip dropdowns */
.container-fluid, .container {
    overflow: visible !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Ensure all page content has lower z-index than dropdowns */
.card, .service-card, .episode-card, .recommendation-card {
    position: relative !important;
    z-index: 1 !important;
}

/* Dashboard specific fixes */
.row, .col, .col-md-6, .col-lg-4 {
    position: relative !important;
    z-index: 1 !important;
}

.navbar-nav .dropdown-item {
    color: var(--dark-color);
    padding: 0.75rem 1rem;
    transition: var(--transition-smooth);
    border-radius: 8px;
    margin: 0.125rem 0.5rem;
}

.navbar-nav .dropdown-item:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-1px);
}

.navbar-nav .dropdown-item i {
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
}

/* Ensure dropdowns don't get clipped */
.navbar-collapse {
    overflow: visible !important;
}

.navbar {
    overflow: visible !important;
}

/* Additional z-index fixes for common elements */
.alert, .toast, .modal {
    z-index: 99000 !important;
}

.dropdown-menu.show {
    z-index: 99999 !important;
}

/* Fix for Bootstrap components that might interfere */
.btn-group .dropdown-menu,
.nav .dropdown-menu {
    z-index: 99999 !important;
}

/* Ensure PWA elements don't interfere */
#pwaStatus, #installBtn, #installHelpBtn {
    z-index: 98000 !important;
}

/* Splash Screen Modal Fixes - Complete Override */
#splashModal {
    z-index: 99500 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: none;
    overflow-y: auto !important;
    padding: 0 !important;
}

#splashModal.show {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 1rem !important;
}

/* Force modal to be visible and properly positioned */
#splashModal .modal-dialog {
    margin: 0 !important;
    max-height: none !important;
    display: block !important;
    position: relative !important;
    width: 90% !important;
    max-width: 800px !important;
    transform: none !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

#splashModal .modal-content {
    position: relative !important;
    top: 0 !important;
    transform: none !important;
    max-height: none !important;
    overflow: visible !important;
    border-radius: var(--border-radius-lg) !important;
    box-shadow: var(--shadow-soft) !important;
    margin: 0 !important;
    border: none !important;
    background: white !important;
}

#splashModal .modal-header {
    background: var(--primary-gradient) !important;
    border-bottom: none !important;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0 !important;
    position: relative !important;
    z-index: 1 !important;
    color: white !important;
}

#splashModal .modal-body {
    padding: 1.5rem !important;
    overflow-y: visible !important;
    max-height: none !important;
    background: white !important;
}

#splashModal .modal-footer {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(10px) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg) !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Ensure modal appears above navigation */
.modal-backdrop {
    z-index: 99400 !important;
}

/* Responsive fixes for splash screen */
@media (max-height: 700px) {
    #splashModal .modal-dialog {
        margin: 0.5rem auto !important;
        width: 95% !important;
    }
    
    #splashModal .modal-body {
        padding: 1rem !important;
    }
}

@media (max-width: 768px) {
    #splashModal .modal-dialog {
        margin: 0.5rem auto !important;
        width: 95% !important;
    }
    
    #splashModal .modal-content {
        border-radius: 12px !important;
    }
    
    #splashModal .modal-body {
        padding: 1rem !important;
        font-size: 0.9rem;
    }
}

/* Force modal to start from top of viewport */
@media screen {
    #splashModal.modal {
        padding-top: 0 !important;
    }
    
    #splashModal .modal-dialog {
        transform: none !important;
        transition: none !important;
    }
}

/* Override Bootstrap modal positioning completely */
#splashModal.modal.show {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 1rem !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

#splashModal.modal.show .modal-dialog {
    position: relative !important;
    width: auto !important;
    max-width: 800px !important;
    margin: 1rem auto !important;
    pointer-events: auto !important;
    transform: none !important;
    display: block !important;
    top: 0 !important;
}

/* Ensure modal content is never cut off */
body.modal-open {
    padding-right: 0 !important;
    overflow: hidden !important;
}

.modal {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Force modal to be visible and properly positioned */
#splashModal .modal-dialog {
    margin: 1rem auto !important;
    max-height: none !important;
    display: block !important;
    align-items: flex-start !important;
    padding-top: 0 !important;
    transform: none !important;
}

/* Additional dropdown fixes */
.dropdown-toggle::after {
    margin-left: 0.5rem;
}

/* Removed dropdown animations since using regular nav items now */

/* Enhanced Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #2d3748;
}

/* PWA specific styles */
@media (display-mode: standalone) {
    body {
        padding-top: 0;
    }
    
    .navbar {
        position: sticky;
        top: 0;
        z-index: 1000;
    }
}

/* Enhanced Cards with Glass Morphism */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    transition: var(--transition-smooth);
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition-smooth);
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    background: rgba(102, 126, 234, 0.05);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    font-weight: 600;
    color: #4a5568;
}

/* Enhanced Buttons with Gradients and Animations */
.btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 12px 24px;
    transition: var(--transition-smooth);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-success {
    background: var(--success-gradient);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
    color: white;
}

.btn-outline-primary {
    border: 2px solid #667eea;
    color: #667eea;
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-2px);
}

/* Enhanced Navigation */
.navbar {
    background: var(--primary-gradient) !important;
    backdrop-filter: var(--glass-backdrop);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-soft);
    padding: 0.5rem 0;
    overflow: visible;
    min-height: 60px;
}

.navbar .container {
    overflow: visible;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar-brand i {
    margin-right: 0.5rem;
    font-size: 1.2em;
}

.navbar-nav {
    overflow: visible !important;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px;
    transition: var(--transition-smooth);
    margin: 0 0.25rem;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    min-width: 70px;
}

.navbar-nav .nav-link:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Stack icons above text */
.navbar-nav .nav-link i {
    margin-right: 0 !important;
    margin-bottom: 0.25rem !important;
    font-size: 1.2em;
    opacity: 0.9;
    display: block !important;
    width: auto !important;
    text-align: center;
}

.navbar-nav .nav-link span {
    font-size: 0.85rem;
    display: block;
    line-height: 1.2;
}

.navbar-nav .nav-link:hover i {
    opacity: 1;
}

/* Ensure Bootstrap Icons load properly */
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css');

/* Fallback for missing icons */
.bi::before {
    font-family: 'bootstrap-icons' !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: -.125em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Force icon visibility */
.navbar-nav .bi {
    display: inline-block !important;
    font-size: inherit !important;
}

/* Ensure all navigation icons are visible */
.nav-link .bi {
    min-width: 1.2em;
    text-align: center;
}

/* Dropdown styles removed since Data and Help are now regular nav items */

/* Enhanced Service Cards */
.service-card {
    transition: var(--transition-bounce);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
}

.service-card.subscribed {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0fff0 100%);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
}

.service-card.subscribed::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    background: var(--success-gradient);
    border-radius: inherit;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
}

.service-card.subscribed::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: var(--success-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Enhanced Show Cards */
.show-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition-smooth);
    position: relative;
}

.show-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.show-card img {
    transition: var(--transition-smooth);
}

.show-card:hover img {
    transform: scale(1.05);
}

/* Enhanced Badges */
.badge {
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 600;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: var(--glass-backdrop);
}

.badge-success {
    background: var(--success-gradient);
    color: white;
}

.badge-primary {
    background: var(--primary-gradient);
    color: white;
}

.badge-warning {
    background: var(--warning-gradient);
    color: white;
}

/* Enhanced Form Controls */
.form-control {
    border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: var(--glass-backdrop);
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: var(--shadow-focus);
    transform: translateY(-1px);
    outline: none;
}

.form-select {
    border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.9);
}

/* Enhanced Service Suggestions */
.border-success {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%) !important;
    border: 2px solid transparent !important;
    background-clip: padding-box;
    position: relative;
}

.border-success::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    background: var(--success-gradient);
    border-radius: inherit;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
}

/* Enhanced Loading States */
.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: shimmer 1.5s infinite;
    opacity: 0.6;
    pointer-events: none;
}

@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Search enhancements */
.search-form {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestion {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-suggestion:hover {
    background-color: #f8f9fa;
}

/* Enhanced Alert System */
.alert {
    border-radius: var(--border-radius);
    border: none;
    backdrop-filter: var(--glass-backdrop);
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
}

.alert-success::before {
    background: var(--success-gradient);
}

.alert-info::before {
    background: var(--primary-gradient);
}

.alert-warning::before {
    background: var(--warning-gradient);
}

.alert-danger::before {
    background: var(--danger-gradient);
}

/* Enhanced Splash Screen Styles */
#splashModal .modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

#splashModal .modal-header {
    border-radius: 16px 16px 0 0;
    background: linear-gradient(135deg, var(--primary-color), #1976D2);
    border-bottom: none;
}

#splashModal .modal-body {
    padding: 2rem;
}

#splashModal .badge {
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
}

#splashModal .alert {
    border-radius: 10px;
    border: none;
}

#splashModal .btn-group .btn {
    border-radius: 8px;
    margin: 0 2px;
}

#splashModal .card {
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

/* Splash screen animation */
#splashModal.show .modal-dialog {
    animation: splashSlideIn 0.5s ease-out;
}

@keyframes splashSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Feature badges hover effect */
#splashModal .badge {
    transition: transform 0.2s ease;
    cursor: default;
}

#splashModal .badge:hover {
    transform: scale(1.05);
}

/* Enhanced Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .navbar-nav {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        margin-top: 1rem;
        padding: 0.5rem;
        backdrop-filter: var(--glass-backdrop);
        overflow: visible !important;
        flex-direction: column !important;
    }
    
    .navbar-nav .nav-link {
        border-radius: 8px;
        margin: 0.1rem 0;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        min-width: auto;
    }
    
    .navbar-nav .nav-link i {
        margin-right: 0.4rem !important;
        margin-bottom: 0 !important;
        font-size: 1em;
        display: inline-block !important;
    }
    
    .navbar-nav .nav-link span {
        font-size: 0.9rem;
        display: inline;
    }
    
    /* Dropdown styles removed - now using regular nav items */
    
    .service-card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Navigation fixes */
    .navbar-nav .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Episode controls mobile layout */
    .card-header .d-flex {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch !important;
    }
    
    .card-header .d-flex > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        justify-content: center;
    }
    
    /* Season filter and controls */
    #seasonFilter {
        min-width: 120px;
        font-size: 0.85rem;
    }
    
    /* Bulk action controls mobile layout */
    #bulkActionControls {
        flex-direction: column !important;
        gap: 0.25rem !important;
        width: 100%;
    }
    
    #bulkActionControls .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
    }
    
    #originalControls {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        width: 100%;
    }
    
    #originalControls .btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    /* Episode cards mobile layout */
    .episode-card {
        margin-bottom: 0.75rem;
    }
    
    .episode-card .card-body {
        padding: 0.5rem;
    }
    
    .episode-card .card-title {
        font-size: 0.9rem;
    }
    
    .episode-card .btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }
    
    /* Episode controls mobile layout */
    .episode-controls {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .bulk-controls {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.25rem;
        width: 100%;
    }
    
    .bulk-controls .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.4rem;
    }
    
    .original-controls {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        width: 100%;
    }
    
    .original-controls .btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    /* Episode checkbox spacing */
    .episode-checkbox {
        margin-right: 0.5rem !important;
    }
    
    /* Selected count badge */
    #selectedCount {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        grid-column: 1 / -1;
        justify-self: center;
        margin-top: 0.25rem;
    }
    
    /* Progress bar mobile */
    .progress {
        height: 8px;
        margin: 0.5rem 0;
    }
    
    /* Show header mobile layout */
    .show-header .row {
        text-align: center;
    }
    
    .show-header img {
        max-width: 200px;
        margin: 0 auto 1rem;
    }
    
    /* Button groups */
    .btn-group-vertical .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* Modal improvements for mobile */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    /* Badge adjustments */
    .badge {
        font-size: 0.7rem;
    }
    
    /* Text size adjustments */
    h5 {
        font-size: 1.1rem;
    }
    
    h6 {
        font-size: 1rem;
    }
    
    small {
        font-size: 0.8rem;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 576px) {
    .container {
        padding: 0 8px;
    }
    
    /* Episode cards in single column */
    .episode-card {
        margin-bottom: 0.5rem;
    }
    
    /* Smaller buttons on very small screens */
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Header controls stack vertically */
    .card-header h5 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    /* Season filter full width on tiny screens */
    #seasonFilter {
        width: 100% !important;
        margin-bottom: 0.25rem;
    }
    
    /* Toggle button full width */
    #toggleSelectionMode {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    /* Bulk controls grid layout */
    #bulkActionControls {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.25rem;
        width: 100%;
    }
    
    #bulkActionControls .btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.3rem;
    }
    
    #selectedCount {
        grid-column: 1 / -1;
        justify-self: center;
        margin-top: 0.25rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #ffffff;
    }
    
    .card {
        background-color: #1e1e1e;
        color: #ffffff;
    }
    
    .bg-light {
        background-color: #2d2d2d !important;
    }
    
    .text-muted {
        color: #adb5bd !important;
    }
}

/* Enhanced Animations and Micro-interactions */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Stagger animation for cards */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }

/* Micro-interactions */
.clickable {
    cursor: pointer;
    transition: var(--transition-smooth);
}

.clickable:hover {
    transform: scale(1.02);
}

/* Enhanced Focus States for Accessibility */
.btn:focus,
.form-control:focus {
    box-shadow: var(--shadow-focus);
    outline: none;
}

.nav-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Enhanced Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-gradient);
}

/* Enhanced Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --glass-bg: rgba(42, 42, 75, 0.9);
        --glass-border: rgba(255, 255, 255, 0.1);
    }
    
    body {
        background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%) !important;
        color: #ffffff !important;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: #ffffff;
    }
    
    .card {
        background: var(--glass-bg) !important;
        color: #ffffff !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }
    
    .form-control {
        background: rgba(42, 42, 75, 0.8);
        color: white;
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .form-control::placeholder {
        color: rgba(255, 255, 255, 0.6);
    }
    
    .service-card.subscribed {
        background: linear-gradient(135deg, rgba(79, 172, 254, 0.2) 0%, rgba(0, 242, 254, 0.2) 100%) !important;
    }
    
    .table {
        color: #ffffff !important;
        background-color: #2d2d2d !important;
    }
    
    .table td, .table th {
        color: #ffffff !important;
        border-color: #404040 !important;
    }
    
    .table-hover tbody tr:hover {
        background-color: #404040 !important;
        color: #ffffff !important;
    }
    
    .text-muted {
        color: #cccccc !important;
    }
    
    .card-header {
        background-color: #404040 !important;
        color: #ffffff !important;
        border-color: #505050 !important;
    }
    
    .service-name {
        color: #ffffff !important;
    }
    
    .table-success td {
        color: #ffffff !important;
        background-color: #1e4d2b !important;
    }
    
    .table-hover .table-success:hover td {
        color: #ffffff !important;
        background-color: #2d5a3a !important;
    }
    
    .table-success .service-name {
        color: #ffffff !important;
    }
    
    /* List group dark mode styles for upcoming episodes */
    .list-group-item {
        background-color: rgba(42, 42, 75, 0.8) !important;
        color: #ffffff !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }
    
    .list-group-item h6 {
        color: #ffffff !important;
    }
    
    .list-group-item p {
        color: #e0e0e0 !important;
    }
    
    .list-group-item:hover {
        background-color: rgba(42, 42, 75, 0.9) !important;
    }
    
    /* Episode item dark mode styles */
    .episode-item {
        background: rgba(42, 42, 75, 0.8) !important;
        color: #ffffff !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
    }
    
    .episode-item h6 {
        color: #ffffff !important;
    }
    
    .episode-item .episode-meta {
        color: #cccccc !important;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    footer {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Performance optimizations */
.card img {
    will-change: transform;
}

.btn {
    will-change: transform;
}

/* Clickable poster styles */
.poster-link {
    display: block;
    text-decoration: none;
}

.poster-link:hover .poster-image,
.poster-link:hover .poster-placeholder {
    transform: scale(1.05);
}

.poster-placeholder {
    border: 2px dashed #dee2e6;
    transition: all 0.2s ease;
}

.poster-link:hover .poster-placeholder {
    border-color: #0d6efd;
    background-color: #f8f9fa !important;
}

[data-bs-theme="dark"] .poster-placeholder {
    border-color: #495057;
    background-color: #343a40 !important;
}

[data-bs-theme="dark"] .poster-link:hover .poster-placeholder {
    border-color: #0d6efd;
    background-color: #495057 !important;
}

/* Calendar Widget Styles */
.calendar-widget {
    max-width: 100%;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    padding: 10px;
    backdrop-filter: var(--glass-backdrop);
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    padding: 8px 4px;
    font-size: 0.8rem;
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
    border-radius: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    min-height: 45px;
}

.calendar-day:hover {
    background: var(--glass-bg);
    transform: scale(1.05);
    box-shadow: var(--shadow-soft);
}

.calendar-day.other-month {
    opacity: 0.3;
    background: #f8f9fa;
}

.calendar-day.today {
    background: var(--primary-gradient);
    color: white;
    font-weight: 600;
}

.calendar-day.has-episodes {
    background: var(--success-gradient);
    color: white;
    font-weight: 500;
}

.calendar-day.has-episodes::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

.calendar-day-number {
    font-size: 0.9rem;
    line-height: 1;
}

.episode-count {
    font-size: 0.6rem;
    opacity: 0.8;
    margin-top: 2px;
}

.calendar-day.has-episodes:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-hover);
}

/* Responsive calendar */
@media (max-width: 768px) {
    .calendar-day {
        min-height: 35px;
        font-size: 0.8rem;
    }
    
    .calendar-day-number {
        font-size: 0.8rem;
    }
    
    .episode-count {
        font-size: 0.5rem;
    }
}

/* Episode modal styles */
#episodeModal {
    z-index: 1060;
}

#episodeModal .modal-backdrop {
    z-index: 1050;
}

#episodeModal .modal-dialog {
    z-index: 1070;
}

#episodeModal .modal-body {
    max-height: 400px;
    overflow-y: auto;
}

.episode-item {
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    transition: var(--transition-smooth);
}

.episode-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.episode-item h6 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.episode-item .episode-meta {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Custom Modal Styles */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.custom-modal-container {
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.custom-modal-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.custom-modal-header {
    padding: 20px 25px 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.custom-modal-header h5 {
    margin: 0;
    font-weight: 600;
    color: #2c3e50;
}

.custom-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.custom-modal-close:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.custom-modal-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
    max-height: 400px;
}

.custom-modal-footer {
    padding: 15px 25px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Episode list styling in custom modal */
.custom-modal-body .episode-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.custom-modal-body .episode-item:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.custom-modal-body .episode-item h6 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-weight: 600;
}

.custom-modal-body .episode-item p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}
