/**
 * CSS CRÍTICO para streams - Solo estilos esenciales
 * Inline para velocidad de carga inicial
 * 
 * @author MrGreen Development Team
 * @version 2.0.0
 * @since 2025-01-08
 */

/* ===== VARIABLES CRÍTICAS ===== */
.streams-page {
    --bg-primary: #f2f5fb;
    --bg-secondary: #e6ecf8;
    --bg-card: #ffffff;
    --bg-card-hover: #f8faff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-accent: #22c55e;
    --danger: #ef4444;
    --border-light: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.16);
    --overlay-gradient: linear-gradient(180deg, rgba(15, 23, 42, 0) 35%, rgba(15, 23, 42, 0.55) 100%);
    --gradient-primary: linear-gradient(135deg, #22c55e 0%, #06b6d4 100%);
    --gradient-hover: linear-gradient(135deg, #16a34a 0%, #0ea5e9 100%);
    --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 16px 36px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.14);
    --shadow-xl: 0 40px 60px rgba(15, 23, 42, 0.18);
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --placeholder-color: rgba(100, 116, 139, 0.45);
    --live-badge-bg: #53fc1b;
    --live-badge-border: #53fc1b;
    --live-badge-text: #000000;
    --live-badge-shadow: 0 0 18px rgba(83, 252, 27, 0.35);
    --live-badge-text-shadow: none;
    --viewer-chip-bg: rgba(8, 11, 17, 0.85);
    --viewer-chip-border: rgba(15, 23, 42, 0.24);
    --viewer-chip-color: #ffffff;
    --avatar-border: rgba(34, 197, 94, 0.22);
    --avatar-bg: rgba(34, 197, 94, 0.08);
    --meta-chip-bg: rgba(34, 197, 94, 0.12);
    --meta-chip-border: rgba(34, 197, 94, 0.32);
    --meta-chip-color: #0f172a;
    --meta-chip-secondary-bg: rgba(15, 23, 42, 0.06);
    --meta-chip-secondary-border: rgba(15, 23, 42, 0.14);
    --meta-chip-secondary-color: #475569;
    --stat-bg: rgba(15, 23, 42, 0.05);
    --stat-border: rgba(15, 23, 42, 0.12);
    --stat-color: #475569;
    --featured-overlay: linear-gradient(180deg, rgba(15, 23, 42, 0) 40%, rgba(15, 23, 42, 0.7) 100%);
    --media-fallback-bg: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
    --thumbnail-border: rgba(15, 23, 42, 0.1);
    --like-btn-border-hover: rgba(15, 23, 42, 0.14);
    --like-btn-bg-hover: rgba(15, 23, 42, 0.08);
    --transition: 0.3s ease;
}

.dark-mode .streams-page {
    --bg-primary: #080b11;
    --bg-secondary: #0f131b;
    --bg-card: #121924;
    --bg-card-hover: #161f2d;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #53fc1b;
    --danger: #ff2d55;
    --border-light: rgba(148, 163, 184, 0.12);
    --border-strong: rgba(148, 163, 184, 0.24);
    --overlay-gradient: linear-gradient(180deg, rgba(8, 11, 17, 0) 40%, rgba(8, 11, 17, 0.85) 100%);
    --gradient-primary: linear-gradient(135deg, #53fc1b 0%, #00f0ff 100%);
    --gradient-hover: linear-gradient(135deg, #4ae11a 0%, #00d4e6 100%);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 10px 30px rgba(8, 15, 26, 0.45);
    --shadow-lg: 0 20px 45px rgba(8, 15, 26, 0.55);
    --shadow-xl: 0 40px 60px rgba(8, 15, 26, 0.65);
    --placeholder-color: rgba(226, 232, 240, 0.75);
    --live-badge-bg: #53fc1b;
    --live-badge-border: #53fc1b;
    --live-badge-text: #000000;
    --live-badge-shadow: 0 0 22px rgba(83, 252, 27, 0.4);
    --live-badge-text-shadow: none;
    --viewer-chip-bg: rgba(8, 11, 17, 0.85);
    --viewer-chip-border: rgba(148, 163, 184, 0.24);
    --viewer-chip-color: #e2e8f0;
    --avatar-border: rgba(83, 252, 27, 0.25);
    --avatar-bg: rgba(83, 252, 27, 0.08);
    --meta-chip-bg: rgba(83, 252, 27, 0.14);
    --meta-chip-border: rgba(83, 252, 27, 0.45);
    --meta-chip-color: #53fc1b;
    --meta-chip-secondary-bg: rgba(148, 163, 184, 0.12);
    --meta-chip-secondary-border: rgba(148, 163, 184, 0.16);
    --meta-chip-secondary-color: #94a3b8;
    --stat-bg: rgba(148, 163, 184, 0.08);
    --stat-border: rgba(148, 163, 184, 0.14);
    --stat-color: #94a3b8;
    --featured-overlay: linear-gradient(180deg, rgba(8, 11, 17, 0) 40%, rgba(8, 11, 17, 0.85) 100%);
    --media-fallback-bg: linear-gradient(135deg, #1f2937 0%, #0f172a 100%);
    --thumbnail-border: rgba(148, 163, 184, 0.18);
    --like-btn-border-hover: rgba(148, 163, 184, 0.25);
    --like-btn-bg-hover: rgba(148, 163, 184, 0.08);
}

.dark-mode .go-live-btn,
.dark-mode .watch-btn {
    background: transparent;
    color: #53fc1b;
    border: 2px solid rgba(83, 252, 27, 0.8);
    box-shadow: none;
}

.dark-mode .go-live-btn:hover,
.dark-mode .watch-btn:hover {
    background: rgba(83, 252, 27, 0.14);
    color: #53fc1b;
    box-shadow: 0 0 25px rgba(83, 252, 27, 0.25);
}

.dark-mode .watch-btn i,
.dark-mode .go-live-btn i {
    color: inherit;
}

/* ===== RESET CRÍTICO ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.streams-page {
    background: transparent;
    color: var(--text-primary);
    min-height: 100vh;
    font-family: var(--font-family);
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.streams-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-lg);
    min-height: 100vh;
}

/* ===== HEADER CRÍTICO ===== */
.streams-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.streams-header-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.streams-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.streams-title::before {
    content: "🔴";
    font-size: var(--font-size-xl);
}

.streams-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.stream-featured {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-xl);
    background: var(--bg-card);
    border-radius: 20px;
    padding: var(--space-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-2xl);
}

.stream-featured__media {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    display: block;
    min-height: 320px;
    background: var(--media-fallback-bg);
}

.stream-preview-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
    background: var(--media-fallback-bg);
}

.stream-preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.stream-preview-wrapper.is-live .stream-preview-video {
    opacity: 1;
}

.stream-preview-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--media-fallback-bg);
    transition: opacity 0.35s ease;
    z-index: 1;
}

.stream-preview-wrapper.is-live .stream-preview-placeholder {
    opacity: 0;
    pointer-events: none;
}

.stream-preview-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(8, 11, 17, 0.28) 0%, rgba(8, 11, 17, 0.08) 45%, rgba(8, 11, 17, 0.32) 100%);
    transition: opacity 0.35s ease;
}

.stream-preview-wrapper:not(.is-live) .stream-preview-overlay {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0.18) 60%, rgba(15, 23, 42, 0.5) 100%);
}

.stream-preview-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(12, 226, 108, 0.2);
    border: 1px solid rgba(83, 252, 27, 0.6);
    color: #53fc1b;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.stream-preview-badge.is-offline {
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.28);
    color: var(--meta-chip-secondary-color);
}

.stream-preview-wrapper:not(.is-live) .stream-preview-badge {
    background: rgba(148, 163, 184, 0.18);
    border-color: rgba(148, 163, 184, 0.25);
    color: var(--text-secondary);
}

.stream-preview-meta {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.stream-preview-viewers {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(8, 11, 17, 0.85);
    color: var(--viewer-chip-color);
    border: 1px solid rgba(148, 163, 184, 0.24);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.stream-preview-wrapper:not(.is-live) .stream-preview-viewers {
    background: rgba(15, 23, 42, 0.8);
}

.stream-preview-viewers i {
    color: var(--text-accent);
    font-size: 0.8rem;
}

.stream-featured__info {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.stream-featured__author {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.stream-featured__avatar {
    width: 56px;
    height: 56px;
}

.stream-featured__author-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.stream-featured__title {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.4;
}

.stream-featured__title:hover {
    color: var(--text-accent);
}

.stream-featured__description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.stream-featured__actions {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-top: auto;
}

.watch-btn--featured {
    padding: 0.65rem 1.45rem;
    font-size: 1rem;
    border-radius: 12px;
}

.watch-btn--featured i {
    font-size: 1.05rem;
}
.go-live-btn {
    background: #53fc1b;
    color: #081902;
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: 8px;
    font-weight: 600;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.go-live-btn i {
    color: inherit;
}

.go-live-btn:hover {
    background: #42e012;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: #0a111f;
}

/* ===== GRID DE STREAMS CRÍTICO ===== */
.streams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

/* ===== TARJETA DE STREAM CRÍTICA ===== */
.stream-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: relative;
}

.stream-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    background: var(--bg-card-hover);
}

.stream-thumbnail-link {
    position: relative;
    display: block;
}

.stream-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 210px;
    overflow: hidden;
    background: var(--media-fallback-bg);
    border-bottom: 1px solid var(--thumbnail-border);
}

.stream-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(226, 232, 240, 0.75);
    font-size: 2rem;
}

.live-indicator {
    position: absolute;
    top: 14px;
    left: 14px;
    background: var(--live-badge-bg);
    border: 1px solid var(--live-badge-border);
    color: var(--live-badge-text);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.04em;
    box-shadow: var(--live-badge-shadow);
    text-shadow: var(--live-badge-text-shadow);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-accent);
    box-shadow: 0 0 0 rgba(83, 252, 27, 0.4);
    animation: pulse-ring 1.6s infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(83, 252, 27, 0.5);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(83, 252, 27, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(83, 252, 27, 0);
    }
}

.viewer-count {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: var(--viewer-chip-bg);
    backdrop-filter: blur(12px);
    color: var(--viewer-chip-color);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--viewer-chip-border);
}

.viewer-count i {
    color: var(--text-accent);
}

.stream-info {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.stream-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    display: block;
    text-decoration: none;
    transition: color 0.2s ease;
}

.stream-title:hover {
    color: var(--text-accent);
}

.stream-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.stream-tag {
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.stream-tag.primary {
    background: var(--meta-chip-bg);
    color: var(--meta-chip-color);
    border: 1px solid var(--meta-chip-border);
}

.stream-tag.secondary {
    background: var(--meta-chip-secondary-bg);
    color: var(--meta-chip-secondary-color);
    border: 1px solid var(--meta-chip-secondary-border);
}

.stream-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stream-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.watch-btn {
    background: transparent;
    color: #081902;
    border: 2px solid #53fc1b;
    padding: var(--space-sm) var(--space-lg);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    box-shadow: none;
}

.stream-card-footer .watch-btn {
    padding: 0.45rem 1.1rem;
    border-radius: 12px;
    font-size: 0.95rem;
}

.watch-btn i {
    color: inherit;
}

.watch-btn:hover {
    background: rgba(83, 252, 27, 0.1);
    transform: translateY(-1px);
    color: #081902;
    box-shadow: var(--shadow-sm);
}

.like-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 999px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
}

.like-btn:hover {
    border-color: var(--like-btn-border-hover);
    background: var(--like-btn-bg-hover);
    color: var(--text-accent);
}

/* ===== SECCIÓN HEADER ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-title::before {
    content: "🔥";
    font-size: var(--font-size-lg);
}

.view-all-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.15s ease;
}

.view-all-btn:hover {
    color: var(--text-primary);
}

.streamer-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.streamer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--avatar-border);
    background: var(--avatar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.streamer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.streamer-avatar-fallback {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-accent);
}

.streamer-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.streamer-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
}

.stream-meta-list {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.stream-meta-tag {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    background: var(--meta-chip-bg);
    color: var(--meta-chip-color);
    border: 1px solid var(--meta-chip-border);
}

.stream-meta-tag.secondary {
    background: var(--meta-chip-secondary-bg);
    color: var(--meta-chip-secondary-color);
    border: 1px solid var(--meta-chip-secondary-border);
}

.stream-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 90%;
}

/* ===== ESTADO VACÍO CRÍTICO ===== */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.empty-state-text {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-xl);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== RESPONSIVE CRÍTICO ===== */
@media (max-width: 768px) {
    .streams-container {
        padding: var(--space-md);
    }
    
    .stream-featured {
        grid-template-columns: 1fr;
        padding: var(--space-lg);
    }
    
    .stream-featured__media {
        min-height: 260px;
    }
    
    .stream-featured__actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }
    
    .watch-btn--featured {
        justify-content: center;
    }
    
    .stream-thumbnail {
        min-height: 180px;
    }
    
    .streams-header {
        flex-direction: column;
        gap: var(--space-lg);
        align-items: stretch;
    }
    
    .streams-title {
        font-size: var(--font-size-2xl);
        justify-content: center;
    }
    
    .streams-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .section-header {
        flex-direction: column;
        gap: var(--space-md);
        align-items: stretch;
    }
    
    .stream-card {
        border-radius: 16px;
    }
    
    .streamer-meta {
        align-items: flex-start;
    }
    
    .stream-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }
    
    .stream-featured__info {
        gap: var(--space-md);
    }
    
    .stream-stats {
        justify-content: space-between;
    }
}

@media (max-width: 600px) {
    .stream-featured {
        padding: var(--space-md);
    }
    
    .stream-featured__media {
        min-height: 220px;
    }
}

@media (max-width: 480px) {
    .streams-container {
        padding: var(--space-sm);
    }
    
    .streams-title {
        font-size: var(--font-size-xl);
    }
    
    .go-live-btn {
        padding: var(--space-sm) var(--space-lg);
        font-size: 0.875rem;
    }
    
    .stream-info {
        padding: var(--space-md);
    }
    
    .stream-thumbnail {
        min-height: 160px;
    }
    
    .stream-title {
        font-size: 1.05rem;
    }
    
    .stream-featured__title {
        font-size: 1.2rem;
    }
    
    .stream-featured__description {
        font-size: 0.95rem;
    }
}
