/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #1a1a2e;
    --surface:   #16213e;
    --surface2:  #0f3460;
    --accent:    #e94560;
    --accent2:   #f5a623;
    --text:      #eaeaea;
    --text-muted:#8892a4;
    --success:   #27ae60;
    --danger:    #e74c3c;
    --radius:    8px;
    --gap:       16px;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--gap);
    background: var(--surface);
    border-bottom: 2px solid var(--surface2);
}

header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.header-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text, #fff);
}
.privacy-link {
    font-size: 0.75rem;
    color: var(--text-muted, #888);
    text-decoration: none;
    white-space: nowrap;
}
.privacy-link:hover {
    color: var(--accent, #c9a84c);
}

/* ── Status badge ─────────────────────────────────────────────────────────── */
.status-badge {
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.06em;
}
.status-online  { background: var(--success); color: #fff; }
.status-offline { background: #444; color: var(--text-muted); }
.status-error   { background: var(--danger); color: #fff; }

/* ── Step nav ─────────────────────────────────────────────────────────────── */
.step-nav {
    display: flex;
    background: var(--surface);
    border-top: 2px solid var(--surface2);
    order: 99;   /* pushes to bottom on flex column body */
}

.step-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    border-top: 3px solid transparent;
}
.step-btn .step-num {
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    background: var(--surface2);
    font-size: 0.85rem;
    color: var(--text-muted);
}
.step-btn.active,
.step-btn:hover {
    color: var(--accent);
    border-top-color: var(--accent);
    background: rgba(233,69,96,0.07);
}
.step-btn.active .step-num,
.step-btn:hover .step-num {
    background: var(--accent);
    color: #fff;
}

/* ── Main / views ─────────────────────────────────────────────────────────── */
main {
    flex: 1;
    overflow-y: auto;
    padding: var(--gap);
}

.view { display: block; }
.hidden { display: none !important; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: var(--gap);
    margin-bottom: var(--gap);
    border: 1px solid var(--surface2);
}

.card h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--accent2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Form elements ────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.15s;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238892a4' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    letter-spacing: 0.03em;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary   { background: var(--accent);  color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-youtube   { background: #ff0000; color: #fff; }
.btn-full      { width: 100%; }

/* ── Player row (two columns) ─────────────────────────────────────────────── */
.player-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
}

/* ── Rig config display ───────────────────────────────────────────────────── */
#rigDetails {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ── Stream key display ───────────────────────────────────────────────────── */
.stream-key-box {
    background: var(--bg);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
    color: var(--accent2);
    margin-top: 8px;
}

/* ── Summary list (broadcast view) ───────────────────────────────────────── */
.summary-list {
    list-style: none;
    font-size: 0.9rem;
}
.summary-list li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--surface2);
}
.summary-list li:last-child { border-bottom: none; }
.summary-list .key  { color: var(--text-muted); }
.summary-list .val  { font-weight: 600; text-align: right; max-width: 60%; word-break: break-all; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 999;
    pointer-events: none;
    transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; }

/* ── Rig select buttons (step 1) ─────────────────────────────────────────── */
.rig-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}
.rig-select-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    background: var(--surface2);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.rig-select-btn:hover {
    border-color: var(--accent);
    background: var(--surface3, #2a2a3e);
}
.rig-select-btn.selected {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.15);
}
.rig-status-dot.online  { color: #4caf50; font-size: 0.85rem; }
.rig-status-dot.offline { color: var(--text-muted); font-size: 0.85rem; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (min-width: 600px) {
    main { max-width: 540px; margin: 0 auto; }
}
