:root {
    --primary: #2196F3;
    --primary-dark: #1976D2;
    --secondary: #000000;
    --accent: #03A9F4;
    --background: #0f0f0f;
    --surface: #1a1a1a;
    --surface-light: #242424;
    --surface-hover: #2a2a2a;
    --text: #ffffff;
    --text-muted: #aaaaaa;
    --text-dim: #777777;
    --success: #4CAF50;
    --warning: #FF9800;
    --info: #2196F3;
    --card-radius: 4px;
    --section-spacing: 60px;
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Custom Bootstrap Overrides */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: var(--card-radius);
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: scale(1.05);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    border-radius: var(--card-radius);
    font-weight: 500;
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.bg-dark {
    background-color: var(--background) !important;
}

.bg-surface {
    background-color: var(--surface) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.card {
    background-color: var(--surface);
    border: none;
    border-radius: var(--card-radius);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.navbar {
    background-color: rgba(15, 15, 15, 0.95) !important;
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    transition: all 0.3s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar.scrolled {
    background-color: var(--background) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.navbar-brand {
    font-weight: 900;
    font-size: 1.8rem;
    color: var(--text) !important;
}

.nav-link {
    color: var(--text) !important;
    font-weight: 500;
    position: relative;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary) !important;
}

.navbar-toggler {
    border: none;
    color: var(--text);
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Enhanced Search Styling */
.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.search-input {
    background: var(--surface) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    color: var(--text) !important;
    padding: 10px 50px 10px 15px;
    border-radius: 30px !important;
    transition: all 0.3s;
    width: 100%;
}

.search-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25) !important;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    border-radius: 0 30px 30px 0 !important;
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    padding: 0 20px;
    background: var(--primary);
    border: none;
    color: white;
    z-index: 2;
}

.clear-btn {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    padding: 5px 8px;
    border-radius: 50%;
    transition: all 0.3s;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.clear-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Landing Search Section */
.landing-search-section {
    padding: 80px 0;
    background: var(--surface);
    text-align: center;
}

.landing-search-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--primary);
}

.landing-search-subtitle {
    font-size: 1.2rem;
    margin-bottom: 40px;
    color: var(--text-muted);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.landing-search-container {
    max-width: 700px;
    margin: 0 auto;
}

/* Content Grid Sections */
.content-section {
    padding: 40px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--primary);
}

/* Content Grid Styles */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.content-card {
    cursor: pointer;
    border-radius: var(--card-radius);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.card-poster {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
}

.card-info {
    padding: 15px;
}

.card-title {
    font-size: 16px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

.card-rating {
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Features Section */
.features-section {
    padding: 80px 0;
    background: var(--surface);
}

.feature-card {
    text-align: center;
    padding: 30px 20px;
    border-radius: var(--card-radius);
    transition: transform 0.3s;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-10px);
}

.feature-icon-large {
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 20px;
}

.feature-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.feature-description {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* Footer */
footer {
    padding: 60px 0 30px;
    background: var(--surface);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    text-align: center;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.social-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s;
}

.social-link:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

/* Updated Footer Bottom */
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    color: var(--text-muted);
}

.made-with-love {
    display: flex;
    align-items: center;
    gap: 5px;
}

.heart {
    color: var(--primary);
}

/* Content Preview Modal */
.preview-modal .modal-content {
    background: var(--surface);
    border-radius: var(--card-radius);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: none;
}

.preview-modal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    flex-shrink: 0;
}

.preview-modal .modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.preview-hero {
    height: 250px;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 30px;
    flex-shrink: 0;
}

.preview-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, var(--surface) 0%, transparent 60%);
}

.preview-details {
    position: relative;
    z-index: 2;
    width: 100%;
}

.preview-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 15px;
    font-weight: 900;
}

.preview-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.preview-rating {
    color: var(--success);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.preview-year, .preview-type, .preview-duration {
    color: var(--text-muted);
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 14px;
}

.preview-overview {
    margin-bottom: 20px;
    line-height: 1.6;
    color: var(--text);
    font-size: 1rem;
    max-height: 120px;
    overflow-y: auto;
    padding-right: 10px;
}

.preview-overview::-webkit-scrollbar {
    width: 4px;
}

.preview-overview::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.preview-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.feature-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-text {
    display: flex;
    flex-direction: column;
}

.feature-label {
    font-size: 12px;
    color: var(--text-muted);
}

.feature-value {
    font-size: 14px;
    font-weight: 500;
}

/* Updated Episode Controls for longer text */
.episode-controls {
    display: none;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.episode-controls span {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
}

.episode-controls select {
    padding: 8px 12px;
    border-radius: 4px;
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    min-width: 120px;
    cursor: pointer;
    transition: all 0.3s;
}

.episode-controls select:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.episode-controls select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* Source Selector */
.source-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.source-label {
    font-size: 14px;
    color: var(--text-muted);
}

.source-btn {
    padding: 6px 12px;
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--surface-light);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
}

.source-btn.active {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.preview-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Player Modal */
.player-modal .modal-content {
    background: #000;
    border-radius: var(--card-radius);
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
    border: none;
}

.player-modal .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 15px;
}

.player-modal .modal-body {
    padding: 0;
}

.player-iframe {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    position: relative;
}

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

/* Search Results */
#searchResultsSection {
    display: none;
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .card-poster {
        height: 200px;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .preview-features {
        grid-template-columns: 1fr;
    }
    
    .source-selector, .episode-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .preview-hero {
        height: 200px;
        padding: 20px;
    }
    
    .player-modal .modal-dialog {
        max-width: 95%;
        margin: 10px auto;
    }

    .search-container {
        max-width: 100%;
        margin-top: 10px;
    }
    
    .landing-search-title {
        font-size: 2rem;
    }
    
    .clear-btn {
        right: 55px;
    }
    
    /* Episode controls responsive */
    .episode-controls {
        gap: 8px;
    }
    
    .episode-controls select {
        min-width: 100px;
        padding: 6px 10px;
    }
}

@media (max-width: 576px) {
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .card-poster {
        height: 180px;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .preview-hero {
        height: 180px;
        padding: 15px;
    }
    
    .landing-search-title {
        font-size: 1.8rem;
    }
    
    .clear-btn {
        right: 50px;
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .search-input {
        padding: 8px 45px 8px 15px;
    }
    
    /* Episode controls mobile optimization */
    .episode-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .episode-controls > div {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
    }
    
    .episode-controls select {
        min-width: 80px;
        flex: 1;
        padding: 6px 8px;
        font-size: 13px;
    }
    
    .episode-controls span {
        font-size: 13px;
        min-width: 60px;
    }
}

@media (min-width: 1200px) {
    .content-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 25px;
    }
    
    .card-poster {
        height: 280px;
    }
    
    .search-container {
        max-width: 600px;
    }
    
    /* Episode controls desktop optimization */
    .episode-controls select {
        min-width: 140px;
    }
}
