/* Video Carousel Plugin Styles */

/* Container and Layout */
.vcp-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.vcp-carousel-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #f8f9fa; /* Can be overridden by admin settings */
    padding: 20px;
}

/* This track is now controlled by JavaScript via transform. */
/* Native scrolling properties have been removed to prevent conflicts. */
.vcp-carousel-track {
    display: flex;
    gap: 16px;
    /* This transition is controlled by the new JS file */
    transition: transform 0.35s ease;
    /* Add user-select none to prevent text selection during drag */
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Video Items */
.vcp-video-item {
    flex: 0 0 auto;
    width: 280px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.vcp-video-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.vcp-thumbnail-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.vcp-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.vcp-video-item[data-aspect-ratio="9:16"] .vcp-thumbnail {
    height: 350px;
}

.vcp-video-item[data-aspect-ratio="16:9"] .vcp-thumbnail {
    height: 157px;
}

.vcp-video-item:hover .vcp-thumbnail {
    transform: scale(1.05);
}

/* Play Overlay */
.vcp-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.vcp-video-item:hover .vcp-play-overlay {
    opacity: 1;
}

.vcp-play-button {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.vcp-play-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.vcp-play-button {
    font-size: 18px;
}

/* Video Info */
.vcp-video-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 20px 16px 16px;
}

.vcp-video-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vcp-video-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    opacity: 0.9;
}

.vcp-video-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vcp-video-stats .vcp-icon {
    font-size: 12px;
}

/* Navigation Buttons */
.vcp-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 16px;
    color: #333;
}

.vcp-nav-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.vcp-nav-prev {
    left: 10px;
}

.vcp-nav-next {
    right: 10px;
}

.vcp-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vcp-nav-button:disabled:hover {
    transform: translateY(-50%) scale(1);
}

/* Lightbox Styles */
.vcp-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding-bottom: 100px; /* Space for navigation buttons */
}

.vcp-lightbox.active {
    display: flex;
}

.vcp-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Can be overridden by admin settings */
    backdrop-filter: blur(10px);
}

.vcp-lightbox-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 90%;
    max-height: 800px;
    background: #fff; /* Can be overridden by admin settings */
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.vcp-lightbox-content {
    display: flex;
    width: 100%;
    height: 100%;
}

.vcp-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s ease;
    font-size: 18px;
}

.vcp-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Lightbox Navigation Buttons */
.vcp-lightbox-navigation {
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex; /* Show by default */
    gap: 20px;
    z-index: 10;
}

.vcp-lightbox-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 100px;
    justify-content: center;
}

.vcp-lightbox-nav-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.vcp-lightbox-nav-btn:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.vcp-lightbox-nav-btn:disabled:hover {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

.vcp-nav-icon {
    font-size: 16px;
    font-weight: bold;
}

.vcp-nav-text {
    font-size: 14px;
}

/* Video Player */
.vcp-video-player-container {
    flex: 1;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vcp-video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vcp-video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.vcp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Video Sidebar */
.vcp-video-sidebar {
    width: 350px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.vcp-video-details {
    padding: 24px;
    border-bottom: 1px solid #e9ecef;
}

.vcp-video-title-full {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px 0;
    line-height: 1.4;
    color: #212529;
}

.vcp-video-meta {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: #6c757d;
}

.vcp-video-actions {
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
}

.vcp-like-button,
.vcp-comment-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.vcp-like-button:hover,
.vcp-comment-toggle:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.vcp-like-button.liked {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.vcp-like-button .vcp-like-icon {
    font-size: 16px;
}

/* Comments Section */
.vcp-comments-section {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.vcp-comment-form {
    margin-bottom: 24px;
}

.vcp-comment-input {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 12px;
}

.vcp-comment-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.vcp-comment-submit {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.vcp-comment-submit:hover {
    background: #0b5ed7;
}

.vcp-login-prompt {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.vcp-login-prompt a {
    color: #0d6efd;
    text-decoration: none;
}

.vcp-login-prompt a:hover {
    text-decoration: underline;
}

.vcp-comments-list {
    space-y: 16px;
}

.vcp-comment {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid #e9ecef;
}

.vcp-comment:last-child {
    border-bottom: none;
}

.vcp-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vcp-comment-content {
    flex: 1;
}

.vcp-comment-author {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #212529;
}

.vcp-comment-text {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
    color: #495057;
}

.vcp-comment-date {
    font-size: 12px;
    color: #6c757d;
}

/* No Videos Message */
.vcp-no-videos {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 12px;
}

/* Desktop/Mobile specific elements */
.vcp-mobile-only {
    display: none;
}

.vcp-desktop-only {
    display: block;
}

/* Hide mobile-specific comment elements on desktop/tablet only */
@media (min-width: 769px) {
    .vcp-mobile-close-comments,
    .vcp-mobile-comments-header {
        display: none !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .vcp-carousel-wrapper {
        padding: 16px;
    }
    
    .vcp-video-item {
        width: 240px;
    }
    
    .vcp-lightbox {
        padding-bottom: 80px; /* Ensure space for navigation buttons */
    }
    
    .vcp-lightbox-container {
        width: 85%;
        height: 92%; /* Reduced to make room for navigation */
        flex-direction: column;
    }
    
    .vcp-lightbox-content {
        flex-direction: column;
        height: 100%;
    }
    
    .vcp-video-player-container {
        flex: 0 0 70%;
        min-height: 70%;
        max-height: 70%;
        width: 100%;
    }
    
    .vcp-video-sidebar {
        flex: 0 0 30%;
        width: 100%;
        max-height: 30%;
        min-height: 30%;
        overflow: visible; /* Allow floating elements */
    }
    
    /* Show mobile button, hide desktop button */
    .vcp-mobile-only {
        display: block;
    }
    
    .vcp-desktop-only {
        display: none;
    }
    
    /* Hide comments section by default on mobile */
    .vcp-comments-section {
        display: none;
    }
    
    /* Show comments when toggled */
    .vcp-comments-section.mobile-visible {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #363636a3;
        z-index: 10000;
        padding: 20px;
        overflow-y: auto;
    }
    
    .vcp-lightbox-navigation {
        bottom: -60px;
        gap: 15px;
        display: flex !important; /* Force show on mobile */
    }
    
    .vcp-lightbox-nav-btn {
        padding: 10px 16px;
        font-size: 13px;
        min-width: 80px;
    }
    
    /* Mobile Comments Overlay */
    .vcp-comments-section.mobile-visible .vcp-comment-form {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 15px;
        border-top: 1px solid #ddd;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        border-radius: 1vh;
        z-index: 10001;
    }
    
    /* Individual comment styling on mobile */
    .vcp-comments-section.mobile-visible .vcp-comment {
        background: #ffffffe0;
        border-radius: 1vh;
        margin-top: 1vh;
        padding: 1vh;
        border-bottom: none;
    }
    
    .vcp-comments-section.mobile-visible .vcp-comments-list {
        padding-top: 80px; /* Space for fixed header */
        padding-bottom: 100px; /* Space for fixed comment form */
    }
    
    /* Mobile comment input */
    .vcp-comment-input {
        min-height: 40px;
        border-radius: 20px;
        padding: 10px 15px;
        border: 1px solid #ddd;
        transition: all 0.3s ease;
    }
    
    .vcp-comment-input:focus {
        border-color: #007cba;
        box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
    }
    
    /* Mobile comments close button - only on mobile */
    .vcp-mobile-close-comments {
        position: fixed;
        top: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        background: rgba(255, 255, 255, 0.95);
        color: #333;
        border: 2px solid rgba(0,0,0,0.1);
        border-radius: 50%;
        font-size: 24px;
        font-weight: bold;
        cursor: pointer;
        z-index: 10001;
        display: none;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        transition: all 0.2s ease;
    }
    
    .vcp-mobile-close-comments:hover {
        background: rgba(255, 255, 255, 1);
        transform: scale(1.1);
    }
    
    /* Show close button when comments are visible on mobile */
    .vcp-comments-section.mobile-visible .vcp-mobile-close-comments {
        display: flex;
    }
    
    /* Mobile comments header - only on mobile */
    .vcp-mobile-comments-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        padding: 15px 20px;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        z-index: 10001;
        display: none;
        align-items: center;
        justify-content: space-between;
    }
    
    .vcp-comments-section.mobile-visible .vcp-mobile-comments-header {
        display: flex;
    }
    
    .vcp-mobile-comments-title {
        font-size: 18px;
        font-weight: 600;
        color: #333;
    }
    
    .vcp-mobile-header-close {
        background: none;
        border: none;
        font-size: 24px;
        color: #666;
        cursor: pointer;
        padding: 5px;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s ease;
    }
    
    .vcp-mobile-header-close:hover {
        background: rgba(0,0,0,0.1);
    }
    
    /* Mobile comments close button - hidden by default */
    .vcp-mobile-close-comments {
        display: none;
    }
    
    /* Mobile comments header - hidden by default */
    .vcp-mobile-comments-header {
        display: none;
    }
    
    .vcp-nav-button {
        width: 36px;
        height: 36px;
    }
    
    .vcp-nav-prev {
        left: 8px;
    }
    
    .vcp-nav-next {
        right: 8px;
    }
}

@media (max-width: 480px) {
    .vcp-video-item {
        width: 200px;
    }
    
    .vcp-carousel-track {
        gap: 12px;
    }
    
    .vcp-video-details,
    .vcp-video-actions,
    .vcp-comments-section {
        padding: 16px;
    }
    
    .vcp-video-actions {
        /* Changed from column to row for side-by-side layout on mobile */
        flex-direction: row;
        justify-content: space-around; /* Evenly space the buttons */
        padding: 12px 8px; /* Reduce padding to save space */
    }
    
    .vcp-like-button,
    .vcp-comment-toggle {
        flex-grow: 1; /* Allow buttons to grow and fill space */
        justify-content: center;
        padding: 10px 8px; /* Adjust button padding */
        font-size: 13px; /* Slightly smaller font for small screens */
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .vcp-play-overlay {
        opacity: 1;
    }
    
    .vcp-video-item:hover {
        transform: none;
    }
    
    .vcp-video-item:hover .vcp-thumbnail {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .vcp-video-item {
        border: 2px solid #000;
    }
    
    .vcp-nav-button {
        border: 2px solid #000;
    }
    
    .vcp-like-button,
    .vcp-comment-toggle {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .vcp-carousel-track,
    .vcp-video-item,
    .vcp-thumbnail,
    .vcp-play-overlay,
    .vcp-play-button,
    .vcp-nav-button,
    .vcp-like-button,
    .vcp-comment-toggle {
        transition: none;
    }
    
    .vcp-spinner {
        animation: none;
    }
}

/* Floating comment input overlay for mobile */
.vcp-comment-floating-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 10002;
    display: none;
    padding: 20px;
}

.vcp-comment-floating-overlay.active {
    display: block;
}

.vcp-comment-floating-overlay textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    font-size: 16px;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}

.vcp-comment-floating-overlay .vcp-floating-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

.vcp-comment-floating-overlay button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.vcp-floating-cancel {
    background: #f5f5f5;
    color: #666;
}

.vcp-floating-submit {
    background: #007cba;
    color: white;
}

.vcp-floating-overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    display: none;
}

.vcp-floating-overlay-backdrop.active {
    display: block;
}