/**
 * Wedding Livestream Platform - Viewer Styles
 * Modern, clean design matching reference UI
 */

/* ================================
   CSS Variables & Reset
   ================================ */

:root {
    /* Colors */
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-secondary: #64748b;
    --color-background: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-border: #e2e8f0;
    --color-error: #ef4444;
    --color-success: #22c55e;
    --color-live: #ef4444;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-player: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Gradients */
    --gradient-player: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(147, 51, 234, 0.3), rgba(236, 72, 153, 0.3));

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;

    /* Fonts */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ================================
   Auth Page Styles
   ================================ */

.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.event-date {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
}

.form-group input {
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-group input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input.error {
    border-color: var(--color-error);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.error-message {
    color: var(--color-error);
    font-size: 0.875rem;
    text-align: center;
    padding: 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
}

.powered-by {
    margin-top: 24px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

/* ================================
   Player Page Styles
   ================================ */

.player-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--color-background);
}

/* Password Overlay (full page with blur) */
.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.password-modal {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    margin: 20px;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.password-header {
    text-align: center;
    margin-bottom: 32px;
}

.password-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.password-event-date {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.password-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.password-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.btn-full {
    width: 100%;
}

.password-overlay.hidden {
    display: none;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 32px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.header-left {
    flex: 1;
}

.event-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.event-time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.icon-clock {
    font-size: 0.875rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.viewer-count {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-primary);
}

.company-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.company-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-sm);
}

.company-logo svg {
    width: 18px;
    height: 18px;
}

.company-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    padding: 24px 32px;
    gap: 24px;
}

/* Player Container */
.player-container {
    flex: 1;
    display: flex;
    align-items: flex-start;
}

.player-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: var(--shadow-player);

    /* Gradient border effect like reference */
    border: 4px solid transparent;
    background-clip: padding-box;
}

.player-wrapper::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: var(--gradient-player);
    border-radius: calc(var(--radius-2xl) + 4px);
    z-index: -1;
    filter: blur(10px);
    opacity: 0.7;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Hide native video controls on all browsers */
.video-player::-webkit-media-controls {
    display: none !important;
}

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

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

.video-player::-moz-media-controls {
    display: none !important;
}

/* Firefox fullscreen controls */
.video-player::-moz-media-controls-panel {
    display: none !important;
}

/* Overlays */
.pre-event-overlay,
.unmute-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    z-index: 10;
}

/* Fallback overlay - transparent, message at bottom like subtitle */
.fallback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background: transparent;
    color: white;
    z-index: 10;
    pointer-events: none;
}

.fallback-image {
    display: none;
    max-width: 80%;
    max-height: 60%;
    object-fit: contain;
    border-radius: var(--radius-lg);
    pointer-events: auto;
}

.fallback-message {
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 24px;
    margin-bottom: 60px;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    border-radius: var(--radius-md);
    pointer-events: auto;
}

.pre-event-content {
    text-align: center;
    padding: 40px;
}

.countdown-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.pre-event-content h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.countdown-time {
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 16px;
}

.event-start-info {
    font-size: 1rem;
    opacity: 0.8;
}

.unmute-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.unmute-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    color: white;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.unmute-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.unmute-btn span {
    font-size: 1rem;
    font-weight: 500;
}

/* Player Controls */
.player-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 5;
}

.player-controls.visible,
.player-wrapper:hover .player-controls {
    opacity: 1;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* DVR Progress Bar */
.dvr-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.dvr-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    position: relative;
    overflow: visible;
}

.dvr-buffered {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    width: 0%;
}

.dvr-played {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.dvr-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 1;
    left: 0%;
}

.dvr-progress:hover .dvr-handle {
    opacity: 1;
}

.dvr-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-mono);
    min-width: 45px;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dvr-time.live {
    background: var(--color-live);
    font-weight: 600;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
    transition: background var(--transition-fast);
}

.live-indicator.live {
    background: var(--color-live);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
}

.live-indicator.live .live-dot {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    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;
}

/* Sidebar */
.sidebar {
    width: 320px;
    flex-shrink: 0;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.event-info-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.sidebar-date {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.sidebar-time {
    font-size: 0.9rem;
    color: var(--color-primary);
    font-weight: 500;
}

.sidebar-local-time {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    font-style: italic;
    margin-top: 4px;
}

/* Chat Section */
.chat-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 400px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
    font-weight: 600;
}

.chat-status {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-success);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    min-height: 150px;
    max-height: 250px;
}

.chat-message {
    padding: 8px 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border);
}

.chat-message:last-child {
    border-bottom: none;
}

.chat-name {
    font-weight: 600;
    color: var(--color-primary);
    margin-right: 6px;
}

.chat-text {
    color: var(--color-text);
    word-break: break-word;
}

.chat-name-form,
.chat-input-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--color-border);
    background: var(--color-background);
}

.chat-name-form input,
.chat-input-form input {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
}

.chat-name-form input:focus,
.chat-input-form input:focus {
    border-color: var(--color-primary);
}

.btn-small {
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.btn-small:hover {
    background: var(--color-primary-dark);
}

.btn-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================
   Responsive Styles
   ================================ */

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        padding: 16px;
    }

    .sidebar {
        width: 100%;
    }

    .player-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .event-title {
        font-size: 1.25rem;
    }

    .main-content {
        padding: 12px;
        gap: 16px;
    }

    .player-wrapper {
        border-radius: var(--radius-lg);
    }

    .volume-slider {
        display: none;
    }

    .control-btn {
        width: 36px;
        height: 36px;
    }

    .control-btn svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 24px;
    }

    .company-badge {
        padding: 6px 12px;
    }

    .company-name {
        font-size: 0.75rem;
    }

    .countdown-time {
        font-size: 2rem;
    }
}