/**
 * Frontend Responsive Styles
 * Ensures all public pages work on mobile, tablet, and desktop
 */

/* Mobile first - Base styles for mobile */
body {
    font-size: 16px;
    line-height: 1.5;
}

/* Container adjustments */
.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* Extra small devices (phones, <576px) */
@media (max-width: 575.98px) {
    /* Typography */
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.25rem; }
    .display-4 { font-size: 2rem; }
    
    /* Video grid */
    .row-cols-1 > * {
        width: 100%;
    }
    
    /* Player container */
    .player-container {
        border-radius: 0;
    }
    
    /* Hide transcript on very small screens */
    .video-player-transcript-panel {
        width: 100%;
    }
    
    /* Navbar adjustments */
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar .input-group {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* Button sizes */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Form controls */
    .form-control,
    .form-select {
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    
    /* Upload page */
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-area p {
        font-size: 0.875rem;
    }
    
    /* Footer */
    footer {
        padding: 1.5rem 0;
        font-size: 0.875rem;
    }
    
    /* Stats/info displays */
    .video-info-item {
        font-size: 0.75rem;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .row-cols-sm-2 > * {
        width: 50%;
    }
    
    /* Player adjustments */
    .video-player-controls {
        padding: 10px;
    }
    
    .video-player-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Transcript side panel */
    .video-player-transcript-panel {
        width: 300px;
    }
    
    /* Video grid */
    .row-cols-md-3 > * {
        width: 33.333%;
    }
    
    /* Player controls spacing */
    .video-player-controls-bar {
        gap: 6px;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    /* Optimal layout */
    .container {
        max-width: 1140px;
    }
    
    /* Video grid */
    .row-cols-lg-4 > * {
        width: 25%;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1320px;
    }
}

/* XXL devices (larger desktops, 1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1500px;
    }
    
    /* Wider transcript panel */
    .video-player-transcript-panel {
        width: 400px;
    }
}

/* Landscape orientation on phones */
@media (max-width: 767.98px) and (orientation: landscape) {
    /* Make player fullscreen on landscape */
    .player-container {
        aspect-ratio: auto;
        height: 100vh;
    }
    
    /* Hide some UI elements */
    .video-info {
        display: none;
    }
    
    .comments-section {
        display: none;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
    }
    
    .video-player-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .form-control,
    .form-select,
    input,
    button {
        min-height: 44px;
    }
    
    /* Larger clickable areas */
    .video-card {
        padding: 0.5rem;
    }
    
    /* Remove hover effects */
    .video-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .upload-area,
    .video-player-controls,
    .comments-section {
        display: none !important;
    }
    
    .player-container {
        break-inside: avoid;
    }
    
    body {
        font-size: 12pt;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .video-player-wrapper {
        scroll-behavior: auto !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .video-card {
        border: 2px solid currentColor;
    }
    
    .btn {
        border-width: 2px;
    }
    
    a {
        text-decoration: underline;
    }
}

/* Safe area for notched devices (iPhone X+) */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .player-container.fullscreen {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}
