/* Academia de Negocios · sala de streaming independiente */

.streaming-page {
    --stream-bg: #eef4f5;
    --stream-ink: #082b3c;
    --stream-muted: #5c7280;
    --stream-line: #d6e2e5;
    --stream-surface: #fff;
    --stream-stage: #020b11;
    --stream-stage-soft: #0a202a;
    --stream-accent: #00dca7;
    --stream-accent-dark: #007f70;
    min-height: calc(100dvh - 82px);
    padding: 20px 0 48px;
    background:
        radial-gradient(circle at 8% 2%, rgb(0 230 172 / 10%), transparent 28rem),
        var(--stream-bg);
    color: var(--stream-ink);
}

.streaming-container {
    width: min(100% - 24px, 1240px);
    margin-inline: auto;
}

.streaming-navigation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.streaming-navigation a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 7px;
    padding: 9px 4px;
    color: #345563;
    font-size: 14px;
    font-weight: 700;
    transition: color 180ms ease;
}

.streaming-navigation a:hover { color: var(--stream-accent-dark); }
.streaming-navigation svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }

.streaming-hero {
    display: grid;
    gap: 20px;
    margin-bottom: 18px;
    padding: 22px;
    color: #eefcfa;
    background: linear-gradient(135deg, #05283a, #0a4652);
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: 22px;
    box-shadow: 0 18px 44px rgb(5 40 58 / 18%);
}

.streaming-hero-copy { min-width: 0; }
.streaming-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 7px 10px;
    color: #d8fffa;
    background: rgb(255 255 255 / 8%);
    border: 1px solid rgb(255 255 255 / 14%);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
}

.streaming-status i {
    width: 9px;
    height: 9px;
    background: var(--stream-accent);
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgb(0 220 167 / 13%);
}

.streaming-status.is-pending i { background: #f5b942; box-shadow: 0 0 0 5px rgb(245 185 66 / 13%); }
.streaming-eyebrow { margin: 0 0 4px; color: #7df1d6; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.streaming-hero h1 { margin: 0; color: #fff; font-size: clamp(26px, 7vw, 42px); line-height: 1.1; }
.streaming-hero-copy > p:last-child { max-width: 68ch; margin: 10px 0 0; color: #c4dadd; font-size: 15px; line-height: 1.6; }
.streaming-hero-actions { display: grid; align-content: center; gap: 8px; }

.streaming-reconnect,
.streaming-chat-form button,
.streaming-chat-retry {
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 11px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    touch-action: manipulation;
    transition: color 180ms ease, background 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.streaming-reconnect {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 10px 16px;
    color: #042d37;
    background: var(--stream-accent);
}

.streaming-reconnect:hover:not(:disabled) { background: #7df1d6; }
.streaming-reconnect:disabled { cursor: not-allowed; opacity: .45; }
.streaming-reconnect svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.streaming-action-status { min-height: 20px; color: #c5d9dd; font-size: 12px; text-align: center; }

.streaming-layout { display: grid; gap: 16px; align-items: start; }
.streaming-player-card,
.streaming-chat-card {
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 14px 36px rgb(5 40 58 / 12%);
}

.streaming-player-card { color: #e5f4f4; background: var(--stream-stage); border: 1px solid #163b47; }
.streaming-player-header {
    display: flex;
    min-height: 60px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #071923;
    border-bottom: 1px solid #17323c;
}

.streaming-player-header > div { display: flex; align-items: center; gap: 9px; }
.streaming-player-dot { width: 9px; height: 9px; background: var(--stream-accent); border-radius: 50%; }
.streaming-player-header h2 { margin: 0; color: #fff; font-size: 16px; }
.streaming-player-header small { color: #94aeb5; font-size: 11px; text-align: right; }
.streaming-player-frame { display: grid; width: 100%; aspect-ratio: 16 / 9; place-items: center; background: #000; }
.streaming-player-frame iframe { display: block; width: 100%; height: 100%; border: 0; }

.streaming-player-empty {
    display: grid;
    max-width: 540px;
    justify-items: center;
    gap: 9px;
    padding: 24px;
    color: #aec4c9;
    text-align: center;
}

.streaming-player-empty svg { width: 48px; height: 48px; margin-bottom: 4px; fill: none; stroke: #70b5aa; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.4; }
.streaming-player-empty strong { color: #fff; font-size: clamp(18px, 5vw, 24px); }
.streaming-player-empty span { font-size: 14px; line-height: 1.6; }
.streaming-player-note { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; color: #a8c0c5; background: var(--stream-stage-soft); border-top: 1px solid #17323c; }
.streaming-player-note svg { width: 21px; height: 21px; flex: 0 0 auto; fill: none; stroke: #66c4b3; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.streaming-player-note p { margin: 0; font-size: 12px; line-height: 1.55; }
.streaming-player-note strong { color: #d9f9f4; }

.streaming-chat-card { display: flex; min-height: 480px; flex-direction: column; background: var(--stream-surface); border: 1px solid var(--stream-line); }
.streaming-chat-header { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--stream-line); }
.streaming-chat-header > div { display: flex; min-width: 0; align-items: center; gap: 10px; }
.streaming-chat-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; color: #067e70; background: #e2faf4; border-radius: 12px; }
.streaming-chat-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.streaming-chat-header h2 { margin: 0; color: var(--stream-ink); font-size: 16px; }
.streaming-chat-header p { margin: 1px 0 0; color: var(--stream-muted); font-size: 11px; }
.streaming-chat-connection { flex: 0 0 auto; color: #6b7f88; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.streaming-chat-connection[data-tone="success"] { color: #08765d; }
.streaming-chat-connection[data-tone="error"] { color: #a83328; }

.streaming-chat-messages {
    display: flex;
    height: min(52dvh, 480px);
    min-height: 310px;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding: 16px 14px;
    overscroll-behavior: contain;
    scrollbar-color: #b8c9ce transparent;
}

.streaming-chat-empty { margin: auto; max-width: 28ch; color: #71848d; font-size: 13px; line-height: 1.55; text-align: center; }
.streaming-message { display: flex; align-items: flex-start; gap: 8px; }
.streaming-message.is-own { flex-direction: row-reverse; }
.streaming-message-avatar { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; color: #075a51; background: #dff7f1; border-radius: 10px; font-size: 12px; font-weight: 850; }
.streaming-message.is-own .streaming-message-avatar { color: #fff; background: #0a5462; }
.streaming-message-content { display: grid; max-width: min(82%, 34rem); gap: 4px; }
.streaming-message.is-own .streaming-message-content { justify-items: end; }
.streaming-message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding-inline: 3px; }
.streaming-message-meta strong { color: #294854; font-size: 11px; }
.streaming-message-meta time { color: #83939a; font-size: 9px; }
.streaming-message-role { padding: 2px 5px; border-radius: 5px; font-size: 8px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.streaming-message-role.is-admin { color: #65319b; background: #f1e7fb; }
.streaming-message-role.is-teacher { color: #06695d; background: #dff7f1; }
.streaming-message-bubble { margin: 0; padding: 9px 11px; color: #25434f; background: #f1f5f6; border: 1px solid #e0e8ea; border-radius: 4px 14px 14px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.streaming-message.is-own .streaming-message-bubble { color: #fff; background: #07505f; border-color: #07505f; border-radius: 14px 4px 14px 14px; }

.streaming-chat-retry { margin: 0 14px 12px; padding: 8px 12px; color: #8d291f; background: #fff1ef; border-color: #efbcb7; }
.streaming-chat-retry:hover { background: #ffe5e1; }
.streaming-chat-form { display: grid; gap: 7px; padding: 12px 14px 14px; background: #f8fafb; border-top: 1px solid var(--stream-line); }
.streaming-chat-form > label { color: #35525e; font-size: 12px; font-weight: 800; }
.streaming-chat-form textarea { width: 100%; min-height: 68px; padding: 10px 11px; color: var(--stream-ink); background: #fff; border: 1px solid #cbdadd; border-radius: 10px; font: inherit; font-size: 16px; line-height: 1.45; resize: vertical; }
.streaming-chat-form textarea:focus { border-color: var(--stream-accent-dark); outline: 3px solid rgb(0 220 167 / 20%); outline-offset: 1px; }
.streaming-chat-form-footer { display: flex; min-height: 46px; align-items: center; justify-content: space-between; gap: 10px; }
.streaming-chat-form-footer > span { color: #71838b; font-size: 11px; }
.streaming-chat-form-footer > span[data-tone="error"] { color: #a83328; font-weight: 700; }
.streaming-chat-form-footer > span[data-tone="success"] { color: #08765d; font-weight: 700; }
.streaming-chat-form button { display: inline-flex; min-width: 104px; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; color: #fff; background: #07505f; }
.streaming-chat-form button:hover:not(:disabled) { color: #052d37; background: var(--stream-accent); }
.streaming-chat-form button:disabled { cursor: wait; opacity: .5; }
.streaming-chat-form button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.streaming-footer { padding: 22px 16px 30px; color: #6c8089; background: var(--stream-bg, #eef4f5); font-size: 12px; text-align: center; }

@media (min-width: 700px) {
    .streaming-page { padding-top: 28px; }
    .streaming-container { width: min(100% - 40px, 1240px); }
    .streaming-hero { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 28px 30px; }
    .streaming-hero-actions { width: min(100%, 270px); }
    .streaming-chat-card { min-height: 560px; }
}

@media (min-width: 1040px) {
    .streaming-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; }
    .streaming-chat-card { height: 100%; min-height: 0; max-height: 720px; }
    .streaming-chat-messages { min-height: 0; }
}

@media (max-width: 440px) {
    .streaming-player-header { align-items: flex-start; }
    .streaming-player-header small { max-width: 14ch; }
    .streaming-chat-header { align-items: flex-start; }
    .streaming-chat-connection { padding-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .streaming-page *,
    .streaming-page *::before,
    .streaming-page *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

/* ── V21: Side panel con tabs ── */
.streaming-side-panel {
    display: flex;
    min-height: 480px;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    background: var(--stream-surface);
    border: 1px solid var(--stream-line);
    box-shadow: 0 14px 36px rgb(5 40 58 / 12%);
}
.streaming-tabs {
    display: flex;
    min-height: 48px;
    border-bottom: 1px solid var(--stream-line);
}
.streaming-tab {
    flex: 1 1 0;
    min-height: 48px;
    padding: 12px;
    border: 0;
    background: transparent;
    color: var(--stream-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color 150ms ease, border-color 150ms ease;
}
.streaming-tab.is-active { color: var(--stream-ink); border-bottom-color: var(--stream-accent); }
.streaming-tab:hover { color: var(--stream-ink); }
.streaming-tab-content { display: none; flex: 1 1 auto; flex-direction: column; }
.streaming-tab-content.is-active { display: flex; }

/* Reutilizar chat-card styles para el panel de chat dentro del side-panel */
.streaming-side-panel .streaming-chat-header,
.streaming-side-panel .streaming-chat-messages,
.streaming-side-panel .streaming-chat-form,
.streaming-side-panel .streaming-chat-retry { /* inherits from existing */ }

/* ── V21: Materiales ── */
.streaming-materials-header { padding: 14px; border-bottom: 1px solid var(--stream-line); }
.streaming-materials-header h2 { margin: 0; color: var(--stream-ink); font-size: 16px; }
.streaming-materials-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.streaming-material-item { padding: 10px 8px; border-bottom: 1px solid #eef4f5; }
.streaming-material-link { display: inline-flex; align-items: center; gap: 8px; color: #07505f; text-decoration: none; font-size: 14px; font-weight: 600; }
.streaming-material-link:hover { text-decoration: underline; }
.streaming-material-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.streaming-material-desc { margin: 4px 0 0; color: var(--stream-muted); font-size: 12px; }
.streaming-materials-empty { padding: 24px; color: var(--stream-muted); text-align: center; font-size: 14px; }

/* ── V21: Información ── */
.streaming-info-header { padding: 14px; border-bottom: 1px solid var(--stream-line); }
.streaming-info-header h2 { margin: 0; color: var(--stream-ink); font-size: 16px; }
.streaming-info-list { margin: 0; padding: 16px; }
.streaming-info-list dt { color: var(--stream-muted); font-size: 12px; font-weight: 700; margin-top: 12px; }
.streaming-info-list dd { margin: 2px 0 0; color: var(--stream-ink); font-size: 14px; }
.streaming-info-list dt:first-child { margin-top: 0; }

/* ── V21: Fallback ── */
.streaming-fallback { display: grid; gap: 16px; }
.streaming-fallback-card {
    display: grid;
    gap: 16px;
    padding: 20px;
    border-radius: 20px;
    background: var(--stream-surface);
    border: 1px solid var(--stream-line);
    box-shadow: 0 14px 36px rgb(5 40 58 / 12%);
}
.streaming-fallback-img { width: 100%; max-height: 240px; object-fit: cover; border-radius: 14px; }
.streaming-fallback-label { color: var(--stream-accent-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.streaming-fallback-card h2 { margin: 4px 0; color: var(--stream-ink); font-size: 22px; }
.streaming-fallback-card p { color: var(--stream-muted); font-size: 14px; line-height: 1.6; }
.streaming-fallback-text { color: var(--stream-muted); font-size: 14px; text-align: center; }
.streaming-fallback-empty { padding: 40px; text-align: center; color: var(--stream-muted); }

/* ── V21: Blocked ── */
.streaming-blocked {
    display: grid;
    max-width: 600px;
    margin: 0 auto;
    gap: 20px;
    padding: 32px 20px;
    text-align: center;
}
.streaming-blocked-poster {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #0a202a, #05283a);
    border-radius: 18px;
}
.streaming-blocked-poster svg { width: 64px; height: 64px; fill: rgba(255,255,255,.15); }
.streaming-blocked-body h2 { margin: 0 0 8px; color: var(--stream-ink); font-size: 22px; }
.streaming-blocked-body p { color: var(--stream-muted); font-size: 15px; line-height: 1.6; }
.streaming-blocked-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px; }

/* ── V21: Countdown ── */
.streaming-countdown {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: #eefcfa;
    background: rgba(255,255,255,.08%);
    border: 1px solid rgba(255,255,255,.14%);
    border-radius: 12px;
}
.streaming-countdown-label { font-size: 12px; font-weight: 700; }
.streaming-countdown-value { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ── V21: Chat login CTA ── */
.streaming-chat-login-cta { padding: 16px 14px; text-align: center; border-top: 1px solid var(--stream-line); }
.streaming-chat-login-cta p { margin: 0 0 10px; color: var(--stream-muted); font-size: 13px; }

/* ── V21: Player loading ── */
.streaming-player-loading { display: grid; place-items: center; height: 100%; color: #aec4c9; gap: 8px; }
.streaming-player-loading svg { width: 40px; height: 40px; fill: none; stroke: #70b5aa; stroke-width: 1.5; animation: spin 1.5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .streaming-player-loading svg { animation: none; } }
.streaming-player-loading p { margin: 0; font-size: 14px; }

/* ── V21: Poster en estados de espera ── */
.streaming-poster { max-width: 100%; max-height: 300px; object-fit: cover; border-radius: 12px; margin-bottom: 12px; opacity: .8; }

/* ── V21: Error 503 ── */
.streaming-error { padding: 40px 20px; text-align: center; color: var(--stream-muted); font-size: 16px; }

/* ── V21: Estados del hero ── */
.streaming-status.is-en_vivo i { background: #e63946; animation: live-pulse 1.5s infinite; }
.streaming-status.is-esperando_senal i { background: #f5b942; }
.streaming-status.is-interrumpida i { background: #f59e0b; }
.streaming-status.is-programada i { background: var(--stream-accent); }
.streaming-status.is-finalizada i, .streaming-status.is-cancelada i { background: #94aeb5; }
.streaming-status.is-privada i { background: #6c5ce7; }

/* ── V21: Layout responsive para side-panel ── */
@media (min-width: 1040px) {
    .streaming-layout { grid-template-columns: minmax(0, 1fr) 380px; }
    .streaming-side-panel { height: 100%; min-height: 0; max-height: 720px; }
    .streaming-side-panel .streaming-chat-messages { min-height: 0; }
}

@media (max-width: 1039px) {
    .streaming-layout { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
    .streaming-tabs .streaming-tab { font-size: 12px; padding: 10px 4px; }
    .streaming-blocked-actions { flex-direction: column; }
    .streaming-blocked-actions .boton { width: 100%; }
}
