/* Video Streaming App - Blue Theme CSS */

:root {
    --royal-blue: #2563eb;
    --light-blue: #3b82f6;
    --dark-blue: #1e40af;
    --sky-blue: #0ea5e9;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

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

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
}

#app {
    height: 100%;
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 1.5rem;
}

.loader {
    width: 60px;
    height: 60px;
    border: 6px solid var(--border-color);
    border-top-color: var(--royal-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.page {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 2rem 0;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-row {
    height: 60px;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
}

.brand-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--royal-blue);
    text-decoration: none;
    transition: color 0.3s;
}

.brand-logo:hover {
    color: var(--light-blue);
}

.content {
    flex: 1;
    padding: 2rem;
}

.nav-menu {
    padding: 0 1rem;
}

.nav-item {
    margin: 0.5rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.3s;
    font-size: 1rem;
}

.nav-link:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--light-blue);
}

.nav-link.active {
    background: var(--royal-blue);
    color: white;
}

.icon {
    font-size: 1.25rem;
}

.uploads-container {
    max-width: 1400px;
    margin: 0 auto;
}

.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-section h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--royal-blue), var(--sky-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.file-input {
    display: none;
}

.upload-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--royal-blue), var(--light-blue));
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.upload-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.upload-button:active {
    transform: translateY(0);
}

.upload-progress {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: 1rem;
    overflow: visible;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--royal-blue), var(--sky-blue));
    transition: width 0.3s;
    border-radius: 1rem;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.video-card {
    background: var(--bg-card);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.2);
    border-color: var(--royal-blue);
}

.video-thumbnail {
    width: 100%;
    height: 180px;
    background: var(--bg-darker);
    background-size: cover;
    background-position: center;
    position: relative;
}

.status-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-badge.converting {
    background: rgba(245, 158, 11, 0.9);
    color: white;
}

.status-badge.ready {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.video-info {
    padding: 1.5rem;
}

.video-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.video-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.video-date {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.video-actions {
    display: flex;
    gap: 0.75rem;
}

.btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--royal-blue), var(--light-blue));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--bg-darker);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.watch-container {
    max-width: 1400px;
    margin: 0 auto;
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.video-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
}

.video-controls-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.video-controls-header label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.video-controls-header input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.sync-status {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
}

.sync-status.connected {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.video-player-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    background: black;
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

.controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 50%);
    display: flex;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.3s;
}

.video-player-container:hover .controls-overlay,
.controls-overlay.visible {
    opacity: 1;
}

.controls {
    width: 100%;
    padding: 1.5rem;
    transition: opacity 0.3s;
}

.progress-container {
    margin-bottom: 1rem;
    cursor: pointer;
}

.progress-filled {
    height: 100%;
    background: linear-gradient(90deg, var(--royal-blue), var(--light-blue));
    border-radius: 1rem;
    transition: width 0.1s;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: left 0.1s;
}

.controls-bottom {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(37, 99, 235, 0.8);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.play-pause {
    background: var(--royal-blue);
}

.time-display {
    display: flex;
    gap: 0.5rem;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.volume-slider {
    width: 100px;
    height: 6px;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.fullscreen-btn {
    font-size: 1.75rem;
}

.video-details {
    display: flex;
    gap: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.detail-item {
    color: var(--text-secondary);
}

.detail-item strong {
    color: var(--text-primary);
    margin-right: 0.5rem;
}

.share-section {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.share-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.share-url-box {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.share-url-input {
    flex: 1;
    padding: 1rem;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.95rem;
}

.success-message {
    color: var(--success);
    font-weight: 500;
}

@media (max-width: 768px) {
    .page {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem 0;
    }

    .content {
        padding: 1rem;
    }

    .header-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-section h1 {
        font-size: 1.75rem;
    }

    .videos-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .video-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .video-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .video-header h1 {
        font-size: 1.5rem;
    }

    .video-details {
        flex-direction: column;
        gap: 1rem;
    }

    .share-url-box {
        flex-direction: column;
    }

    .controls-bottom {
        flex-wrap: wrap;
    }

    .volume-container {
        width: 100%;
        margin-left: 0;
    }

    .volume-slider {
        flex: 1;
    }
}

#blazor-error-ui {
    background: var(--error);
    color: white;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    display: none;
    z-index: 1000;
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    color: white;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 1rem;
}

/* Viewer overlay styles */
.viewer-overlay {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.viewer-badge {
    background: rgba(37, 99, 235, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.unmute-btn {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: background 0.3s, transform 0.2s;
    animation: pulse 2s infinite;
}

.unmute-btn:hover {
    background: rgba(220, 38, 38, 0.95);
    transform: scale(1.05);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.host-left-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.host-left-overlay span {
    background: var(--error);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.role-indicator {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-indicator.host {
    background: var(--success);
    color: white;
}

.role-indicator.viewer {
    background: var(--royal-blue);
    color: white;
}

.viewer-progress {
    cursor: default;
    pointer-events: none;
}

.viewer-progress .progress-bar {
    opacity: 0.6;
    height: 8px;
}

.viewer-progress .progress-filled {
    background: linear-gradient(90deg, #64748b, #94a3b8);
}

/* Role badge in header */
.role-badge {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-badge.host {
    background: var(--success);
    color: white;
}

.role-badge.viewer {
    background: var(--royal-blue);
    color: white;
}

/* Viewer info section */
.viewer-info-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--royal-blue);
    text-align: center;
}

.viewer-info-section p {
    color: var(--text-secondary);
    margin: 0;
}

/* Click to play overlay for autoplay blocked */
.click-to-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    cursor: pointer;
}

.click-to-play-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: white;
    text-align: center;
}

.click-to-play-content .play-icon {
    font-size: 4rem;
    width: 100px;
    height: 100px;
    background: var(--royal-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, background 0.3s;
}

.click-to-play-overlay:hover .play-icon {
    transform: scale(1.1);
    background: var(--light-blue);
}

.click-to-play-content span:last-child {
    font-size: 1.25rem;
    font-weight: 500;
}
