/**
 * VideoHub Additional Styles
 */

/* Single Video Page */
.vh-single-video {
    max-width: 1000px;
    margin: 0 auto;
}

.vh-single-player {
    border-radius: var(--vh-card-radius);
    overflow: hidden;
    background: #000;
    margin-bottom: 25px;
}

.vh-single-player video {
    width: 100%;
    display: block;
}

.vh-single-player iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
}

.vh-no-video {
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vh-surface);
    color: var(--vh-text-muted);
}

.vh-single-info {
    padding: 20px 0;
}

.vh-single-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.3;
}

.vh-single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    color: var(--vh-text-muted);
}

.vh-single-meta > span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vh-single-meta svg {
    stroke: var(--vh-primary);
}

.vh-single-description {
    color: var(--vh-text-muted);
    margin-bottom: 20px;
    line-height: 1.7;
}

.vh-single-tags,
.vh-single-categories {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.vh-single-tags strong,
.vh-single-categories strong {
    color: var(--vh-text);
}

/* Related Videos Section */
.vh-related {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--vh-border);
}

.vh-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 25px;
}

/* Archive Pages */
.vh-archive-header {
    padding: 40px 0;
    text-align: center;
}

.vh-archive-title {
    font-size: 2rem;
    margin-bottom: 10px;
}

.vh-archive-description {
    color: var(--vh-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Pagination Styles */
.vh-pagination .page-numbers {
    display: flex;
    justify-content: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.vh-pagination .page-numbers li {
    list-style: none;
}

.vh-pagination .page-numbers a,
.vh-pagination .page-numbers span {
    display: inline-block;
    padding: 10px 16px;
    background: var(--vh-surface);
    border: 1px solid var(--vh-border);
    border-radius: 8px;
    color: var(--vh-text);
    font-weight: 500;
    transition: all var(--vh-transition);
}

.vh-pagination .page-numbers a:hover,
.vh-pagination .page-numbers .current {
    background: var(--vh-primary);
    border-color: var(--vh-primary);
    color: white;
}

.vh-pagination .page-numbers .dots {
    background: transparent;
    border-color: transparent;
}

/* Loading States */
.vh-loading-more {
    text-align: center;
    padding: 30px;
}

/* Smooth Transitions */
.vh-video-card,
.vh-tag,
.vh-page-link {
    will-change: transform;
}

/* Focus States for Accessibility */
.vh-search-input:focus,
.vh-tag:focus,
.vh-video-card:focus {
    outline: 2px solid var(--vh-primary);
    outline-offset: 2px;
}

/* Modal Improvements */
.vh-modal {
    backdrop-filter: blur(5px);
}

.vh-modal-content {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Admin Bar Offset */
.admin-bar .vh-header {
    top: 32px;
}

.admin-bar .vh-layout {
    padding-top: calc(var(--vh-header-height) + 32px + 20px);
}

.admin-bar .vh-sidebar {
    top: calc(var(--vh-header-height) + 32px);
    height: calc(100vh - var(--vh-header-height) - 32px);
}

.admin-bar .vh-main.vh-watch-page {
    padding-top: calc(var(--vh-header-height) + 32px + 24px) !important;
}

@media (max-width: 782px) {
    .admin-bar .vh-header {
        top: 46px;
    }
    
    .admin-bar .vh-layout {
        padding-top: calc(var(--vh-header-height) + 46px + 20px);
    }
    
    .admin-bar .vh-sidebar {
        top: calc(var(--vh-header-height) + 46px);
        height: calc(100vh - var(--vh-header-height) - 46px);
    }
    
    .admin-bar .vh-main.vh-watch-page {
        padding-top: calc(var(--vh-header-height) + 46px + 24px) !important;
    }
}

/* Fix layout padding to clear fixed header */
.vh-layout {
    padding-top: calc(var(--vh-header-height) + 20px);
}

/* Fix sidebar top padding so Home link is not cut off */
.vh-sidebar {
    padding-top: 20px;
}

/* Fix watch page padding */
.vh-main.vh-watch-page {
    padding-top: calc(var(--vh-header-height) + 24px) !important;
}

/* Print Styles */
@media print {
    .vh-header,
    .vh-footer,
    .vh-modal,
    .vh-pagination,
    .vh-search-form {
        display: none !important;
    }
    
    .vh-video-grid {
        display: block;
    }
    
    .vh-video-card {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --vh-border: #666666;
        --vh-text-muted: #cccccc;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--vh-background);
}

::-webkit-scrollbar-thumb {
    background: var(--vh-surface-hover);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--vh-border);
}

/* Selection Color */
::selection {
    background: var(--vh-primary);
    color: white;
}

/* Default Menu Fallback Styles */
.vh-nav a {
    color: var(--vh-text-muted);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all var(--vh-transition);
    display: inline-block;
}

.vh-nav a:hover {
    color: var(--vh-text);
    background: var(--vh-surface-hover);
}

/* =========================================
   Theater Mode Styles
   ========================================= */
.vh-theater-mode .vh-header,
.vh-theater-mode .vh-sidebar,
.vh-theater-mode .vh-related-videos {
    display: none !important;
}

.vh-theater-mode .vh-watch-page {
    padding-top: 0;
}

.vh-theater-mode .vh-watch-layout {
    display: block;
    max-width: 100%;
}

.vh-theater-mode .vh-watch-player {
    max-width: 100%;
}

.vh-theater-mode .vh-player-container {
    max-height: 85vh;
    background: #000;
}

.vh-theater-mode .vh-video-iframe {
    max-height: 85vh;
}

.vh-theater-mode .vh-watch-info {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Player Controls Overlay */
.vh-player-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vh-player-container:hover .vh-player-controls {
    opacity: 1;
}

.vh-player-control-btn {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 4px;
    padding: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.vh-player-control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.vh-theater-btn .vh-theater-collapse {
    display: none;
}

.vh-theater-mode .vh-theater-btn .vh-theater-expand {
    display: none;
}

.vh-theater-mode .vh-theater-btn .vh-theater-collapse {
    display: block;
}

/* Player Container - ensure relative positioning */
.vh-player-container {
    position: relative;
}

/* =========================================
   Autoplay Toggle Styles
   ========================================= */
.vh-autoplay-toggle {
    margin-left: auto;
}

.vh-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.vh-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.vh-toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--vh-surface-hover);
    border-radius: 11px;
    transition: background 0.3s ease;
}

.vh-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.vh-toggle-input:checked + .vh-toggle-switch {
    background: var(--vh-primary);
}

.vh-toggle-input:checked + .vh-toggle-switch::after {
    transform: translateX(18px);
}

.vh-toggle-text {
    color: var(--vh-text-muted);
    font-size: 0.875rem;
}

/* =========================================
   Autoplay Countdown Overlay
   ========================================= */
.vh-autoplay-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.vh-autoplay-content {
    text-align: center;
    color: #fff;
}

.vh-autoplay-content p {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

#countdown-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--vh-primary);
    display: block;
    margin-top: 10px;
}

/* =========================================
   Continue Watching Section Styles
   ========================================= */
.vh-continue-watching {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--vh-border);
}

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

.vh-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--vh-text);
    margin: 0;
}

.vh-clear-history {
    background: transparent;
    border: 1px solid var(--vh-border);
    color: var(--vh-text-muted);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vh-clear-history:hover {
    border-color: var(--vh-text-muted);
    color: var(--vh-text);
}

.vh-continue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.vh-continue-item {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease;
}

.vh-continue-item:hover {
    transform: translateY(-4px);
}

.vh-continue-thumb {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    background: var(--vh-surface);
    margin-bottom: 8px;
}

.vh-continue-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vh-continue-thumb .vh-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.vh-continue-thumb .vh-watch-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--vh-primary);
}

.vh-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--vh-surface) 0%, var(--vh-surface-hover) 100%);
}

.vh-continue-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--vh-text);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* =========================================
   Like/Dislike Active States
   ========================================= */
.vh-like-btn.active,
.vh-dislike-btn.active {
    color: var(--vh-primary);
}

.vh-like-btn.active svg,
.vh-dislike-btn.active svg {
    fill: var(--vh-primary);
    stroke: var(--vh-primary);
}

/* =========================================
   Watch Actions Responsive
   ========================================= */
.vh-watch-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

@media (max-width: 768px) {
    .vh-autoplay-toggle {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
    }
    
    .vh-continue-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* =========================================
   Shortcuts Hint
   ========================================= */
.vh-shortcuts-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--vh-surface);
    color: var(--vh-text-muted);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.8125rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.vh-shortcuts-hint.visible {
    opacity: 1;
    transform: translateY(0);
}

.vh-shortcuts-hint kbd {
    background: var(--vh-surface-hover);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    margin: 0 2px;
}

/* =========================================
   HLS Video Player Styles
   ========================================= */
.vh-video-player {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--vh-card-radius, 12px);
    display: block;
}

.vh-video-player:focus {
    outline: 2px solid var(--vh-primary, #6366f1);
    outline-offset: 2px;
}

.vh-player-error {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--vh-surface, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vh-text-muted, #888);
    text-align: center;
    padding: 20px;
    border-radius: var(--vh-card-radius, 12px);
}

.vh-player-error p {
    margin: 0;
    font-size: 1rem;
}

/* =========================================
   Video Metadata Section (Watch Page)
   ========================================= */
.vh-watch-metadata {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--vh-border, #333);
}

.vh-metadata-group {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.vh-metadata-label {
    color: var(--vh-text-muted, #888);
    font-weight: 600;
    min-width: 100px;
    flex-shrink: 0;
}

.vh-metadata-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.vh-video-category,
.vh-video-tag,
.vh-video-model {
    display: inline-block;
    padding: 4px 12px;
    background: var(--vh-surface, #1a1a1a);
    color: var(--vh-text, #fff);
    border-radius: 20px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    border: 1px solid var(--vh-border, #333);
}

.vh-video-category:hover,
.vh-video-tag:hover,
.vh-video-model:hover {
    background: var(--vh-primary, #6366f1);
    color: #fff;
    border-color: var(--vh-primary, #6366f1);
}

.vh-video-model {
    background: linear-gradient(135deg, var(--vh-surface, #1a1a1a) 0%, #2d2d2d 100%);
}

@media (max-width: 768px) {
    .vh-metadata-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .vh-metadata-label {
        min-width: auto;
    }
}

/* User Dropdown Menu */
.vh-user-dropdown {
    position: relative;
}

.vh-user-toggle {
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.vh-user-toggle:hover {
    background: var(--vh-surface-hover);
}

.vh-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.vh-user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--vh-surface);
    border: 1px solid var(--vh-border);
    border-radius: 12px;
    min-width: 240px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.vh-user-dropdown:hover .vh-user-menu,
.vh-user-dropdown.active .vh-user-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.vh-user-info {
    padding: 16px;
    border-bottom: 1px solid var(--vh-border);
}

.vh-user-name {
    display: block;
    font-weight: 600;
    color: var(--vh-text);
    margin-bottom: 4px;
}

.vh-user-email {
    display: block;
    font-size: 0.85rem;
    color: var(--vh-text-muted);
}

.vh-user-menu-items {
    padding: 8px;
}

.vh-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--vh-text);
    text-decoration: none;
    transition: background 0.2s;
}

.vh-menu-item:hover {
    background: var(--vh-surface-hover);
}

.vh-menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.vh-menu-item.vh-logout {
    color: #ef4444;
}

.vh-menu-item.vh-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}
