/* CSS Variables */
:root {
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
    --secondary-color: #ec4899;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #262626;
    --bg-hover: #333333;
    
    --text-primary: #ffffff;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;
    
    --border-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.5);
    
    --header-height: 60px;
    --chat-width: 340px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --border-radius: 8px;
    --border-radius-lg: 12px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e5e5;
    --bg-hover: #d4d4d4;
    
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-muted: #737373;
    
    --border-color: #d4d4d4;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    cursor: pointer;
}

.logo i {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 5px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-links a.active {
    color: var(--primary-color);
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.theme-toggle,
.notification-btn,
.language-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    position: relative;
}

.theme-toggle:hover,
.notification-btn:hover,
.language-btn:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.notification-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--error-color);
    color: white;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: 600;
}

/* Language Selector */
.language-selector {
    position: relative;
}

.language-btn {
    width: auto;
    padding: 0 12px;
    gap: 6px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.language-btn #currentLang {
    font-size: 0.75rem;
}

.language-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    min-width: 160px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.language-menu.active {
    display: flex;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: left;
    font-size: 0.9rem;
}

.language-option:hover {
    background: var(--bg-tertiary);
}

.language-option.active {
    background: var(--primary-color);
    color: white;
}

.language-option .flag {
    font-size: 1.2rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 15px 5px 5px;
    background: var(--bg-tertiary);
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-menu:hover {
    background: var(--bg-hover);
}

.user-menu img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-menu span {
    font-weight: 500;
}

/* Main Content */
.main-content {
    margin-top: var(--header-height);
    padding: 20px;
}

.content-wrapper {
    display: flex;
    gap: 20px;
    max-width: 1800px;
    margin: 0 auto;
}

/* Video Section */
.video-section {
    flex: 1;
    min-width: 0;
}

.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.video-container video,
.video-container #youtubePlayer {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stream-overlay-container {
    position: absolute;
    inset: 0;
    z-index: 70;
    pointer-events: none;
    overflow: visible;
}

.stream-overlay-layer {
    position: absolute;
    border: 1px dashed rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.02);
}

.stream-overlay-layer iframe {
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: var(--transition-fast);
    cursor: pointer;
}

.video-container:hover .video-overlay {
    opacity: 1;
}

.video-container.playing .video-overlay {
    opacity: 0;
}

.video-container.playing:hover .video-overlay {
    opacity: 1;
}

.play-button-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    transition: var(--transition-normal);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
}

.play-button-large:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

/* Exit Fullscreen Button (Mobile) */
.exit-fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.exit-fullscreen-btn:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.9);
}

/* Show exit button in fullscreen on mobile */
.video-container:fullscreen .exit-fullscreen-btn,
.video-container:-webkit-full-screen .exit-fullscreen-btn {
    display: flex;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.loading-spinner.active {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Video Controls */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px 15px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.video-controls.visible,
.video-container:hover .video-controls {
    opacity: 1;
    pointer-events: auto;
}

.progress-container {
    padding: 10px 0;
    cursor: pointer;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    position: relative;
    transition: height var(--transition-fast);
}

.progress-container:hover .progress-bar {
    height: 6px;
}

.progress-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    width: 0%;
}

.progress-buffer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    width: 0%;
}

.controls-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.volume-slider-container {
    width: 0;
    overflow: hidden;
    transition: width var(--transition-fast);
}

.controls-left:hover .volume-slider-container {
    width: 80px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.time-display {
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
}

.live-badge {
    background: var(--error-color);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    animation: pulse 2s infinite;
}

.live-badge.scheduled {
    background: var(--warning-color);
    color: #000;
    animation: none;
}

.live-badge.offline {
    background: var(--text-muted);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.live-badge i {
    font-size: 0.5rem;
}

.quality-selector {
    position: relative;
}

#qualityBtn span {
    font-size: 0.75rem;
    margin-left: 3px;
}

.quality-menu {
    position: absolute;
    bottom: 50px;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: none;
    min-width: 120px;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.quality-menu.active {
    display: block;
}

.quality-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-primary);
}

.quality-option:hover {
    background: var(--bg-hover);
}

.quality-option.active {
    background: var(--primary-color);
    color: white;
}

/* Theater Mode */
.theater-mode .content-wrapper {
    max-width: 100%;
}

.theater-mode .video-container {
    aspect-ratio: 21 / 9;
    border-radius: 0;
}

.theater-mode .chat-section {
    position: fixed;
    right: 0;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    border-radius: 0;
}

/* Fullscreen */
.video-container:fullscreen,
.video-container:-webkit-full-screen,
.video-container:-moz-full-screen,
.video-container:-ms-fullscreen {
    border-radius: 0;
    overflow: hidden;
    aspect-ratio: auto;
    width: 100% !important;
    height: 100% !important;
    max-height: 100vh;
}

.video-container:fullscreen video,
.video-container:-webkit-full-screen video,
.video-container:-moz-full-screen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    aspect-ratio: auto;
}

.video-container:fullscreen .video-controls,
.video-container:-webkit-full-screen .video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 25px 25px;
    opacity: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    pointer-events: none;
}

.video-container:fullscreen .video-controls.visible,
.video-container:-webkit-full-screen .video-controls.visible,
.video-container:fullscreen:hover .video-controls,
.video-container:-webkit-full-screen:hover .video-controls {
    opacity: 1;
    pointer-events: auto;
}

/* iOS Safari: video element fullscreen */
video::-webkit-media-controls {
    display: none !important;
}

video:-webkit-full-screen {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Stream Info - Redesigned Layout */
.stream-info {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 20px 24px;
    margin-top: 15px;
}

.stream-info .stream-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.4;
}

.stream-info-bar {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stream-info-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.streamer-avatar {
    position: relative;
    flex-shrink: 0;
}

.streamer-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.online-indicator {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: var(--success-color);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.streamer-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.streamer-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.stream-category {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.stream-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    border: 1px solid var(--border-color);
}

.stat i {
    color: var(--primary-color);
    font-size: 0.8rem;
}

.stat span {
    font-weight: 600;
    color: var(--text-primary);
}

.stream-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.like-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.like-btn:hover {
    background: var(--bg-hover);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.like-btn.liked {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.like-btn.liked:hover {
    background: #db2777;
}

/* Like animation */
@keyframes likePopIn {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); }
    50% { transform: scale(0.9); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.like-btn.like-animate {
    animation: likePopIn 0.4s ease;
}

.subscribe-btn {
    background: var(--primary-color);
    color: white;
}

.subscribe-btn:hover {
    background: var(--primary-hover);
}

.subscribe-btn.subscribed {
    background: var(--success-color);
    color: white;
}

.subscribe-btn.subscribed:hover {
    background: #059669;
}
.share-btn,
#clipBtn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.share-btn:hover,
#clipBtn:hover {
    background: var(--bg-hover);
}

.stream-description {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.stream-description h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.stream-description p {
    color: var(--text-primary);
    line-height: 1.7;
    white-space: pre-wrap;
}

.tags {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.tag {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tag:hover {
    background: var(--primary-color);
    color: white;
}

/* Chat Section */
.chat-section {
    width: var(--chat-width);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 40px);
    position: sticky;
    top: calc(var(--header-height) + 20px);
    transition: var(--transition-normal);
}

.chat-section.collapsed {
    width: 50px;
}

.chat-section.collapsed .chat-messages,
.chat-section.collapsed .chat-input-container,
.chat-section.collapsed .chat-header h2,
.chat-section.collapsed .chat-settings-panel {
    display: none;
}

.chat-section.collapsed #toggleChatBtn i {
    transform: rotate(180deg);
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h2 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-actions {
    display: flex;
    gap: 5px;
}

.chat-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
}

.chat-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chat-settings-panel {
    padding: 15px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: none;
}

.chat-settings-panel.active {
    display: block;
}

.setting-item {
    margin-bottom: 10px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
}

.setting-item select {
    margin-left: auto;
    padding: 5px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-message .content {
    flex: 1;
    min-width: 0;
}

.chat-message .header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.chat-message .badges {
    display: flex;
    gap: 3px;
}

.chat-message .badge {
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 600;
}

.badge.mod {
    background: var(--success-color);
    color: white;
}

.badge.sub {
    background: var(--primary-color);
    color: white;
}

.badge.vip {
    background: var(--warning-color);
    color: white;
}

.chat-message .username {
    font-weight: 600;
    color: var(--primary-color);
}

.chat-message .timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-message .text {
    color: var(--text-primary);
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-message.highlight {
    background: rgba(124, 58, 237, 0.1);
    padding: 10px;
    border-radius: var(--border-radius);
    margin: -5px;
}

.chat-input-container {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    position: relative;
}

.emote-picker {
    position: absolute;
    bottom: 70px;
    left: 15px;
    right: 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px;
    display: none;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.emote-picker.active {
    display: block;
}

.emote-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
}

.emote {
    font-size: 1.5rem;
    padding: 5px;
    cursor: pointer;
    text-align: center;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
}

.emote:hover {
    background: var(--bg-hover);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 5px 10px;
}

.emote-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
}

.emote-btn:hover {
    color: var(--warning-color);
}

#chatInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

#chatInput::placeholder {
    color: var(--text-muted);
}

#chatInput.invalid {
    color: var(--error-color);
}

.chat-input-container:has(#chatInput.invalid) {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.char-counter {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
}

.send-btn:hover {
    background: var(--primary-hover);
}

.send-btn:disabled {
    background: var(--bg-hover);
    cursor: not-allowed;
}

/* Recommended Section */
.recommended-section {
    max-width: 1800px;
    margin: 40px auto 0;
}

.recommended-section h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recommended-section h2 i {
    color: var(--warning-color);
}

.recommended-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.stream-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-normal);
}

.stream-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow-color);
}

.stream-card .thumbnail {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.stream-card .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-normal);
}

.stream-card:hover .thumbnail img {
    transform: scale(1.05);
}

.stream-card .thumbnail .live-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--error-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.stream-card .thumbnail .viewer-count {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.stream-card .info {
    padding: 15px;
    display: flex;
    gap: 12px;
}

.stream-card .info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.stream-card .info .details h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stream-card .info .details p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.stream-card .info .details .category {
    color: var(--primary-color);
    margin-top: 5px;
}

/* YouTube Library Section */
.youtube-library-section {
    max-width: 1800px;
    margin: 40px auto 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
}

.youtube-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.youtube-library-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
}

.youtube-library-header h2 i {
    color: #ff0033;
}

.youtube-library-lead {
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.youtube-library-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.youtube-library-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 10px 14px;
}

.youtube-library-search i {
    color: var(--text-muted);
}

.youtube-library-search input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.92rem;
}

.youtube-library-count {
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 8px 12px;
}

.youtube-library-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 20px;
}

.youtube-library-player-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.youtube-library-player-ratio {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #000;
}

.youtube-library-player-ratio iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.youtube-library-meta {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 14px;
}

.youtube-library-meta h3 {
    margin-bottom: 8px;
}

.youtube-library-meta p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.youtube-library-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 650px;
    overflow-y: auto;
    padding-right: 4px;
}

.youtube-library-item {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    overflow: hidden;
}

.youtube-library-item.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.35);
}

.youtube-library-item:hover {
    transform: translateY(-1px);
    transition: transform 0.15s ease;
}

.youtube-library-item-btn {
    position: relative;
    border: none;
    background: #000;
    cursor: pointer;
    padding: 0;
}

.youtube-library-item-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.youtube-library-duration {
    position: absolute;
    right: 6px;
    bottom: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    padding: 3px 6px;
    border-radius: 4px;
}

.youtube-library-item-text {
    padding: 10px 10px 10px 0;
    min-width: 0;
}

.youtube-library-item-text h4 {
    font-size: 0.9rem;
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
}

.youtube-library-item-text p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.youtube-library-item-text span {
    color: var(--primary-color);
    font-size: 0.75rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    max-width: 500px;
    width: 100%;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.share-option {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.share-option:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.share-option i {
    font-size: 1.25rem;
}

.share-option[data-platform="facebook"] i { color: #1877f2; }
.share-option[data-platform="twitter"] i { color: #1da1f2; }
.share-option[data-platform="reddit"] i { color: #ff4500; }
.share-option[data-platform="whatsapp"] i { color: #25d366; }

.share-link {
    display: flex;
    gap: 10px;
}

.share-link input {
    flex: 1;
    padding: 12px 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.share-link button {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.share-link button:hover {
    background: var(--primary-hover);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3000;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    box-shadow: 0 4px 20px var(--shadow-color);
    animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success { border-left: 4px solid var(--success-color); }
.toast.error { border-left: 4px solid var(--error-color); }
.toast.warning { border-left: 4px solid var(--warning-color); }
.toast.info { border-left: 4px solid var(--accent-color); }

.toast i {
    font-size: 1.25rem;
}

.toast.success i { color: var(--success-color); }
.toast.error i { color: var(--error-color); }
.toast.warning i { color: var(--warning-color); }
.toast.info i { color: var(--accent-color); }

/* Responsive */
@media (max-width: 1200px) {
    .nav-links {
        display: none;
    }
    
    .search-box {
        width: 200px;
    }
}

@media (max-width: 992px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .chat-section {
        width: 100%;
        height: 400px;
        position: relative;
        top: 0;
    }
    
    .stream-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 15px;
    }
    
    .search-box {
        display: none;
    }
    
    .user-menu span {
        display: none;
    }
    
    .main-content {
        margin-top: 0;
        padding: 15px;
        padding-top: calc(var(--header-height) + 15px);
    }
    
    .stream-info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .stream-stats {
        margin-left: 0;
        gap: 8px;
    }
    
    .share-buttons {
        grid-template-columns: 1fr;
    }
    
    .share-link {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-left {
        gap: 10px;
    }
    
    .logo span {
        display: none;
    }
    
    .action-btn span {
        display: none;
    }
    
    .action-btn {
        padding: 10px;
    }
}

/* Username Modal */
.username-modal-content {
    max-width: 400px;
    text-align: center;
}

.username-modal-content .modal-header {
    justify-content: center;
    border-bottom: none;
    padding-bottom: 0;
}

.username-modal-content .modal-header h3 {
    font-size: 1.5rem;
}

.username-modal-content .modal-header h3 i {
    color: var(--primary-color);
    margin-right: 10px;
}

.username-modal-content .modal-body {
    padding: 20px 30px 30px;
}

.username-modal-content .modal-body p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.username-input-wrapper {
    margin-bottom: 20px;
}

.username-input-wrapper input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
    transition: var(--transition-fast);
}

.username-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.username-input-wrapper input.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.username-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.username-error {
    display: block;
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 8px;
    min-height: 20px;
}

.btn-primary {
    width: 100%;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(124, 58, 237, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.username-hint {
    font-size: 0.8rem;
    color: var(--text-muted) !important;
    margin-top: 15px !important;
    margin-bottom: 0 !important;
}

.auth-modal-content {
    max-width: 460px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.auth-tab {
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
}

.auth-tab.active {
    border-color: var(--primary-color);
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.18);
}

.auth-field {
    margin-bottom: 12px;
}

.auth-field label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.auth-field input {
    width: 100%;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 12px;
}

.auth-error {
    min-height: 18px;
    margin-bottom: 10px;
    color: var(--error-color);
    font-size: 0.82rem;
}

/* No streams message */
.no-streams {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-size: 1rem;
}

/* ====================================
   COUNTDOWN OVERLAY STYLES
   ==================================== */

.countdown-overlay,
.offline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(15, 15, 15, 0.98) 0%, rgba(26, 26, 26, 0.98) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    text-align: center;
}

/* Cover image as background behind countdown */
.countdown-overlay.has-cover {
    background: none;
}

.countdown-overlay.has-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--cover-image);
    background-size: cover;
    background-position: center;
    z-index: -2;
}

.countdown-overlay.has-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.70) 0%,
        rgba(15, 15, 30, 0.80) 100%
    );
    z-index: -1;
}

.countdown-content,
.offline-content {
    max-width: 600px;
    padding: 40px;
}

.countdown-icon,
.offline-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

.countdown-thumbnail {
    width: 200px;
    height: 200px;
    margin: 0 auto 30px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(124, 58, 237, 0.5);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px 10px rgba(124, 58, 237, 0.2);
    }
}

.countdown-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.countdown-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 30px;
}

.countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.countdown-unit {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 20px 15px;
    min-width: 80px;
    border: 1px solid var(--border-color);
}

.countdown-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 5px;
}

.countdown-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.countdown-separator {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-muted);
}

.countdown-date {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.btn-notify {
    padding: 15px 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-notify:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(124, 58, 237, 0.4);
}

.btn-notify:active {
    transform: translateY(0);
}

.btn-notify.subscribed {
    background: var(--success-color);
}

.offline-content h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.offline-content p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Responsive countdown */
@media (max-width: 768px) {
    .countdown-unit {
        min-width: 60px;
        padding: 15px 10px;
    }
    
    .countdown-value {
        font-size: 1.8rem;
    }
    
    .countdown-timer {
        gap: 5px;
    }
    
    .countdown-separator {
        font-size: 1.5rem;
    }
    
    .countdown-title {
        font-size: 1.5rem;
    }
    
    .countdown-icon,
    .offline-icon {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    .countdown-unit {
        min-width: 50px;
        padding: 12px 8px;
    }
    
    .countdown-value {
        font-size: 1.5rem;
    }
    
    .countdown-label {
        font-size: 0.65rem;
    }
}

/* =====================================================
   ENHANCED MOBILE RESPONSIVE STYLES
   ===================================================== */

/* Extra small devices (phones, 360px and down) */
@media (max-width: 360px) {
    :root {
        --header-height: 50px;
    }
    
    .header {
        padding: 0 10px;
    }
    
    .logo i {
        font-size: 1.2rem;
    }
    
    .main-content {
        margin-top: 0;
        padding: 10px;
        padding-top: calc(var(--header-height) + 10px);
    }
    
    .video-controls {
        padding: 8px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .stream-title {
        font-size: 1rem;
    }
    
    .countdown-timer {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .countdown-unit {
        min-width: 45px;
        padding: 10px 6px;
    }
    
    .countdown-value {
        font-size: 1.3rem;
    }
    
    .countdown-separator {
        display: none;
    }
}

/* Small devices (phones, 480px and up) */
@media (max-width: 480px) {
    .header-right {
        gap: 8px;
    }
    
    .notification-btn {
        padding: 8px;
    }
    
    .user-menu {
        padding: 5px 8px;
    }
    
    .user-menu img {
        width: 28px;
        height: 28px;
    }
    
    .stream-info-bar {
        gap: 10px;
    }
    
    .streamer-avatar img {
        width: 36px;
        height: 36px;
    }
    
    .stream-info .stream-title {
        font-size: 1.1rem;
    }
    
    .stream-actions {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .action-btn {
        flex: 1;
        min-width: 45px;
        justify-content: center;
    }
    
    .stat {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
    
    .chat-section {
        height: 350px;
    }
    
    .chat-header {
        padding: 12px;
    }
    
    .chat-header h2 {
        font-size: 1rem;
    }
    
    .chat-input-wrapper {
        padding: 10px;
    }
    
    .chat-input-container input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .stream-description {
        padding: 15px;
    }
    
    .stream-description h3 {
        font-size: 1rem;
    }
    
    .stream-description p {
        font-size: 0.9rem;
    }
    
    .tags {
        gap: 6px;
    }
    
    .tag {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .video-section {
        width: 100%;
    }
    
    .video-container {
        border-radius: var(--border-radius);
    }
    
    .chat-section {
        width: 100%;
        height: 400px;
        position: relative;
        top: 0;
        border-radius: var(--border-radius);
    }
    
    .chat-section.collapsed {
        height: 50px;
    }
    
    .stream-info {
        padding: 15px;
    }

    .controls-left,
    .controls-right {
        gap: 4px;
    }

    .control-btn {
        padding: 8px;
    }

    .volume-slider {
        width: 60px;
    }

    .progress-time {
        font-size: 0.75rem;
    }

    /* Fix controls layout for mobile - wrap to new line if needed */
    .controls-bottom {
        flex-wrap: wrap;
        gap: 8px;
    }

    .controls-left {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Hide time display on small mobile */
    .time-display {
        display: none;
    }

    /* Make live badge always visible */
    .live-badge {
        flex-shrink: 0;
    }
    
    /* Hide less important buttons on mobile */
    #pipBtn,
    #theaterBtn {
        display: none;
    }
    
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
    }
    
    .countdown-content {
        padding: 30px 20px;
    }
    
    .btn-notify {
        padding: 12px 24px;
        font-size: 0.9rem;
    }
}

/* Large tablets and small desktops */
@media (max-width: 992px) {
    .nav-links {
        display: none;
    }
    
    .search-box {
        width: 180px;
    }
    
    .stream-info-bar {
        flex-wrap: wrap;
    }
    
    .stream-stats {
        margin-left: 0;
    }
    
    .stream-actions {
        width: 100%;
        margin-top: 10px;
    }
}

/* Mobile landscape orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        height: 45px;
    }
    
    .main-content {
        padding-top: 55px;
    }
    
    .video-container {
        max-height: calc(100vh - 60px);
    }
    
    .countdown-overlay,
    .offline-overlay {
        padding: 10px;
    }
    
    .countdown-content {
        padding: 15px;
    }
    
    .countdown-icon,
    .offline-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .countdown-title {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }
    
    .countdown-subtitle {
        display: none;
    }
    
    .countdown-timer {
        margin-bottom: 10px;
    }
    
    .countdown-date {
        font-size: 0.8rem;
    }
    
    .btn-notify {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .video-overlay {
        opacity: 1;
    }
    
    .video-controls {
        opacity: 1;
    }
    
    .control-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .volume-control:hover .volume-slider {
        width: 80px;
        opacity: 1;
    }
    
    .chat-message:hover {
        background: transparent;
    }
    
    .action-btn:hover {
        transform: none;
    }
}

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    .main-content {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
    
    .video-controls {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }
}

/* Improve countdown thumbnail on mobile */
@media (max-width: 480px) {
    .countdown-thumbnail {
        width: 150px;
        height: 150px;
    }
    
    .countdown-icon,
    .offline-icon {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }
}

/* Chat mobile optimizations */
@media (max-width: 768px) {
    .chat-message {
        padding: 10px 12px;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .message-username {
        font-size: 0.85rem;
    }
    
    .message-text {
        font-size: 0.9rem;
    }
    
    .message-timestamp {
        font-size: 0.65rem;
    }
    
    .emoji-picker {
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        max-width: 95vw;
    }
}

/* Recommended streams mobile */
@media (max-width: 768px) {
    .recommended-streams {
        padding: 15px;
    }
    
    .recommended-streams h3 {
        font-size: 1rem;
    }
    
    .stream-card {
        flex-direction: row;
        gap: 12px;
    }
    
    .stream-card .thumbnail {
        width: 120px;
        height: 68px;
        flex-shrink: 0;
    }
    
    .stream-card .stream-card-info {
        flex: 1;
    }
    
    .stream-card .stream-card-title {
        font-size: 0.9rem;
    }

    .youtube-library-section {
        padding: 14px;
        margin-top: 24px;
    }

    .youtube-library-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .youtube-library-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .youtube-library-count {
        align-self: flex-start;
    }

    .youtube-library-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .youtube-library-list {
        max-height: 380px;
    }

    .youtube-library-item {
        grid-template-columns: 120px minmax(0, 1fr);
    }
}

/* =====================================================
   COMPREHENSIVE MOBILE FIX - Improved Layout
   ===================================================== */

/* Fix video container on mobile */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .main-content {
        margin-top: 0;
        padding: 10px;
        padding-top: calc(var(--header-height) + 10px);
        min-height: 100vh;
    }
    
    .content-wrapper {
        flex-direction: column;
        gap: 10px;
        margin-top: 0;
        padding-top: 0;
    }
    
    .video-section {
        width: 100%;
        max-width: 100vw;
        margin-top: 0;
        padding-top: 0;
    }
    
    .video-container {
        width: 100%;
        border-radius: 8px;
        overflow: visible;
        margin-top: 0;
        aspect-ratio: auto;
        min-height: 0;
    }
    
    .video-container video {
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: contain;
        display: block;
    }
    
    .video-wrapper {
        width: 100%;
        position: relative;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
        height: 0;
        overflow: hidden;
    }
    
    .video-wrapper video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
    
    /* Stream info mobile fix */
    .stream-info {
        padding: 12px;
    }
    
    .stream-info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .streamer-avatar img {
        width: 40px;
        height: 40px;
    }
    
    .stream-info .stream-title {
        font-size: 1rem;
        line-height: 1.3;
        word-break: break-word;
        margin-bottom: 12px;
    }
    
    .streamer-name {
        font-size: 0.85rem;
    }
    
    .stream-category {
        font-size: 0.8rem;
    }
    
    /* Stream actions horizontal scroll on mobile */
    .stream-actions {
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 5px;
    }
    
    .stream-actions::-webkit-scrollbar {
        display: none;
    }
    
    .stream-actions .action-btn {
        flex-shrink: 0;
        padding: 8px 12px;
    }
    
    /* Stream stats */
    .stream-stats {
        margin-left: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .stat {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
    
    /* Stream description mobile */
    .stream-description {
        padding: 12px;
        margin-top: 10px;
    }
    
    .stream-description h3 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    .stream-description p {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .tags {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .tag {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
    
    /* Chat section mobile - full width below video */
    .chat-section {
        width: 100%;
        height: 350px;
        position: relative;
        top: 0;
        border-radius: 8px;
        margin-top: 10px;
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-header h2 {
        font-size: 0.95rem;
    }
    
    .chat-input-wrapper {
        padding: 8px;
    }
    
    .chat-input-container {
        gap: 6px;
    }
    
    .chat-input-container input {
        padding: 10px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .emoji-btn,
    .chat-send-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    /* Live badge mobile */
    .live-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    
    /* Video controls mobile */
    .video-controls {
        padding: 8px;
        gap: 5px;
    }
    
.controls-left,
    .controls-right {
        gap: 2px;
    }

    .control-btn {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .volume-control .volume-slider,
    .volume-slider-container {
        display: none;
    }

    .progress-bar {
        height: 4px;
    }

    /* Controls bottom wrap */
    .controls-bottom {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
    }

    .controls-left {
        flex: 1;
        min-width: 0;
        justify-content: flex-start;
    }

    .controls-right {
        flex-shrink: 0;
    }

    /* Live badge responsive */
    .live-badge {
        padding: 3px 6px;
        font-size: 0.65rem;
        flex-shrink: 0;
    }

    .live-badge i {
        font-size: 0.4rem;
    }
}

/* Extra small phones */
@media (max-width: 420px) {
    .header {
        height: 50px;
        padding: 0 8px;
    }
    
    .logo {
        gap: 6px;
    }
    
    .logo i {
        font-size: 1.3rem;
    }
    
    .logo span {
        display: none;
    }
    
    .header-right {
        gap: 5px;
    }
    
    .theme-toggle,
    .notification-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .user-menu {
        padding: 4px 6px;
    }
    
    .user-menu img {
        width: 28px;
        height: 28px;
    }
    
    .user-menu span {
        display: none;
    }
    
    .main-content {
        padding: 8px;
        padding-top: 58px;
    }
    
    .stream-title {
        font-size: 0.95rem;
    }
    
    .stream-actions .action-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .action-btn span {
        display: none;
    }
    
    .chat-section {
        height: 300px;
    }
    
    .chat-message {
        padding: 8px 10px;
    }
    
    .message-content {
        gap: 4px;
    }
    
    /* Countdown mobile */
    .countdown-content {
        padding: 20px 15px;
    }
    
    .countdown-title {
        font-size: 1.1rem;
    }
    
    .countdown-subtitle {
        font-size: 0.85rem;
    }
    
    .countdown-timer {
        gap: 4px;
    }
    
    .countdown-unit {
        min-width: 45px;
        padding: 10px 5px;
    }
    
    .countdown-value {
        font-size: 1.3rem;
    }
    
    .countdown-label {
        font-size: 0.6rem;
    }
    
    .countdown-separator {
        font-size: 1.2rem;
        padding: 0 2px;
    }
    
    .btn-notify {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
}

/* Mobile overlay fix - make overlays fit and scroll when needed */
@media (max-width: 768px) {
    .video-container {
        overflow: visible;
        aspect-ratio: auto;
    }
    
    .video-container video {
        width: 100%;
        aspect-ratio: 16 / 9;
        display: block;
        background: #000;
    }
    
    .countdown-overlay,
    .offline-overlay {
        position: relative;
        min-height: 56.25vw; /* match 16:9 */
        border-radius: 8px;
        overflow: hidden;
    }
    
    .countdown-content,
    .offline-content {
        padding: 20px 15px;
        max-width: 100%;
    }
    
    .countdown-icon,
    .offline-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    .countdown-thumbnail {
        width: 120px;
        height: 120px;
        margin-bottom: 15px;
    }
    
    .countdown-title {
        font-size: 1.2rem;
        margin-bottom: 6px;
    }
    
    .countdown-subtitle {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    .countdown-timer {
        gap: 6px;
        margin-bottom: 15px;
    }
    
    .countdown-unit {
        min-width: 55px;
        padding: 10px 8px;
    }
    
    .countdown-value {
        font-size: 1.5rem;
    }
    
    .countdown-label {
        font-size: 0.65rem;
    }
    
    .countdown-separator {
        font-size: 1.2rem;
    }
    
    .countdown-date {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    .btn-notify {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
    
    .offline-content h2 {
        font-size: 1.2rem;
    }
    
    .offline-content p {
        font-size: 0.85rem;
    }
    
    /* Video controls need to work relative to video on mobile */
    .video-controls {
        position: relative;
        opacity: 1;
        background: var(--bg-secondary);
    }
    
    .video-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
}

/* Fix for iOS Safari bottom bar */
@supports (-webkit-touch-callout: none) {
    .chat-section {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    .chat-input-wrapper {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}

/* Fix video fullscreen on mobile */
@media (max-width: 768px) {
    .video-container:-webkit-full-screen {
        width: 100% !important;
        height: 100% !important;
        overflow: hidden;
        aspect-ratio: auto;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 99999;
    }
    
    .video-container:fullscreen {
        width: 100% !important;
        height: 100% !important;
        overflow: hidden;
        aspect-ratio: auto;
    }
    
    .video-container:-webkit-full-screen video,
    .video-container:fullscreen video {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain;
        aspect-ratio: auto;
        position: absolute;
        top: 0;
        left: 0;
    }
    
    .video-container:-webkit-full-screen .video-controls,
    .video-container:fullscreen .video-controls {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        opacity: 1;
        z-index: 100000;
    }
    
    .video-container:-webkit-full-screen .countdown-overlay,
    .video-container:-webkit-full-screen .offline-overlay,
    .video-container:fullscreen .countdown-overlay,
    .video-container:fullscreen .offline-overlay {
        position: absolute;
    }
    
    /* iOS Safari video fullscreen */
    video:-webkit-full-screen {
        width: 100%;
        height: 100%;
    }
}

/* Prevent zoom on input focus iOS */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Email Subscribe Modal */
.email-input-wrapper {
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.email-input-wrapper input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color, #2d3748);
    border-radius: 8px;
    background: var(--bg-secondary, #1a1a2e);
    color: var(--text-primary, #e2e8f0);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.email-input-wrapper input[type="email"]:focus {
    border-color: #7c3aed;
}

.email-error {
    color: #ef4444;
    font-size: 13px;
    min-height: 18px;
}

.subscribed-email {
    background: var(--bg-secondary, #1a1a2e);
    padding: 10px 16px;
    border-radius: 8px;
    color: #7c3aed;
    font-weight: 600;
    margin: 12px 0;
    text-align: center;
    word-break: break-all;
}

.btn-danger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-danger:active {
    transform: scale(0.98);
}

#followSubscribeView p,
#followUnsubscribeView p {
    color: var(--text-secondary, #a0aec0);
    line-height: 1.5;
    margin: 8px 0;
}
