/* Clean Viewer Styles - No conflicts, no !important abuse */

/* Reset and Base */
#viewer-page {
    width: 100%;
    height: 100vh;
    background: #0e0e10;
    color: #efeff1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Main Container */
.viewer-container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Video Section */
.video-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Video Wrapper */
.video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 120px);
}

/* Main Video Element */
.main-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Video Overlays */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10;
}

.video-overlay.loading-state {
    background: #000;
}

.video-overlay.error-state {
    background: rgba(0, 0, 0, 0.95);
}

/* Loading Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #9147ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error State */
.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-message {
    font-size: 18px;
    margin-bottom: 24px;
    color: #dedee3;
}

.retry-btn {
    padding: 10px 24px;
    background: #9147ff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.retry-btn:hover {
    background: #7c3fc7;
}

/* Stream Info Bar */
.stream-info-bar {
    padding: 20px;
    background: #18181b;
    border-top: 1px solid #2f2f35;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.stream-details {
    flex: 1;
    min-width: 0;
}

.stream-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.streamer-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2f2f35;
}

.category-badge {
    padding: 4px 8px;
    background: #2f2f35;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Stream Stats */
.stream-stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #ff4545;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #ff4545;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.viewer-count {
    font-size: 14px;
    color: #adadb8;
}

/* Chat Sidebar */
.chat-sidebar {
    position: relative;
    width: 50px;
    background: #1f1f23;
    border-left: 1px solid #2f2f35;
    transition: width 0.3s ease;
}

.chat-sidebar.expanded {
    width: 340px;
}

/* Chat Toggle Button */
.chat-toggle {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: #1f1f23;
    border: 1px solid #2f2f35;
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background 0.2s;
    z-index: 2;
}

.chat-toggle:hover {
    background: #26262c;
}

.chat-sidebar.expanded .chat-toggle {
    display: none;
}

/* Chat Container */
.chat-container {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 340px;
}

.chat-sidebar.expanded .chat-container {
    display: flex;
}

/* Chat Header */
.chat-header {
    padding: 16px;
    background: #1f1f23;
    border-bottom: 1px solid #2f2f35;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

.chat-close {
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    color: #adadb8;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-close:hover {
    background: #2f2f35;
    color: #efeff1;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #0e0e10;
}

/* Chat Input */
.chat-input-area {
    padding: 16px;
    background: #1f1f23;
    border-top: 1px solid #2f2f35;
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 10px 12px;
    background: #0e0e10;
    border: 2px solid #2f2f35;
    border-radius: 4px;
    color: #efeff1;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #9147ff;
}

.chat-send {
    padding: 10px 20px;
    background: #9147ff;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-send:hover {
    background: #7c3fc7;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .viewer-container {
        flex-direction: column;
    }

    .video-wrapper {
        max-height: 50vh;
    }

    .chat-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 60px;
        border-left: none;
        border-top: 1px solid #2f2f35;
        z-index: 100;
    }

    .chat-sidebar.expanded {
        height: 50vh;
        width: 100%;
    }

    .chat-toggle {
        left: 50%;
        top: 0;
        transform: translateX(-50%) translateY(-50%);
        width: 60px;
        height: 40px;
        border-radius: 20px 20px 0 0;
        border: 1px solid #2f2f35;
        border-bottom: none;
    }

    .chat-container {
        width: 100%;
    }

    .stream-info-bar {
        padding: 12px;
    }

    .stream-title {
        font-size: 16px;
    }
}