/* Dark Theme General Styles */
body {
    background-color: #121212;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.container {
    padding: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    background-color: #121212;
}

/* Dark Theme Card Styles */
.card {
    border: 1px solid #333333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    background-color: #1e1e1e;
    color: #ffffff;
}

/* Dark Theme Media Card Styles */
.media-card {
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid #333333;
    overflow: hidden;
    background-color: #1e1e1e;
    position: relative;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.media-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

.media-card .card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.media-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.media-card .card-text {
    flex-grow: 1;
}

.media-card img {
    height: 240px;
    object-fit: cover;
}

.media-card .card-img-top {
    height: 320px;
    object-fit: cover;
}

.media-card .card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.media-card .card-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-card .card-text {
    font-size: 0.85rem;
    color: #b0b0b0;
    flex-grow: 1;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    overflow: hidden;
}

.media-card .card-title {
    color: #ffffff;
    font-weight: 600;
}

.media-card .badge {
    position: absolute;
    top: 10px;
    background-color: rgba(255, 87, 34, 0.9);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.media-card .type-badge {
    background-color: rgba(33, 150, 243, 0.9);
    left: 10px;
}

/* Clickable card effect */
.clickable-card {
    cursor: pointer;
}

/* Dark Theme Detail View Styles */
#detailPoster {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* Dark Theme History Styles */
.history-item {
    cursor: pointer;
    background-color: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.history-item:hover {
    background-color: #2a2a2a;
    transform: translateX(4px);
    transition: all 0.2s ease;
}

/* Dark Theme Episode Styles */
.episode-item {
    background-color: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.episode-item:hover {
    background-color: #2a2a2a;
    transition: background-color 0.2s ease;
}

/* Dark Theme Player Styles */
#player {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background-color: #000;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

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

/* Dark Theme Badge Styles */
.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    background-color: #FF5722;
    border-radius: 6px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .card-img-top {
        height: 250px !important;
    }

    #detailPoster {
        margin-bottom: 1.5rem;
    }
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Dark Theme Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 6px;
    border: 2px solid #1e1e1e;
}

::-webkit-scrollbar-thumb:hover {
    background: #555555;
}

/* Utility Classes */
.cursor-pointer {
    cursor: pointer;
}

.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Custom Checkbox */
.custom-checkbox {
    min-height: 1.5rem;
    padding-left: 1.5em;
    margin-bottom: 0.125rem;
}

.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before {
    background-color: #FF5722;
}


/* Dark Theme Homepage Styles */
.homepage-section {
    margin-bottom: 3rem;
}

.homepage-section h4 {
    color: #ffffff;
    font-weight: 700;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    letter-spacing: -0.02em;
}

/* Dark Theme Continue Watching Cards */
.continue-watching-card {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.continue-watching-card:hover {
    transform: scale(1.02);
}

.continue-watching-card .continue-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.continue-watching-card .continue-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Dark Theme Enhanced Media Cards */
.media-card .card {
    border: 1px solid #333333;
    background-color: #1e1e1e;
}

/* Dark Theme Search Results Enhancement */
#results .col-md-4,
#results .col-lg-3 {
    margin-bottom: 2rem;
}


/* Dark Theme Responsive Improvements */
@media (max-width: 768px) {
    .homepage-section h4 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .continue-watching-card,
    .media-card {
        margin-bottom: 1.5rem;
    }

    .col-md-4,
    .col-lg-3 {
        flex: 0 0 auto;
        width: 50%;
    }
}

@media (max-width: 576px) {
    .col-md-4,
    .col-lg-3 {
        width: 100%;
    }

    .homepage-section {
        margin-bottom: 2rem;
    }
}

/* Dark Theme Button Styles */
.btn-primary {
    background-color: #FF5722;
    border-color: #FF5722;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #E64A19;
    border-color: #D84315;
}

.btn-secondary {
    background-color: #444444;
    border-color: #444444;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #555555;
    border-color: #555555;
}

.btn-outline-primary {
    color: #FF5722;
    border-color: #FF5722;
}

.btn-outline-primary:hover {
    background-color: #FF5722;
    border-color: #FF5722;
}

.btn-outline-secondary {
    color: #888888;
    border-color: #444444;
}

.btn-outline-secondary:hover {
    background-color: #444444;
    border-color: #444444;
    color: #ffffff;
}

/* Dark Theme Form Styles */
.form-control {
    background-color: #2a2a2a;
    border-color: #444444;
    color: #ffffff;
}

.form-control:focus {
    background-color: #2a2a2a;
    border-color: #FF5722;
    color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(255, 87, 34, 0.25);
}

.form-control::placeholder {
    color: #888888;
}

/* Dark Theme Text Colors */
.text-muted {
    color: #888888 !important;
}

h1, h2, h3, h4, h5, h6 {
    color: #ffffff;
}

/* Dark Theme Progress Bar */
.progress {
    background-color: #333333;
}

.progress-bar {
    background-color: #FF5722;
}

/* Dark Theme Collapse/Accordion */
.card-header {
    background-color: #2a2a2a;
    border-bottom: 1px solid #444444;
    color: #ffffff;
}

.card-body {
    background-color: #1e1e1e;
    color: #ffffff;
}

/* Dark Theme Border Colors */
.border-bottom {
    border-bottom-color: #444444 !important;
}

/* Grid Layout Improvements */
.row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.row > * {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Ensure consistent card heights in grid */
.media-card .card-img-top {
    border-radius: 8px 8px 0 0;
}

/* Better mobile responsiveness for 4-column layout */
@media (min-width: 992px) {
    .col-lg-3 {
        flex: 0 0 auto;
        width: 25%; /* Exactly 4 per row on large screens (992px+) */
    }
}

/* Removed: Force 3 per row rule - now maintains 4 per row consistently */

/* Enhanced hover effects */
.media-card:hover .card-img-top {
    filter: brightness(1.1);
    transition: filter 0.2s ease;
}

/* Hover effect for clickable images */
.media-card img:hover,
.continue-watching-card .continue-img:hover {
    filter: brightness(1.2);
    transition: filter 0.2s ease;
}

/* Visual feedback for image clicks */
.media-card img,
.continue-watching-card .continue-img {
    transition: filter 0.2s ease, transform 0.2s ease;
}

.media-card img:active,
.continue-watching-card .continue-img:active {
    transform: scale(0.98);
}

/* Play icon overlay on images */
.media-card .position-relative::before,
.continue-watching-card .position-relative::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    opacity: 0.4;
    transition: opacity 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.media-card .position-relative::after,
.continue-watching-card .position-relative::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.6);
    opacity: 0.4;
    transition: opacity 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 3;
}

.media-card .position-relative:hover::before,
.continue-watching-card .position-relative:hover::before {
    opacity: 1;
    background-color: rgba(255, 87, 34, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

.media-card .position-relative:hover::after,
.continue-watching-card .position-relative:hover::after {
    opacity: 1;
    border-color: transparent transparent transparent rgba(255, 255, 255, 1);
    transform: translate(-40%, -50%) scale(1.1);
}

/* Loading state improvements */
.loading-placeholder {
    background: linear-gradient(90deg, #2a2a2a 25%, #333333 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Episode Navigation Styles */
#episodeNavigation {
    background-color: #1e1e1e;
    border: 1px solid #333333;
    border-radius: 8px;
    padding: 1rem;
}

#episodeNavigation .btn {
    min-width: 180px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#episodeNavigation .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#episodeNavigation .btn-outline-primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
}

#episodeNavigation .btn i {
    font-size: 0.9rem;
}

/* Responsive episode navigation */
@media (max-width: 768px) {
    #episodeNavigation .d-flex {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    #episodeNavigation .btn {
        min-width: 100%;
        justify-content: center;
    }
}
