/* ==========================================================================
   Streams — Twitch directory matching the wiki/rules/members theme
   --------------------------------------------------------------------------
   Clean centered header, a stats card, action bar, and a grid of live-stream
   cards plus the watch/ban modals. Built on --streams-* tokens remapped to the
   site accent (#2bbdf6). Twitch-semantic reds (LIVE) are preserved.
   ========================================================================== */

:root {
    --streams-primary:      #2bbdf6;
    --streams-primary-dark: #1a9fd4;
    --streams-bg:           #0b0f13;
    --streams-card:         #141a20;
    --streams-border:       rgba(255, 255, 255, 0.06);
    --streams-text:         #ffffff;
    --streams-text-muted:   #98a2ac;
    --streams-text-light:   #7c848d;
    --streams-live:         #ef4444;
    --streams-success:      #22c55e;
}

/* -------------------------------------------------------------------- Page */
.streams-page {
    background: var(--streams-bg);
    padding: 56px 0 0;
    min-height: calc(100vh - 78px);
}

/* Header */
.streams-header { text-align: center; max-width: 760px; margin: 0 auto 40px; padding: 0 20px; }
.streams-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(43, 189, 246, 0.4);
    border-radius: 999px;
    background: var(--qr-green-soft);
    color: var(--qr-green-bright);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.streams-title {
    margin: 0 0 16px;
    color: #ffffff;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.5px;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
}
.streams-title span { color: var(--streams-primary); }
.streams-subtitle { margin: 0 auto; color: rgba(233, 246, 255, 0.55); font-size: 1.08rem; line-height: 1.65; }

/* Container */
.streams-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 80px;
    position: relative;
    z-index: 10;
}

/* Stats Overview Card */
.stats-overview-card {
    background: linear-gradient(180deg, #141a20 0%, #0f141a 100%);
    border-radius: 18px;
    padding: 30px;
    margin-bottom: 24px;
    border: 1px solid var(--streams-border);
    position: relative;
    overflow: hidden;
}
.stats-overview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--streams-primary) 0%, var(--qr-green-bright) 100%);
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 18px;
}

.stat-overview-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--streams-border);
    border-radius: 14px;
    padding: 24px;
    text-align: center;
}
.stat-overview-value {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--streams-primary);
    display: block;
    margin-bottom: 6px;
    line-height: 1;
}
.stat-overview-label {
    color: var(--streams-text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Action Bar */
.action-bar {
    background: var(--streams-card);
    border-radius: 14px;
    padding: 18px 26px;
    margin-bottom: 30px;
    border: 1px solid var(--streams-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}
.action-buttons { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-action {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--streams-border);
    color: var(--streams-text-muted);
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.btn-action:hover {
    background: var(--qr-green-soft);
    border-color: var(--streams-primary);
    color: var(--streams-text);
    text-decoration: none;
}

.btn-twitch {
    background: var(--streams-primary);
    color: #03212e;
    border: none;
}
.btn-twitch:hover { color: #03212e; transform: translateY(-2px); box-shadow: 0 8px 25px rgba(43, 189, 246, 0.3); }

/* Streams Grid */
.streams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stream-card {
    background: linear-gradient(180deg, #141a20 0%, #0f141a 100%);
    border-radius: 16px;
    border: 1px solid var(--streams-border);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    cursor: pointer;
}
.stream-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(43, 189, 246, 0.4);
}
.stream-card:hover .play-overlay { opacity: 1; }

.stream-thumbnail { position: relative; width: 100%; height: 195px; overflow: hidden; }
.stream-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.stream-card:hover .stream-thumbnail img { transform: scale(1.05); }

.live-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--streams-live);
    color: white;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.live-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: streams-pulse 2s infinite;
}
@keyframes streams-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.viewers-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(43, 189, 246, 0.92);
    color: #03212e;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.stream-info { padding: 20px; }
.stream-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.streamer-avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--streams-primary); object-fit: cover; }
.streamer-name { color: var(--streams-text); font-weight: 700; font-size: 1rem; margin: 0; }

.stream-title {
    color: var(--streams-text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stream-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: var(--streams-text-light); }
.stream-language { background: rgba(255, 255, 255, 0.06); padding: 3px 8px; border-radius: 6px; text-transform: uppercase; font-weight: 600; }
.stream-duration { display: flex; align-items: center; gap: 4px; }

/* Card action buttons (override Bootstrap primary) */
.streams-container .btn-primary {
    background: var(--streams-primary);
    border: none;
    color: #03212e;
    font-weight: 700;
    border-radius: 10px;
}
.streams-container .btn-primary:hover { background: var(--qr-green-bright); color: #03212e; }
.streams-container .btn-outline-primary {
    border: 1px solid var(--streams-primary) !important;
    color: var(--streams-primary) !important;
    border-radius: 10px;
    background: transparent;
}
.streams-container .btn-outline-primary:hover { background: var(--qr-green-soft) !important; }

/* Empty State */
.empty-state { text-align: center; padding: 80px 30px; color: var(--streams-text-muted); }
.empty-state-icon { font-size: 3.6rem; margin-bottom: 20px; color: var(--streams-text-light); }
.empty-state-title { color: var(--streams-text); font-size: 1.5rem; font-weight: 700; margin-bottom: 12px; }
.empty-state-text { font-size: 1.05rem; margin-bottom: 20px; }

/* Error State */
.error-state {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 14px;
    padding: 28px;
    text-align: center;
    margin-bottom: 28px;
}
.error-state-icon { color: var(--streams-live); font-size: 2.6rem; margin-bottom: 14px; }
.error-state-title { color: var(--streams-text); font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; }
.error-state-text { color: var(--streams-text-muted); }

/* Stream Modal */
.stream-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}
.stream-modal.show { display: flex; }

.stream-modal-content {
    background: var(--streams-card);
    border-radius: 0;
    width: 95%;
    max-width: 1400px;
    height: 90%;
    max-height: 800px;
    position: relative;
    border: 1px solid var(--streams-border);
    border-top: 2px solid var(--streams-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stream-modal-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--streams-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #10151b;
}
.stream-modal-title { color: var(--streams-text); font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; margin-right: 20px; }

.stream-modal-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--streams-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.stream-modal-close:hover { background: var(--streams-primary); color: #03212e; transform: scale(1.1); }

.stream-modal-body { flex: 1; display: grid; grid-template-columns: 1fr 350px; gap: 0; height: calc(100% - 80px); }
.stream-embed-container { background: #000; display: flex; align-items: center; justify-content: center; position: relative; }
.stream-chat-container { background: var(--streams-bg); border-left: 1px solid var(--streams-border); height: 100%; }
#twitch-embed, #twitch-chat { width: 100%; height: 100%; border: none; }

/* Ban button */
.ban-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(239, 68, 68, 0.85);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 5;
}
.stream-card:hover .ban-btn { opacity: 1; }
.ban-btn:hover { background: #dc2626; transform: scale(1.15); }

/* Banned streamers modal list */
.banned-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--streams-border);
    border-radius: 10px;
    margin-bottom: 8px;
}
.banned-list-item .banned-info { flex: 1; }
.banned-list-item .banned-name { color: var(--streams-text); font-weight: 600; }
.banned-list-item .banned-reason { color: var(--streams-text-muted); font-size: 0.85rem; }
.banned-list-item .banned-meta { color: var(--streams-text-light); font-size: 0.8rem; }

.loading-spinner { color: var(--streams-primary); font-size: 2rem; animation: streams-spin 1s linear infinite; }
@keyframes streams-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    .streams-page { padding: 40px 0 0; }
    .streams-container { padding: 0 15px 60px; }
    .stats-overview-card { padding: 20px 15px; }
    .action-bar { padding: 15px 20px; }
    .streams-grid { grid-template-columns: 1fr; gap: 20px; }
    .stream-thumbnail { height: 180px; }
    .stream-modal-content { width: 98%; height: 95%; }
    .stream-modal-header { padding: 15px 20px; }
    .stream-modal-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
    .stream-chat-container { border-left: none; border-top: 1px solid var(--streams-border); height: 300px; max-height: 300px; }
}
