/* Custom styles for Binge-Worthy - Refactored with Bootstrap 5.3 */

/* Override Bootstrap text-muted for better contrast on dark background */
.text-muted {
    color: #d0d0d0 !important;
}

/* Global styles */
body {
    background-color: #141414;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navigation */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    color: #e50914 !important;
}

.navbar-nav .nav-link {
    color: #ffffff !important;
}

.navbar-nav .nav-link:hover {
    color: #e50914 !important;
}

/* Hero section */
.hero-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.hero-content {
    max-width: 600px;
}

.hero-title {
    font-size: 3rem;
    font-weight: bold;
    color: #e50914;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: #d0d0d0;
}

/* Video sections */
.section-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffffff;
}

.video-row {
    gap: 1rem;
    overflow-x: auto;
    align-items: stretch;
    display: flex;
}

.video-row::-webkit-scrollbar {
    height: 8px;
}

.video-row::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 4px;
}

.video-row::-webkit-scrollbar-thumb {
    background: #e50914;
    border-radius: 4px;
}

.video-row::-webkit-scrollbar-thumb:hover {
    background: #b20710;
}

/* Video cards */
.video-card {
    flex: 0 0 300px;
    background: #2d2d2d;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.video-card:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.video-thumbnail {
    position: relative;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

/* Thumbnail placeholder styling */
.thumbnail-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #404040 0%, #2d2d2d 100%);
    border-radius: 4px;
    color: #888;
    font-size: 2rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.video-card:hover .thumbnail-placeholder {
    transform: scale(1.1);
}

/* Channel placeholder styling */
.channel-placeholder {
    background: linear-gradient(135deg, #e50914 0%, #b20710 100%);
    color: #ffffff;
}

.channel-placeholder .placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.channel-placeholder .placeholder-text {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.1);
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-channel {
    font-size: 0.9rem;
    color: #d0d0d0;
}

.video-category {
    font-size: 0.8rem;
    color: #e50914;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Search page styles */
.video-card-search {
    background: #2d2d2d;
    border: none;
    transition: transform 0.3s ease;
}

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

.video-card-search .card-img-top {
    height: 200px;
    object-fit: cover;
    cursor: pointer;
}

.video-card-search .card-body {
    background: #2d2d2d;
    color: #ffffff;
}

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

.video-card-search .card-text {
    color: #d0d0d0;
}

/* Channel card styles */
.channel-card {
    background: #2d2d2d;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
}

/* Make Bootstrap row behave like horizontal scrolling row for new channels section */
.video-section .row.g-4 {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1rem;
}

/* Make the columns in horizontal row have fixed width and equal height */
.video-section .row.g-4 > .col-lg-3 {
    flex: 0 0 300px;
    max-width: 300px;
}

/* Custom scrollbar for horizontal channel rows */
.video-section .row.g-4::-webkit-scrollbar {
    height: 8px;
}

.video-section .row.g-4::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 4px;
}

.video-section .row.g-4::-webkit-scrollbar-thumb {
    background: #e50914;
    border-radius: 4px;
}

.video-section .row.g-4::-webkit-scrollbar-thumb:hover {
    background: #b20710;
}

.channel-card:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.channel-thumbnail {
    position: relative;
    overflow: hidden;
}

.channel-thumbnail img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.3s ease;
    background-color: #404040;
    cursor: pointer;
}

.channel-card:hover .channel-thumbnail img {
    transform: scale(1.1);
}

.channel-thumbnail-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #e50914 0%, #b20710 100%);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.channel-card:hover .channel-thumbnail-placeholder {
    transform: scale(1.1);
}

.channel-thumbnail-placeholder .placeholder-icon {
    font-size: 3rem;
    color: #ffffff;
    opacity: 0.9;
}

.channel-title {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.channel-title a {
    color: #ffffff !important;
    text-decoration: none;
    cursor: pointer;
}

.channel-title a:hover {
    color: #e50914 !important;
}

/* Non-clickable channel text areas should have default cursor */
.channel-info,
.channel-description,
.channel-stats,
.channel-categories {
    cursor: default;
}

/* Ensure buttons have pointer cursor */
.channel-actions .btn {
    cursor: pointer;
}

.channel-description {
    font-size: 0.875rem;
    color: #d0d0d0;
    line-height: 1.4;
}

.channel-date {
    font-size: 0.75rem;
    color: #888888;
}

/* Admin page styles */
.card {
    background: #2d2d2d;
    border: none;
    color: #ffffff;
}

.card-header {
    background: #1a1a1a;
    border-bottom: 1px solid #404040;
    color: #ffffff;
}

.card-header h3 {
    color: #ffffff;
}

.form-control, .form-select {
    background: #404040;
    border: 1px solid #555555;
    color: #ffffff;
}

.form-control:focus, .form-select:focus {
    background: #404040;
    border-color: #e50914;
    box-shadow: 0 0 0 0.2rem rgba(229, 9, 20, 0.25);
    color: #ffffff;
}

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

.form-label {
    color: #e0e0e0;
    font-weight: 600;
}

.form-text {
    color: #c0c0c0;
    font-size: 0.875rem;
}

/* Buttons */
.btn-primary {
    background-color: #e50914;
    border-color: #e50914;
    color: #ffffff !important;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: #b20710;
    border-color: #b20710;
    color: #ffffff !important;
}

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

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

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

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

.btn-sm {
    font-size: 0.875rem;
}

/* Disabled buttons - dark styling */
.btn:disabled,
.btn.disabled {
    background-color: #343a40 !important;
    border-color: #343a40 !important;
    color: #6c757d !important;
    opacity: 0.8;
    cursor: not-allowed;
}

/* Alerts */
.alert-success {
    background-color: #155724;
    border-color: #c3e6cb;
    color: #d4edda;
}

.alert-danger {
    background-color: #721c24;
    border-color: #f5c6cb;
    color: #f8d7da;
}

.alert-info {
    background-color: #0c5460;
    border-color: #b8daff;
    color: #d1ecf1;
}

/* List groups */
.list-group-item {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #ffffff;
}

.list-group-item:hover {
    background-color: #404040;
    color: #ffffff;
}

.list-group-item-action:hover {
    background-color: #404040;
}

/* Channel page styles */
.channel-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.channel-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e50914;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}

.channel-avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e50914 0%, #b20710 100%);
    border: 3px solid #e50914;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}

.channel-avatar-placeholder .placeholder-icon {
    font-size: 3rem;
    color: #ffffff;
    opacity: 0.9;
}

.channel-name {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.channel-description {
    font-size: 1.1rem;
    color: #d0d0d0;
    line-height: 1.6;
}

.channel-stats .badge {
    font-size: 0.9rem;
    border-radius: 20px;
}

.video-date {
    font-size: 0.8rem;
    color: #999;
}

/* Categories page styles */
.categories-page-title {
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.category-button {
    background: #404040;
    border-radius: 25px;
    text-decoration: none;
    color: #ffffff;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-weight: 500;
    white-space: nowrap;
    padding: 2px 8px;
}

.category-button:hover {
    background: #555555;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.category-button.active {
    background: #e50914;
    border-color: #b20710;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
}

.category-button.active:hover {
    background: #b20710;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 9, 20, 0.5);
}

.category-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.category-count {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    min-width: 1.5rem;
}

.category-button.active .category-count {
    background: rgba(255, 255, 255, 0.3);
}

.category-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.no-videos-message {
    background: #2d2d2d;
    border-radius: 12px;
}

.no-videos-icon {
    font-size: 4rem;
    opacity: 0.6;
}

.no-videos-message h4 {
    color: #ffffff;
    font-size: 1.5rem;
}

.no-videos-message p {
    color: #d0d0d0;
    font-size: 1.1rem;
}

.no-category-selected h3 {
    color: #ffffff;
}

.channel-link {
    color: #d0d0d0;
    text-decoration: none;
    transition: color 0.3s ease;
}

.channel-link:hover {
    color: #e50914;
    text-decoration: underline;
}

/* Footer styles */
.footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-top: 1px solid #404040;
}

.footer-title {
    color: #e50914;
    font-weight: bold;
    font-size: 1.3rem;
}

.footer-text {
    color: #d0d0d0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.footer-link {
    color: #d0d0d0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #e50914;
    text-decoration: none;
}

.footer-divider {
    border-color: #404040;
}

/* Responsive design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .video-card {
        flex: 0 0 250px;
    }
    
    .channel-name {
        font-size: 2rem;
    }
    
    .channel-avatar,
    .channel-avatar-placeholder {
        width: 100px;
        height: 100px;
    }
    
    .channel-avatar-placeholder .placeholder-icon {
        font-size: 2.5rem;
    }
    
    .categories-page-title {
        font-size: 1.5rem;
    }
    
    .category-button {
        font-size: 0.9rem;
        min-width: 200px;
    }
    
    .category-title {
        font-size: 1.3rem;
    }
    
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .no-videos-icon {
        font-size: 3rem;
    }
}

/* About Page Styles */
.about-content h1 {
    color: #e50914;
    font-weight: bold;
}

.about-content .hero-section {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 12px;
}

.about-content .hero-section h2 {
    color: #d0d0d0;
    font-weight: 300;
}

.about-content .lead {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #ffffff;
}

.about-content h3 {
    color: #e50914;
    font-weight: 600;
}

.about-content p {
    color: #d0d0d0;
    line-height: 1.6;
}

.feature-card {
    background: #2d2d2d;
    border-radius: 8px;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(229, 9, 20, 0.2);
}

.feature-card h4 {
    color: #ffffff;
    font-weight: 600;
}

.feature-card p {
    color: #d0d0d0;
    line-height: 1.5;
}

.about-content .btn-primary {
    background-color: #e50914;
    border-color: #e50914;
    color: #ffffff !important;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* Even more specific rule for the browse button */
a.btn.btn-primary.btn-lg {
    color: #ffffff !important;
    text-decoration: none !important;
}

.about-content .btn-primary:hover {
    background-color: #b20710;
    border-color: #b20710;
    color: #ffffff !important;
    transform: translateY(-2px);
}

.about-content .btn-outline-primary {
    border-color: #e50914;
    color: #e50914;
    font-weight: 600;
    transition: all 0.3s ease;
}

.about-content .btn-outline-primary:hover {
    background-color: #e50914;
    border-color: #e50914;
    color: #ffffff;
    transform: translateY(-2px);
}

.about-content a {
    color: #e50914;
    text-decoration: none;
    transition: color 0.3s ease;
}

.about-content a:hover {
    color: #b20710;
}

@media (max-width: 768px) {
    .about-content h1 {
        font-size: 2rem;
    }
    
    .about-content .lead {
        font-size: 1.1rem;
    }
    
    .about-content .btn-lg {
        font-size: 1rem;
    }
}

/* Suggestion form */
.suggestion-section {
    margin-top: 3rem;
}

.suggestion-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.suggestion-form .form-control {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.suggestion-form .form-control:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: #e50914;
    box-shadow: 0 0 0 0.2rem rgba(229, 9, 20, 0.25);
    color: #ffffff;
}

.suggestion-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.suggestion-form .btn-primary {
    background-color: #e50914;
    border-color: #e50914;
    font-weight: 500;
    min-width: 100px;
}

.suggestion-form .btn-primary:hover {
    background-color: #b8070f;
    border-color: #b8070f;
}

.suggestion-form .btn-primary:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    opacity: 0.8;
}

/* Suggestion toast */
#suggestionToast .toast {
    min-width: 300px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

#suggestionToast .toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Team member styles */
.team-member {
    flex: 1 1 auto;
    margin: 0 10px;
    max-width: 180px;
}

.team-member__image {
    width: 100%;
    height: auto;
    max-width: 180px;
    border: 1px solid #e50914;
    border-radius: 8px;
    padding: 8px;
    background-color: #bbb;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.team-member__image:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(229, 9, 20, 0.3);
}

.team-member h5 {
    color: #ffffff;
    font-size: 1rem;
    margin-bottom: 10px;
}

/* Video Player Styles */
.video-player-container {
    margin-top: 0;
    background: #141414;
    width: 100%;
    padding: 3rem;
}

.video-player-wrapper {
    position: relative;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    background: #000000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Custom Fullscreen Button */
.custom-fullscreen-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 1001;
    font-size: 16px;
    transition: background 0.3s ease;
}

.custom-fullscreen-btn:hover {
    background: rgba(229, 9, 20, 0.8);
}

/* Custom Fullscreen Mode */
.custom-fullscreen-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
    background: #000000 !important;
}

body.fullscreen-mode {
    overflow: hidden;
}

body.fullscreen-mode * {
    cursor: none;
}

body.fullscreen-mode *:hover {
    cursor: pointer;
}

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

.fullscreen-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    border: none;
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, opacity 0.3s ease, transform 0.2s ease;
    z-index: 15;
    opacity: 0.9;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

.fullscreen-button:hover,
.fullscreen-button:focus {
    background: rgba(229, 9, 20, 0.9);
    opacity: 1;
    outline: none;
}

.fullscreen-button:active {
    transform: scale(0.95);
    background: rgba(229, 9, 20, 1);
}

/* Video container like Scrubbler */
.video-container {
    position: relative;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    background: #000;
}

/* iOS Fullscreen Mode */
body.ios-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
    padding-top: env(safe-area-inset-top);
}

.ios-fullscreen .video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border-radius: 0;
    z-index: 9999;
}

.ios-fullscreen .video-player-iframe {
    width: 100vw !important;
    height: 56.25vw !important; /* 16:9 aspect ratio */
    max-height: 100vh !important;
    object-fit: contain;
}

/* Standard fullscreen styles */
.video-container:fullscreen {
    background-color: black;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container:fullscreen .video-player-iframe {
    width: 100vw !important;
    height: 56.25vw !important; /* 16:9 aspect ratio */
    max-height: 100vh !important;
    max-width: none !important;
    object-fit: contain;
}

/* WebKit fullscreen styles */
.video-container:-webkit-full-screen {
    background-color: black;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container:-webkit-full-screen .video-player-iframe {
    width: 100vw !important;
    height: 56.25vw !important; /* 16:9 aspect ratio */
    max-height: 100vh !important;
    max-width: none !important;
    object-fit: contain;
}

/* Firefox fullscreen styles */
.video-container:-moz-full-screen {
    background-color: black;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container:-moz-full-screen .video-player-iframe {
    width: 100vw !important;
    height: 56.25vw !important; /* 16:9 aspect ratio */
    max-height: 100vh !important;
    max-width: none !important;
    object-fit: contain;
}

/* Mobile Controls from Scrubbler */
.mobile-controls {
    display: none; /* Hidden by default, shown on mobile/tablet */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px;
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    padding: 8px;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    flex: 1;
    max-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.control-btn:hover {
    transform: scale(1.1);
    color: #e50914;
    background-color: rgba(255, 255, 255, 0.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn i {
    pointer-events: none;
}

/* Hide fullscreen button when in fullscreen mode */
.video-container:fullscreen .fullscreen-button,
.video-container:-webkit-full-screen .fullscreen-button,
.video-container:-moz-full-screen .fullscreen-button,
body.custom-fullscreen-active .fullscreen-button,
.video-container.custom-fullscreen-active .fullscreen-button,
.ios-fullscreen .fullscreen-button {
    display: none !important;
}

/* Mobile controls in fullscreen */
.video-container:fullscreen .mobile-controls,
.video-container:-webkit-full-screen .mobile-controls,
.video-container:-moz-full-screen .mobile-controls,
body.custom-fullscreen-active .mobile-controls,
.ios-fullscreen .mobile-controls {
    display: flex !important;
    position: fixed;
    top: 0;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    z-index: 10000;
    height: 50px;
}

.ios-fullscreen .mobile-controls {
    top: env(safe-area-inset-top);
    padding-top: 0;
    margin-top: 0;
}

.video-player-info {
    padding: 0;
}

.video-player-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.video-player-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.video-player-channel {
    color: #e50914;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.video-player-channel:hover {
    color: #b20710;
    text-decoration: underline;
}

.video-player-date {
    color: #d0d0d0;
    font-size: 0.9rem;
}

.video-player-description {
    margin-top: 1rem;
    padding: 1rem;
    background: #2d2d2d;
    border-radius: 8px;
}

.video-player-description p {
    color: #d0d0d0;
    line-height: 1.6;
    margin: 0;
}

.video-player-related,
.video-player-suggested {
    margin-top: 2rem;
}

.video-player-related h3,
.video-player-suggested h3 {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.video-card__link {
    text-decoration: none;
    color: inherit;
}

.video-card__link:hover {
    text-decoration: none;
    color: inherit;
}

.video-card__thumbnail-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.video-card__thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .video-card__thumbnail {
    transform: scale(1.05);
}

.video-card__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.video-card__channel {
    font-size: 0.85rem;
    color: #d0d0d0;
    margin: 0;
}

/* Fullscreen Overlay Container */
.fullscreen-overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks through to video when overlay is hidden */
    z-index: 1000;
}

/* Video End Overlay Styles */
.video-end-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 20, 20, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
    pointer-events: none;
}

/* Fullscreen overlay styles */
.video-end-overlay.fullscreen-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999999 !important; /* Extremely high z-index */
    border-radius: 0 !important;
    background: rgba(20, 20, 20, 0.95) !important;
    pointer-events: auto !important;
}

/* Additional fullscreen overlay styles for maximum visibility */
#fullscreen-video-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999999 !important;
    background: rgba(20, 20, 20, 0.95) !important;
}

/* Force hide YouTube's fullscreen button */
.ytp-fullscreen-button {
    display: none !important;
}

/* Also hide it by other selectors */
button[aria-label*="fullscreen"],
button[aria-label*="Fullscreen"],
.ytp-button[aria-label*="fullscreen"],
.ytp-button[aria-label*="Fullscreen"] {
    display: none !important;
}

.video-end-overlay.show {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Re-enable pointer events when shown */
}

.overlay-content {
    width: 90%;
    max-width: 900px;
    text-align: center;
    padding: 2rem;
}

.overlay-title {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.overlay-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.overlay-section h4 {
    color: #e50914;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.overlay-videos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    justify-content: center;
}

.overlay-video-card {
    background: #2d2d2d;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.overlay-video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(229, 9, 20, 0.3);
}

.overlay-video-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.overlay-video-info {
    padding: 0.75rem;
}

.overlay-video-title {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.overlay-video-channel {
    color: #d0d0d0;
    font-size: 0.8rem;
    margin: 0;
}

/* Next Video Styles */
.next-video-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.next-video-card {
    display: flex;
    background: #2d2d2d;
    border-radius: 12px;
    overflow: hidden;
    max-width: 500px;
    width: 100%;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.next-video-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(229, 9, 20, 0.4);
}

.next-video-thumbnail-container {
    position: relative;
    flex-shrink: 0;
    width: 180px;
}

.next-video-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.countdown-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.countdown-circle {
    width: 50px;
    height: 50px;
    background: rgba(229, 9, 20, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    animation: countdownPulse 1s infinite;
}

@keyframes countdownPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.next-video-info {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.next-video-title {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.next-video-channel {
    color: #e50914;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.next-video-countdown {
    color: #d0d0d0;
    font-size: 0.8rem;
    margin: 0;
    font-style: italic;
}

.overlay-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s ease;
}

.overlay-close:hover {
    background: rgba(229, 9, 20, 0.8);
}

@media (max-width: 768px) {
    .video-player-container {
        padding: 0.25rem;
    }
    
    .video-player-wrapper {
        aspect-ratio: 16 / 9;
    }
    
    .video-player-title {
        font-size: 1.25rem;
    }
    
    .video-player-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* Make fullscreen button smaller and closer to corner on mobile */
    .fullscreen-button {
        top: 0.25rem;
        right: 0.25rem;
        width: 30px;
        height: 30px;
        padding: 5px;
    }
    
    .fullscreen-button svg {
        width: 16px;
        height: 16px;
    }
    
    /* Force overlay to be scrollable on mobile and position at top */
    .video-end-overlay {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .video-end-overlay.show {
        align-items: flex-start !important; /* Align to top instead of center */
        padding-top: 0.5rem; /* Reduced padding from top */
        padding-bottom: 0.5rem; /* Add padding at bottom too */
    }
    
    .overlay-content {
        padding: 0.5rem;
        width: 95%;
        max-height: none; /* Remove height restriction */
        overflow-y: visible; /* Let parent handle scrolling */
    }
    
    /* Make overlay super compact in portrait mode */
    @media (orientation: portrait) {
        .video-end-overlay {
            align-items: center !important;
            justify-content: center !important;
        }
        
        .video-end-overlay .overlay-content {
            padding: 0.25rem !important;
            width: 98% !important;
            max-height: 70vh !important;
            overflow: hidden !important;
        }
        
        .video-end-overlay .overlay-sections {
            gap: 0.2rem !important;
        }
        
        .video-end-overlay .overlay-section h4 {
            font-size: 0.7rem !important;
            margin-bottom: 0.2rem !important;
        }
        
        .video-end-overlay .next-video-card {
            min-height: 50px !important;
            padding: 0.2rem !important;
        }
        
        .video-end-overlay .next-video-thumbnail {
            width: 70px !important;
            height: 40px !important;
        }
        
        .video-end-overlay .next-video-info {
            padding: 0.3rem !important;
        }
        
        .video-end-overlay .next-video-title {
            font-size: 0.75rem !important;
            line-height: 1.1 !important;
            margin-bottom: 0.1rem !important;
        }
        
        .video-end-overlay .next-video-countdown {
            font-size: 0.65rem !important;
        }
        
        .video-end-overlay .overlay-videos {
            grid-template-columns: repeat(3, 1fr) !important;
            gap: 0.2rem !important;
        }
        
        .video-end-overlay .overlay-video-card {
            padding: 0 !important;
        }
        
        .video-end-overlay .overlay-video-thumbnail {
            height: 40px !important;
        }
        
        .video-end-overlay .overlay-video-info {
            padding: 0.2rem !important;
        }
        
        .video-end-overlay .overlay-video-title {
            font-size: 0.65rem !important;
            line-height: 1.1 !important;
            -webkit-line-clamp: 2 !important;
        }
    }

    /* Fix for fullscreen landscape mode */
    @media (orientation: landscape) {
        /* Ensure fullscreen containers are properly sized */
        .video-container:fullscreen,
        .video-container:-webkit-full-screen,
        .video-container:-moz-full-screen {
            width: 100vw !important;
            height: 100vh !important;
            padding: 0 !important;
            margin: 0 !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
        }
        
        /* Fix video cutoff in fullscreen landscape - use safer dimensions */
        .video-container:fullscreen .video-player-iframe,
        .video-container:-webkit-full-screen .video-player-iframe,
        .video-container:-moz-full-screen .video-player-iframe {
            width: 90vw !important;
            height: 50.625vw !important; /* 16:9 aspect ratio based on 90vw */
            max-width: 90vw !important;
            max-height: 90vh !important;
            object-fit: contain !important;
            position: relative !important;
        }
        
        .ios-fullscreen .video-player-iframe {
            width: 90vw !important;
            height: 50.625vw !important; /* 16:9 aspect ratio based on 90vw */
            max-width: 90vw !important;
            max-height: 90vh !important;
            object-fit: contain !important;
            position: relative !important;
        }
        
        /* Make overlay match video size in fullscreen landscape */
        .video-end-overlay.fullscreen-overlay {
            width: 90vw !important;
            height: 50.625vw !important; /* Same as video: 16:9 aspect ratio */
            max-width: 90vw !important;
            max-height: 90vh !important;
            left: 50% !important;
            top: 50% !important;
            transform: translate(-50%, -50%) !important;
            margin: 0 !important;
            padding: 0 !important;
        }
        
        .video-end-overlay.fullscreen-overlay .overlay-content {
            width: 100% !important;
            height: 100% !important;
            padding: 1rem !important;
            box-sizing: border-box !important;
            display: flex !important;
            flex-direction: column !important;
            justify-content: center !important;
        }
        
        .video-end-overlay.fullscreen-overlay .overlay-videos {
            grid-template-columns: repeat(3, 1fr) !important;
            gap: 0.5rem !important;
        }
    }
    
    /* Hide overlay title completely on mobile */
    .overlay-title {
        display: none;
    }
    
    .overlay-sections {
        gap: 0.1rem; /* Reduced gap between sections */
    }
    
    .overlay-section h4 {
        font-size: 0.6rem;
        margin-bottom: 0.05rem; /* Minimal space after heading */
    }
    
    .next-video-container {
        margin-bottom: 0; /* No space after next video */
    }
    
    .next-video-card {
        padding: 0.25rem;
        gap: 0.25rem;
        max-width: 100%;
        flex-direction: row; /* Ensure horizontal layout */
        min-height: 40px; /* Min height instead of fixed */
    }
    
    .next-video-thumbnail {
        width: 60px;
        height: 35px;
        flex-shrink: 0;
        object-fit: cover;
    }
    
    .next-video-info {
        overflow: hidden;
    }
    
    .next-video-title {
        font-size: 0.7rem;
        line-height: 1.2;
        -webkit-line-clamp: 2;
        margin-bottom: 0.1rem;
    }
    
    .next-video-channel {
        font-size: 0.6rem;
        margin-bottom: 0.05rem;
    }
    
    .next-video-countdown {
        font-size: 0.55rem;
        margin: 0;
    }
    
    .overlay-videos {
        grid-template-columns: repeat(3, 1fr); /* Show 3 videos in one row */
        gap: 0.2rem;
        /* Remove height restriction */
    }
    
    .overlay-video-card {
        display: flex;
        flex-direction: column;
        /* Remove fixed height */
    }
    
    .overlay-video-thumbnail {
        height: 50px; /* Better aspect ratio */
        width: 100%;
        object-fit: cover;
        aspect-ratio: 16/9; /* Maintain video aspect ratio */
    }
    
    .overlay-video-info {
        padding: 0.15rem;
        overflow: hidden;
    }
    
    .overlay-video-title {
        font-size: 0.6rem;
        line-height: 1.1;
        margin-bottom: 0;
        -webkit-line-clamp: 2; /* Show 2 lines */
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .overlay-video-channel {
        display: none; /* Hide channel name to save space */
    }
}