/* ============================================================
   Ramcore Stream - tema claro/escuro estilo Discord
   ============================================================ */

:root,
:root[data-theme="dark"] {
    --bg-primary: #313338;
    --bg-secondary: #2b2d31;
    --bg-tertiary: #1e1f22;
    --bg-floating: #111214;
    --bg-input: #1e1f22;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --bg-active: rgba(255, 255, 255, 0.1);

    --text-normal: #dbdee1;
    --text-heading: #f2f3f5;
    --text-muted: #949ba4;
    --text-link: #00a8fc;
    --text-on-brand: #ffffff;

    --brand: #5865f2;
    --brand-hover: #4752c4;
    --brand-active: #3c45a5;
    --green: #23a55a;
    --green-hover: #1a7943;
    --red: #f23f43;
    --red-hover: #d83c3e;
    --yellow: #f0b232;

    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    --overlay: rgba(0, 0, 0, 0.75);
    --scrollbar: #1a1b1e;
}

:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f2f3f5;
    --bg-tertiary: #e3e5e8;
    --bg-floating: #ffffff;
    --bg-input: #e8eaed;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-active: rgba(0, 0, 0, 0.08);

    --text-normal: #313338;
    --text-heading: #060607;
    --text-muted: #5c5e66;
    --text-link: #006ce7;
    --text-on-brand: #ffffff;

    --brand: #5865f2;
    --brand-hover: #4752c4;
    --brand-active: #3c45a5;
    --green: #248046;
    --green-hover: #1a6334;
    --red: #da373c;
    --red-hover: #a12829;
    --yellow: #b98037;

    --border: rgba(0, 0, 0, 0.1);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    --overlay: rgba(0, 0, 0, 0.65);
    --scrollbar: #c4c9ce;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: "gg sans", "Segoe UI", -apple-system, BlinkMacSystemFont,
        Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-normal);
    font-size: 15px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}

a {
    color: var(--text-link);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4 {
    color: var(--text-heading);
    font-weight: 700;
}

/* ---------- Botoes ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-on-brand);
    background: var(--brand);
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
    white-space: nowrap;
}
.btn:hover { background: var(--brand-hover); }
.btn:active { background: var(--brand-active); transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-green { background: var(--green); }
.btn-green:hover, .btn-green:active { background: var(--green-hover); }

.btn-red { background: var(--red); }
.btn-red:hover, .btn-red:active { background: var(--red-hover); }

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-normal);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-active); }
.btn-secondary:active { background: var(--bg-active); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-normal); }
.btn-ghost:active { background: var(--bg-active); }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 10px; }
.btn-block { width: 100%; }

.btn-icon {
    padding: 8px;
    border-radius: 8px;
    line-height: 0;
}
.btn-icon svg { width: 20px; height: 20px; }

/* ---------- Formularios ---------- */

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="password"],
.field select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-normal);
    font-size: 15px;
    font-family: inherit;
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.15s ease;
}
.field input:focus,
.field select:focus {
    border-color: var(--brand);
}

.field .hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23949ba4'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 18px;
    padding-right: 32px !important;
    cursor: pointer;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-input);
    outline: none;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    border: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    border: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ---------- Topbar ---------- */

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 16px;
    color: var(--text-heading);
}
.topbar .logo img,
.topbar .logo svg { width: 26px; height: 26px; }

.topbar .spacer { flex: 1; }

.topbar .user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    background: var(--bg-hover);
    font-weight: 600;
    font-size: 14px;
}

/* ---------- Avatar ---------- */

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
}
.avatar.avatar-lg { width: 72px; height: 72px; font-size: 28px; }

/* ---------- Cards / layout ---------- */

.page {
    max-width: 980px;
    margin: 0 auto;
    padding: 24px 18px 60px;
}

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 17px;
    margin-bottom: 14px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 760px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Tela de login ---------- */

.auth-wrap {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1000px 500px at 20% -10%, rgba(88, 101, 242, 0.25), transparent 60%),
        radial-gradient(800px 400px at 90% 110%, rgba(35, 165, 90, 0.15), transparent 60%),
        var(--bg-tertiary);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 30px 28px;
}

.auth-card .auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.auth-card .auth-logo svg { width: 52px; height: 52px; }

.auth-card h1 {
    font-size: 21px;
    text-align: center;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin: 4px 0 20px;
}

.tabs {
    display: flex;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 20px;
}
.tabs button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
}
.tabs button.active {
    background: var(--bg-primary);
    color: var(--text-heading);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.form-error {
    background: rgba(242, 63, 67, 0.12);
    border: 1px solid rgba(242, 63, 67, 0.4);
    color: var(--red);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: none;
}
.form-error.show { display: block; }

/* ---------- Badges / status ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 999px;
    padding: 3px 10px;
}
.badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.badge-live { background: rgba(242, 63, 67, 0.15); color: var(--red); }
.badge-live .dot { animation: pulse 1.6s infinite; }
.badge-waiting { background: rgba(240, 178, 50, 0.15); color: var(--yellow); }
.badge-ended { background: var(--bg-hover); color: var(--text-muted); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* ---------- Lista de transmissoes ---------- */

.stream-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--bg-secondary);
}
.stream-row .info { flex: 1; min-width: 0; }
.stream-row .info .title {
    font-weight: 600;
    color: var(--text-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stream-row .info .meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.stream-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 26px 10px;
    font-size: 14px;
}

/* ---------- Paleta de cores do perfil ---------- */

.color-palette {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.color-palette button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.1s ease;
}
.color-palette button:hover { transform: scale(1.12); }
.color-palette button.selected {
    border-color: var(--text-heading);
}

/* ---------- Palco de video (host e espectador) ---------- */

.stage-page {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-tertiary);
}

.stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

.stage video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.stage-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    color: #dbdee1;
    background: linear-gradient(180deg, #17181c, #0e0f12);
    padding: 24px;
}
.stage-placeholder h2 { color: #f2f3f5; font-size: 20px; }
.stage-placeholder p { color: #949ba4; max-width: 420px; font-size: 14px; }
.stage-placeholder .big-icon {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(88, 101, 242, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stage-placeholder .big-icon svg { width: 40px; height: 40px; }

.stage-overlay {
    position: absolute;
    inset: 0;
    background: var(--overlay);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    color: #fff;
    padding: 24px;
    z-index: 5;
    backdrop-filter: blur(4px);
}
.stage-overlay h2 { color: #fff; font-size: 20px; }
.stage-overlay p { color: #cfd3d8; max-width: 420px; font-size: 14px; }

.stage-topline {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent);
    color: #fff;
    z-index: 4;
}
.stage-topline .title {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stage-topline .sub { font-size: 12px; color: #c8cdd3; }

/* Barra de controles flutuante (estilo Discord) */
.control-dock {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(17, 18, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 14px;
    z-index: 6;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100% - 24px);
}
.control-dock .divider {
    width: 1px;
    height: 26px;
    background: rgba(255, 255, 255, 0.12);
}
.control-dock .btn-icon {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.control-dock .btn-icon:hover { background: rgba(255, 255, 255, 0.16); }
.control-dock .btn-icon.danger { background: var(--red); }
.control-dock .btn-icon.danger:hover { background: var(--red-hover); }

.volume-ctl {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}
.volume-ctl input[type="range"] { width: 110px; background: rgba(255, 255, 255, 0.15); }
.volume-ctl .vol-label {
    font-size: 11px;
    color: #b9bec5;
    min-width: 34px;
    text-align: right;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-hover);
    color: var(--text-normal);
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    padding: 6px 12px;
    white-space: nowrap;
}
/* Dentro do dock flutuante (fundo escuro fixo), mantem o visual escuro */
.control-dock .stat-pill {
    background: rgba(255, 255, 255, 0.08);
    color: #e6e8ea;
}

.host-panel {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 14px 18px;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}
.host-panel .field { margin: 0; }
.host-panel label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.share-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 6px 6px 12px;
    max-width: 420px;
    flex: 1;
    min-width: 240px;
}
.share-box input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-size: 13px;
    font-family: inherit;
}

/* ---------- Toast ---------- */

.toast-zone {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}
.toast {
    background: var(--bg-floating);
    color: var(--text-normal);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: toast-in 0.2s ease;
    max-width: 340px;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Utilidades ---------- */

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hidden { display: none !important; }

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
