/* WRTVBr — tema do painel (controle mestre / transmissão) */

:root {
    --bg-deep: #0a0c0f;
    --bg-panel: #12161c;
    --surface: #1a2029;
    --surface-hover: #222a35;
    --border: #2a3444;
    --text: #e8ecf1;
    --muted: #8b98a8;
    --accent: #00c8b3;
    --accent-dim: #009e8f;
    --on-air: #39ff14;
    --on-air-bg: rgba(57, 255, 20, 0.12);
    --off-air: #ff3355;
    --off-air-bg: rgba(255, 51, 85, 0.12);
    --warn: #ffc233;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --font: "Outfit", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-deep);
    background-image: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(0, 200, 179, 0.08), transparent),
        linear-gradient(180deg, var(--bg-deep) 0%, #060708 100%);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.45;
}

a {
    color: var(--accent);
}

.mcr-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.mcr-brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.mcr-brand__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
}

.mcr-brand__sub {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.mcr-header__right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

.mcr-clock {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--muted);
    padding: 0.35rem 0.65rem;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.air-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.air-badge--live {
    color: var(--on-air);
    background: var(--on-air-bg);
    border-color: rgba(57, 255, 20, 0.35);
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.15);
}

.air-badge--idle {
    color: #8899aa;
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.08s ease, background 0.15s, border-color 0.15s, box-shadow 0.15s;
    background: var(--surface);
    color: var(--text);
}

.btn:hover {
    background: var(--surface-hover);
    border-color: #3d4a5e;
}

.btn:active {
    transform: scale(0.97);
}

.btn--ghost {
    background: transparent;
}

.btn--accent {
    background: linear-gradient(145deg, var(--accent), var(--accent-dim));
    border-color: transparent;
    color: #041210;
    box-shadow: 0 4px 16px rgba(0, 200, 179, 0.25);
}

.btn--accent:hover {
    filter: brightness(1.08);
    box-shadow: 0 6px 22px rgba(0, 200, 179, 0.35);
}

.btn--danger {
    background: linear-gradient(145deg, #ff4466, #cc2244);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(255, 68, 102, 0.25);
}

.btn--danger:hover {
    filter: brightness(1.06);
}

.btn--sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
}

.btn--icon {
    padding: 0.45rem;
    min-width: 2.25rem;
}

.mcr-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 2.5rem;
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

@media (min-width: 960px) {
    .mcr-main {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }

    .card--signal {
        grid-column: 1 / -1;
    }

    .card--library {
        grid-row: 2 / span 2;
    }
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.25);
}

.card__title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.card__body {
    padding: 1rem 1.1rem;
    flex: 1;
    overflow: auto;
}

.link-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.link-row:last-child {
    margin-bottom: 0;
}

.link-row__label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.link-row__url {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    word-break: break-all;
    padding: 0.55rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #c5d4e8;
}

.link-row__actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.status-line {
    font-size: 0.9rem;
    color: var(--muted);
    padding: 0.65rem 0.75rem;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
}

.status-line strong {
    color: var(--text);
}

.transport-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.video-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: min(52vh, 520px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.video-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.15s, background 0.15s;
}

.video-row:hover {
    background: var(--surface-hover);
    border-color: #3a4a5c;
}

.video-row__name {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-row__meta {
    font-size: 0.68rem;
    color: var(--muted);
    font-family: var(--font-mono);
}

.playlist-create-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.playlist-create-row__field {
    flex: 1 1 200px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.playlist-create-row__field label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.input--playlist {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-deep);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.input--playlist:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(57, 163, 255, 0.2);
}

.playlist-target-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.playlist-target-row label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.pl-row {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0.65rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.pl-row__title {
    flex: 1 1 140px;
    font-weight: 600;
    font-size: 0.88rem;
}

.pl-row__meta {
    font-size: 0.72rem;
    color: var(--muted);
    font-family: var(--font-mono);
}

.pl-row__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.air-telemetry {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (max-width: 640px) {
    .air-telemetry {
        grid-template-columns: 1fr;
    }
}

.air-telemetry__block {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: linear-gradient(145deg, rgba(0, 200, 179, 0.08), var(--surface));
}

.air-telemetry__block--time {
    background: linear-gradient(145deg, rgba(57, 163, 255, 0.1), var(--surface));
}

.air-telemetry__label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.air-telemetry__value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--on-air);
    word-break: break-all;
}

.air-telemetry__block--time .air-telemetry__value {
    color: #7ec8ff;
    font-size: 1.35rem;
    letter-spacing: 0.04em;
}

.modal--wide {
    max-width: 520px;
}

.editor-video-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    max-height: min(42vh, 360px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.editor-video-list > div {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
}

.pl-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.editor-video-list .ev-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.playlist-summary {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.6;
}

.playlist-summary ul {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
}

.playlist-summary li {
    margin: 0.25rem 0;
}

.pill {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.pill--live {
    background: var(--on-air-bg);
    color: var(--on-air);
    border: 1px solid rgba(57, 255, 20, 0.35);
}

.pill--off {
    background: var(--off-air-bg);
    color: #ff8899;
    border: 1px solid rgba(255, 51, 85, 0.3);
}

/* Toasts */
#toast-root {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    box-shadow: var(--shadow);
    font-size: 0.85rem;
    animation: toast-in 0.28s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.toast--success {
    border-color: rgba(57, 255, 20, 0.4);
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.08), var(--bg-panel));
}

.toast--error {
    border-color: rgba(255, 68, 102, 0.5);
    background: linear-gradient(135deg, rgba(255, 68, 102, 0.1), var(--bg-panel));
}

.toast--info {
    border-color: rgba(0, 200, 179, 0.4);
}

.toast__icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
}

.toast__msg {
    flex: 1;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal {
    width: 100%;
    max-width: 400px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transform: scale(0.96);
    transition: transform 0.2s;
}

.modal-overlay.is-open .modal {
    transform: scale(1);
}

.modal h3 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.modal p {
    margin: 0 0 1.25rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.empty-state--warn {
    color: var(--warn);
}

/* ------- Páginas de entrada (/) e login ------- */
.portal-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.portal-card {
    width: 100%;
    max-width: 26rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.portal-card--narrow {
    max-width: 22rem;
    text-align: left;
}

.portal-card__h1 {
    margin: 0 0 0.65rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
}

.portal-card__p {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.portal-card__title {
    margin: 0 0 1.25rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.portal-card__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.35rem;
    background: var(--accent);
    color: #071312;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.12s ease;
}

.portal-card__btn:hover {
    background: var(--accent-dim);
    color: #fff;
}

.portal-card__btn--secondary {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent-dim);
}

.portal-card__btn--secondary:hover {
    background: rgba(0, 255, 200, 0.12);
    color: #fff;
}

.portal-code-inline {
    font-family: ui-monospace, monospace;
    font-size: 0.85em;
    padding: 0.1em 0.35em;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
}

.portal-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.portal-form__label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    margin-top: 0.35rem;
}

.portal-form__input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}

.portal-form__input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-color: var(--accent);
}

.portal-form__submit {
    margin-top: 1rem;
    width: 100%;
    padding: 0.75rem;
    background: var(--accent);
    color: #071312;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
}

.portal-form__submit:hover {
    background: var(--accent-dim);
    color: #fff;
}

.portal-form__err:empty {
    display: none;
}

.portal-form__err:not(:empty) {
    display: block;
    margin: 0 0 0.85rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
    color: var(--off-air);
    background: var(--off-air-bg);
    border-radius: 8px;
    border: 1px solid rgba(255, 51, 85, 0.25);
}

.login-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.login-brand__logo {
    max-width: 180px;
    max-height: 80px;
    object-fit: contain;
}
