@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --text-primary: #ffffff;
    --text-secondary: #a3a3a3;
    --text-tertiary: #737373;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(180deg,
        #0a0a0a 0%,
        #1a1a2e 25%,
        #16213e 50%,
        #0f3460 75%,
        #1a1a2e 100%);
    background-attachment: fixed;
    background-size: 100% 200vh;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 60px);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: clamp(30px, 5vw, 60px);
}

header {
    text-align: center;
    padding: clamp(20px, 3vw, 40px) 0;
}

h1 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    transition: transform 0.1s ease-out;
    will-change: transform;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.player-wrapper {
    width: 100%;
    max-width: 1400px;
    margin-bottom: clamp(150px, 25vw, 400px);
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.controls-bar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(24px) saturate(180%) brightness(1.1);
    -webkit-backdrop-filter: blur(24px) saturate(180%) brightness(1.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    z-index: 100;
    width: fit-content;
    max-width: 90%;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.2s ease, width 0.3s ease;
}

.controls-bar.active {
    display: flex;
}

.controls-bar.vod-mode {
    width: auto;
    min-width: 600px;
}

.controls-bar.visible {
    opacity: 1;
}

.controls-bar:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.18);
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    font-weight: 600;
    flex: 1;
    transition: all var(--transition-base);
}

.live-badge:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 12px var(--danger);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}

.live-text {
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.latency-text {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: auto;
    transition: color var(--transition-fast);
}

.scrubber-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 600px;
    padding: 0 4px;
}

.play-pause-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.play-pause-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.play-pause-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.play-pause-button svg {
    pointer-events: none;
    opacity: 0.9;
}

.time-display {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 42px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.scrubber-bar {
    position: relative;
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    cursor: pointer;
    transition: height var(--transition-fast);
}

.scrubber-bar:hover {
    height: 8px;
}

.scrubber-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}

.scrubber-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 14px;
    height: 14px;
    background: var(--text-primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform var(--transition-fast), opacity var(--transition-fast);
    opacity: 0;
    pointer-events: none;
}

.scrubber-bar:hover .scrubber-handle,
.scrubber-bar.dragging .scrubber-handle {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
}

.mute-button,
.fullscreen-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.mute-button:hover,
.fullscreen-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.mute-button:active,
.fullscreen-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.mute-button svg,
.fullscreen-button svg {
    pointer-events: none;
    opacity: 0.9;
}

.video-container {
    position: relative;
    width: 100%;
    background: var(--bg-secondary);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--glass-border);
    transition: all var(--transition-slow);
}

.video-container:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.12);
}

.video-container::before {
    content: '';
    display: block;
    padding-top: 69.85%; /* iPad 11th gen landscape aspect ratio (1668/2388) */
}

video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Changed from contain to cover to fill the space */
    background: #000;
}

video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-enclosure {
    display: none !important;
}

.standby-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity var(--transition-slow);
}

.standby-screen.hidden {
    display: none;
}

.live-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.live-notification-content {
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 32px;
    min-width: 320px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    text-align: center;
}

.live-notification-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.live-notification-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.live-notification-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.notification-button {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-base);
    border: none;
}

.notification-button.primary {
    background: var(--accent-gradient);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.notification-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.notification-button.secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.notification-button.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.standby-content {
    text-align: center;
    padding: 40px;
    max-width: 500px;
}

.standby-content h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.standby-content p {
    font-size: clamp(1rem, 2vw, 1.125rem);
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

footer {
    display: none;
}

/* VOD Section Styles */
.vod-section {
    width: 100%;
    max-width: 1400px;
    margin-top: clamp(80px, 15vw, 200px);
    padding: 0 20px;
    margin-bottom: 60px;
    position: relative;
    z-index: 1;
}

.vod-title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

.vod-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    width: 100%;
}

.vod-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.vod-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.vod-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
}

.vod-item:hover {
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(59, 130, 246, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.vod-item:active {
    transform: translateY(-2px);
}

.vod-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    overflow: hidden;
}

.vod-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.vod-thumbnail:hover::before {
    opacity: 1;
}

.vod-thumbnail > svg {
    width: 48px;
    height: 48px;
    color: var(--accent-primary);
    opacity: 0.6;
}

.vod-play-overlay {
    position: absolute;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-base);
    pointer-events: none;
}

.vod-thumbnail:hover .vod-play-overlay {
    opacity: 1;
    transform: scale(1);
}

.play-icon-overlay {
    width: 28px;
    height: 28px;
    color: var(--text-primary);
    margin-left: 3px;
}

.vod-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.vod-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    cursor: pointer;
}

.vod-recording-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 4px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.vod-date {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.vod-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.vod-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vod-download-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(4px);
    z-index: 10;
}

.vod-item:hover .vod-download-btn {
    opacity: 1;
    transform: translateY(0);
}

.vod-download-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.vod-download-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.vod-download-btn svg {
    pointer-events: none;
    opacity: 0.9;
}

/* Playing indicator for active VOD */
.vod-item.playing {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.vod-item.playing .vod-thumbnail {
    border-bottom-color: var(--accent-primary);
}

/* Mode indicator badge */
.mode-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    z-index: 50;
}

.mode-badge.vod-mode {
    color: var(--accent-primary);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Fullscreen styles */
.player-wrapper:fullscreen {
    background: #000;
}

.player-wrapper:fullscreen .video-container {
    border-radius: 0;
    border: none;
    height: 100vh;
}

.player-wrapper:fullscreen .video-container::before {
    display: none;
}

.player-wrapper:fullscreen video {
    object-fit: contain;
}

.player-wrapper:fullscreen .controls-bar {
    bottom: 80px;
}

/* Webkit fullscreen */
.player-wrapper:-webkit-full-screen {
    background: #000;
}

.player-wrapper:-webkit-full-screen .video-container {
    border-radius: 0;
    border: none;
    height: 100vh;
}

.player-wrapper:-webkit-full-screen .video-container::before {
    display: none;
}

.player-wrapper:-webkit-full-screen video {
    object-fit: contain;
}

.player-wrapper:-webkit-full-screen .controls-bar {
    bottom: 80px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding: 16px;
        gap: 24px;
    }

    .controls-bar {
        padding: 12px 14px;
        gap: 10px;
        border-radius: 12px;
        bottom: 16px;
    }

    .live-badge {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 10px;
    }

    .live-text {
        font-size: 0.8rem;
    }

    .latency-text {
        font-size: 0.7rem;
    }

    .mute-button,
    .fullscreen-button {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .mute-button svg,
    .fullscreen-button svg {
        width: 18px;
        height: 18px;
    }

    .video-container {
        border-radius: 16px;
    }

    .standby-content {
        padding: 24px;
    }

    .player-wrapper {
        margin-bottom: 120px;
    }

    .vod-section {
        margin-top: 60px;
        padding: 0 16px;
    }

    .vod-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .vod-title {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .vod-download-btn {
        opacity: 1;
        transform: translateY(0);
    }

    .scrubber-container {
        max-width: none;
        gap: 8px;
    }

    .time-display {
        font-size: 0.7rem;
        min-width: 36px;
    }

    .scrubber-bar {
        height: 8px;
    }

    .scrubber-handle {
        opacity: 1;
        width: 16px;
        height: 16px;
    }

    .controls-bar.vod-mode {
        min-width: auto;
        width: 90%;
    }
}

/* iOS specific optimizations */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    video {
        -webkit-playsinline: true;
    }
}

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

/* High contrast mode */
@media (prefers-contrast: high) {
    .controls-bar {
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid rgba(255, 255, 255, 0.3);
    }

    .live-badge {
        border: 2px solid var(--danger);
    }

    .mute-button,
    .fullscreen-button {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
}
