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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #333;
  --accent: #e50914;
  --accent-hover: #c1070f;
  --text: #e8e8e8;
  --text-muted: #888;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

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

/* Auth pages */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.auth-box h1 {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--accent);
}

.auth-box p.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
}

.form-group input:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}

.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 16px;
}

.alert-error { background: #3b1212; border: 1px solid var(--danger); color: #fca5a5; }
.alert-success { background: #0f2e1e; border: 1px solid var(--success); color: #86efac; }
.hidden { display: none !important; }

.auth-footer { margin-top: 20px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* Watch page */
.watch-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  height: 100vh;
  overflow: hidden;
}

.player-section {
  display: flex;
  flex-direction: column;
  background: #000;
  position: relative;
}

.player-wrap {
  flex: 1;
  position: relative;
  background: #000;
}

#player-container {
  width: 100%;
  height: 100%;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.live-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: .5px;
}

.quality-select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.volume-wrap label { font-size: 13px; color: var(--text-muted); }

input[type=range] {
  accent-color: var(--accent);
  width: 90px;
}

#btn-golive {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#btn-golive:hover { background: var(--accent-hover); }

/* Chat */
.chat-section {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
}

.chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h2 { font-size: 15px; font-weight: 600; }
#viewer-count { font-size: 13px; color: var(--text-muted); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.chat-msg {
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-msg .msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 6px;
  flex-shrink: 0;
}

.chat-msg .msg-user {
  font-weight: 700;
  color: var(--accent);
  margin-right: 6px;
}

.chat-msg .msg-text { color: var(--text); }

.chat-msg.system { color: var(--text-muted); font-style: italic; font-size: 13px; }

.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.chat-input-wrap input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

.chat-input-wrap input:focus { border-color: var(--accent); }

.chat-input-wrap button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Stream password modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 380px;
  width: 100%;
}

.modal-box h2 { font-size: 18px; margin-bottom: 6px; }
.modal-box p { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
}

.admin-sidebar h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-link {
  display: block;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: color .2s, background .2s;
}

.sidebar-link:hover, .sidebar-link.active {
  color: var(--text);
  background: var(--surface2);
}

.admin-main { padding: 32px; overflow-y: auto; }
.admin-main h2 { font-size: 20px; margin-bottom: 20px; }

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

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.user-name { font-weight: 600; }
.user-meta { font-size: 12px; color: var(--text-muted); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.badge-pending { background: #2e2200; color: var(--warning); }
.badge-approved { background: #0f2e1e; color: var(--success); }
.badge-rejected { background: #3b1212; color: var(--danger); }
.badge-banned { background: #3b1212; color: var(--danger); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-chat-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  flex-wrap: wrap;
}

.admin-chat-row:hover { background: var(--surface2); }

.admin-chat-row .msg-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.admin-chat-row .msg-user {
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.admin-chat-row .msg-text { flex: 1; word-break: break-word; }

.admin-chat-row .btn { margin-left: auto; flex-shrink: 0; }

.viewer-chip {
  display: inline-flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 13px;
  margin: 4px;
}
