/**
 * Frontend Styles for Video Player BrainChain
 */

/* Video Container */
.vbc-video-container {
    position: relative;
    margin: 20px 0;
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

/* Flexible container for side-by-side layouts */
.vbc-video-container.vbc-flexible {
    margin: 10px;
    flex: 1;
    min-width: 280px;
}

/* Aspect ratio containers */
.vbc-video-container.vbc-aspect-16-9 .vbc-video-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.vbc-video-container.vbc-aspect-4-3 .vbc-video-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

.vbc-video-container.vbc-aspect-1-1 .vbc-video-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 aspect ratio */
}

/* Video wrapper for aspect ratio containers */
.vbc-video-container[class*="vbc-aspect-"] .vbc-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vbc-video-wrapper {
    position: relative;
    display: block;
    width: 100%;
    line-height: 0; /* Remove space below video */
}

/* Video Player */
.vbc-video-player {
    display: block;
    width: 100%;
    height: auto;
    background: #000;
    border: none;
    outline: none;
}

.vbc-video-player:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* Subtitles Overlay */
.vbc-subtitles-overlay {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    padding: 0 20px;
}

.vbc-subtitle-text {
    display: inline-block;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-family: 'Calibri', 'Arial', sans-serif;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
    padding: 8px 12px;
    border-radius: 4px;
    max-width: 80%;
    word-wrap: break-word;
    white-space: pre-wrap;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.vbc-subtitle-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Controls Overlay */
.vbc-controls-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
}

.vbc-subtitle-toggle {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    font-family: 'Arial', sans-serif;
    transition: all 0.3s ease;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vbc-subtitle-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: white;
    transform: scale(1.05);
}

.vbc-subtitle-toggle:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

.vbc-subtitle-toggle.active {
    background: rgba(76, 175, 80, 0.9);
    border-color: #4CAF50;
    color: white;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* Video Description */
.vbc-video-description {
    margin: 0;
    padding: 15px 20px;
    background: #f8f9fa;
    border-left: 4px solid #4CAF50;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.vbc-video-description h1,
.vbc-video-description h2,
.vbc-video-description h3,
.vbc-video-description h4,
.vbc-video-description h5,
.vbc-video-description h6 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2c3e50;
}

.vbc-video-description p {
    margin-bottom: 10px;
}

.vbc-video-description p:last-child {
    margin-bottom: 0;
}

/* Error Message */
.vbc-error {
    background: #ffebee;
    border: 1px solid #f44336;
    border-left: 4px solid #f44336;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Loading State */
.vbc-video-loading {
    position: relative;
}

.vbc-video-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: vbc-spin 1s linear infinite;
    z-index: 5;
}

@keyframes vbc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fullscreen Styles */
.vbc-video-container.vbc-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    margin: 0;
    border-radius: 0;
}

.vbc-video-container.vbc-fullscreen .vbc-video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vbc-video-container.vbc-fullscreen .vbc-subtitles-overlay {
    bottom: 80px;
}

.vbc-video-container.vbc-fullscreen .vbc-subtitle-text {
    font-size: 18px;
    padding: 12px 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .vbc-video-container {
        margin: 15px 0;
        border-radius: 6px;
    }
    
    .vbc-subtitles-overlay {
        bottom: 45px;
        padding: 0 15px;
    }
    
    .vbc-subtitle-text {
        font-size: 11px;
        padding: 6px 10px;
        max-width: 90%;
    }
    
    .vbc-controls-overlay {
        top: 8px;
        right: 8px;
    }
    
    .vbc-subtitle-toggle {
        padding: 5px 8px;
        font-size: 9px;
    }
    
    .vbc-video-description {
        padding: 12px 15px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .vbc-video-container {
        margin: 10px 0;
        border-radius: 4px;
    }
    
    .vbc-subtitles-overlay {
        bottom: 35px;
        padding: 0 10px;
    }
    
    .vbc-subtitle-text {
        font-size: 10px;
        padding: 4px 8px;
        max-width: 95%;
    }
    
    .vbc-controls-overlay {
        top: 6px;
        right: 6px;
    }
    
    .vbc-subtitle-toggle {
        padding: 4px 6px;
        font-size: 8px;
    }
    
    .vbc-video-description {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* High DPI / Retina Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .vbc-subtitle-text {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .vbc-subtitle-toggle {
        font-size: 10px;
        padding: 6px 10px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .vbc-video-description {
        background: #2d3748;
        color: #e2e8f0;
        border-left-color: #4CAF50;
    }
    
    .vbc-video-description h1,
    .vbc-video-description h2,
    .vbc-video-description h3,
    .vbc-video-description h4,
    .vbc-video-description h5,
    .vbc-video-description h6 {
        color: #f7fafc;
    }
    
    .vbc-error {
        background: #742a2a;
        border-color: #f56565;
        color: #fed7d7;
    }
}

/* Animation for subtitle appearance */
.vbc-subtitle-text {
    animation: vbc-subtitle-appear 0.3s ease-out;
}

@keyframes vbc-subtitle-appear {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Accessibility improvements */
.vbc-subtitle-toggle:focus-visible {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

.vbc-video-player:focus-visible {
    outline: 3px solid #4CAF50;
    outline-offset: 4px;
}

/* Utility classes for side-by-side layouts */
.vbc-video-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.vbc-video-row .vbc-video-container {
    flex: 1;
    min-width: 300px;
    margin: 0;
}

.vbc-video-col-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.vbc-video-col-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
}

.vbc-video-col-2 .vbc-video-container,
.vbc-video-col-3 .vbc-video-container {
    margin: 0;
    width: 100%;
}

/* Responsive grid layouts */
@media (max-width: 768px) {
    .vbc-video-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .vbc-video-col-2,
    .vbc-video-col-3 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .vbc-video-row .vbc-video-container {
        min-width: auto;
    }
}

@media (max-width: 1024px) {
    .vbc-video-col-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Container queries support (modern browsers) */
@container (max-width: 400px) {
    .vbc-subtitle-text {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .vbc-subtitle-toggle {
        padding: 3px 5px;
        font-size: 8px;
    }
}

/* Print styles */
@media print {
    .vbc-video-container {
        display: none;
    }
}