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

:root {
    --bg:        #1a1a2e;
    --surface:   #16213e;
    --surface2:  #185cae;
    --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 {
    position: relative;
    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-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
}
.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; }
.status-active  { background: var(--success); color: #fff; }



/* ── Step nav ─────────────────────────────────────────────────────────────── */
.step-nav-badge {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    order: 98;
    pointer-events: none;
    background: var(--surface);
    border-top: 1px solid var(--surface2);
}
.golive-badge {
    grid-column: 5;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 4px;
}
.step-badge-docs {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 4px;
}
.step-badge-docs a {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--surface2);
    white-space: nowrap;
    pointer-events: auto;
    transition: color 0.15s, background 0.15s;
}
.step-badge-docs a:hover {
    color: var(--accent);
    background: rgba(233,69,96,0.12);
}
.stream-pill {
    display: inline-block;
    font-size: 1rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    line-height: 1.4;
    white-space: nowrap;
}
.stream-pill--available {
    background: #27ae60;
    color: #fff;
}
.stream-pill--active {
    background: #c0392b;
    color: #fff;
}

.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;
}

/* Live Matches tab */
.step-btn--live {
    color: #ebc014;
    background-color: #234d6d;
    font-weight: 900;
    gap: 4px;
}
.step-btn--live .step-live-icon {
    flex-shrink: 0;
}
.step-btn--live.active,
.step-btn--live:hover {
    color: #ebc014;
    border-top-color: #2196f3;
    background: rgba(33,150,243,0.10);
}

/* ── 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%; }

/* ── Google Sign-In (GSI) material button ─────────────────────────────────── */
.gsi-material-button {
  background-color: #131314;
  background-image: none;
  border: 1px solid #8e918f;
  border-radius: 20px;
  box-sizing: border-box;
  color: #e3e3e3;
  cursor: pointer;
  font-family: 'Roboto', arial, sans-serif;
  font-size: 14px;
  height: 40px;
  letter-spacing: 0.25px;
  outline: none;
  overflow: hidden;
  padding: 0 12px;
  position: relative;
  text-align: center;
  transition: background-color .218s, border-color .218s, box-shadow .218s;
  vertical-align: middle;
  white-space: nowrap;
  width: auto;
  max-width: 400px;
  min-width: min-content;
}
.gsi-material-button .gsi-material-button-icon {
  height: 20px;
  margin-right: 10px;
  min-width: 20px;
  width: 20px;
}
.gsi-material-button .gsi-material-button-content-wrapper {
  align-items: center;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  height: 100%;
  justify-content: space-between;
  position: relative;
  width: 100%;
}
.gsi-material-button .gsi-material-button-contents {
  flex-grow: 1;
  font-family: 'Roboto', arial, sans-serif;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}
.gsi-material-button .gsi-material-button-state {
  transition: opacity .218s;
  bottom: 0; left: 0; opacity: 0; position: absolute; right: 0; top: 0;
}
.gsi-material-button:disabled {
  cursor: default;
  background-color: #13131461;
  border-color: #8e918f1f;
}
.gsi-material-button:disabled .gsi-material-button-state  { background-color: #e3e3e31f; }
.gsi-material-button:disabled .gsi-material-button-contents { opacity: 38%; }
.gsi-material-button:disabled .gsi-material-button-icon   { opacity: 38%; }
.gsi-material-button:not(:disabled):active .gsi-material-button-state,
.gsi-material-button:not(:disabled):focus  .gsi-material-button-state {
  background-color: white; opacity: 12%;
}
.gsi-material-button:not(:disabled):hover {
  box-shadow: 0 1px 2px 0 rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
}
.gsi-material-button:not(:disabled):hover .gsi-material-button-state {
  background-color: white; opacity: 8%;
}

/* ── 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; }

/* ── Stop confirm modal ──────────────────────────────────────────────────── */
.stop-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.stop-modal {
    background: var(--surface);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 24px;
    width: min(360px, 92vw);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.stop-modal-detail {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--surface2);
    font-size: 0.88rem;
}
.stop-modal-detail .key { color: var(--text-muted); flex-shrink: 0; }
.stop-modal-detail .val { color: var(--text); text-align: right; }

/* ── 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; }

.rig-pill-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}
.rig-pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.rig-pill--online    { background: #27ae60; color: #fff; }
.rig-pill--offline   { background: #555; color: #bbb; }
.rig-pill--available { background: #1e6eab; color: #fff; }
.rig-pill--inuse     { background: #c0392b; color: #fff; }

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