.video-js {
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    outline: none !important; /* Remove default focus outline */
}

/* Ensure video element can receive focus for keyboard controls */
.video-js:focus {
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 0 0 3px rgba(0, 122, 204, 0.3) !important;
}

.video-js video {
    outline: none !important;
}
.video-js .vjs-poster {
    border-radius: 12px !important;
}
.video-js video {
    border-radius: 12px !important;
}
.video-js .vjs-control-bar {
    border-bottom-left-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
}

/* Responsive video container */
.video-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Responsive App container */
.App {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Ensure video.js responsive behavior */
.video-js.vjs-fluid {
    width: 100% !important;
    max-width: 100% !important;
}
.vjs-next-video-control {
    width: 3em !important;
    height: 3em !important;
    flex: none;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 3em !important;
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.vjs-next-video-control .vjs-icon-placeholder {
    width: 1.2em;
    height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
}

.vjs-next-video-control .vjs-icon-placeholder svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* End Screen Overlay Styles */
.vjs-end-screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 91%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 0 20px;
    box-sizing: border-box;
}

.vjs-related-videos-title {
    color: white;
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}

.vjs-related-videos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.vjs-related-video-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease;
    background: #1a1a1a;
}

.vjs-related-video-item:hover {
    transform: scale(1.05);
}

.vjs-related-video-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.vjs-related-video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vjs-related-video-item:hover .vjs-related-video-overlay {
    opacity: 1;
}

.vjs-related-video-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
    line-height: 1.2;
}

.vjs-related-video-author {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 2px;
}

.vjs-related-video-views {
    font-size: 12px;
    color: #aaa;
}

/* Keep entire control bar active when video ends */
.video-js.vjs-ended .vjs-control-bar {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.video-js.vjs-ended .vjs-control-bar .vjs-control {
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

.video-js.vjs-ended .vjs-control-bar button {
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

.video-js.vjs-ended .vjs-play-control {
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

.video-js.vjs-ended .vjs-progress-control {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.video-js.vjs-ended .vjs-volume-panel {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Chapter Markers and Tooltip Styles */
.vjs-chapter-markers-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.vjs-chapter-marker {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: auto;
    cursor: pointer;
    transition: background 0.2s ease;
}

.vjs-chapter-marker:hover {
    background: rgba(255, 255, 255, 0.9);
    width: 3px;
}

.vjs-chapter-marker-tooltip {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1001;
}

.vjs-chapter-marker:hover .vjs-chapter-marker-tooltip {
    opacity: 1;
}

.vjs-chapter-floating-tooltip {
    font-family:
        -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif !important;
    line-height: 1.4 !important;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Make menus clickable instead of hover-only */
.video-js .vjs-menu-button:not(.vjs-disabled) .vjs-menu {
    display: none !important; /* Hide by default */
}

.video-js .vjs-menu-button:not(.vjs-disabled).vjs-lock-showing .vjs-menu,
.video-js .vjs-menu-button:not(.vjs-disabled) .vjs-menu.vjs-lock-showing {
    display: block !important; /* Show when clicked */
}

/* Disable hover effects on menu buttons */
.video-js .vjs-menu-button:hover .vjs-menu {
    display: none !important;
}

.video-js .vjs-menu-button.vjs-lock-showing:hover .vjs-menu {
    display: block !important;
}

/* Ensure clicked menus stay visible */
.video-js .vjs-menu.vjs-lock-showing {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-container {
        padding: 0 15px;
    }

    .vjs-related-videos-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(auto, 1fr);
        gap: 8px;
        max-width: 100%;
    }

    .vjs-end-screen-overlay {
        padding: 0 15px;
    }

    .vjs-related-video-thumbnail {
        height: 100px;
    }

    .vjs-chapter-floating-tooltip {
        max-width: 200px !important;
        font-size: 11px !important;
        padding: 6px 10px !important;
    }
}

@media (max-width: 480px) {
    .video-container {
        padding: 0 10px;
    }

    .vjs-related-videos-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .vjs-end-screen-overlay {
        padding: 0 10px;
    }

    .vjs-related-video-thumbnail {
        height: 120px;
    }

    /* Make sure video info panel is responsive */
    .video-info {
        margin-top: 10px !important;
        padding: 10px !important;
        font-size: 14px !important;
    }

    .video-info h4 {
        font-size: 16px !important;
    }

    .video-info ul {
        font-size: 12px !important;
    }
}
