:root {
  --bg: #12141c;
  --surface: #1a1d29;
  --surface-raised: #21243280;
  --border: #2b2f40;
  --text: #f4f2ed;
  --text-muted: #8a8fa3;
  --amber: #ff9f1c;
  --amber-dim: #ff9f1c33;
  --teal: #2dd4bf;
  --teal-dim: #2dd4bf26;
  --danger: #e5566f;

  --font-display: 'Oswald', sans-serif;
  --font-body: 'Work Sans', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

.hidden { display: none !important; }

button, input, select { font-family: inherit; }

.app { height: 100%; }

/* ---------- shared brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px 2px var(--amber-dim);
  flex-shrink: 0;
}
.brand h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  margin: 0;
}
.brand h1 span { color: var(--amber); }

/* ---------- auth screen ---------- */
.auth-screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(600px 400px at 15% 10%, #ff9f1c14, transparent),
    radial-gradient(600px 400px at 85% 90%, #2dd4bf14, transparent),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.brand-sub {
  color: var(--text-muted);
  margin: 10px 0 28px;
  font-size: 0.95rem;
  line-height: 1.5;
}
.auth-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}
.auth-tab.active { background: var(--bg); color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.auth-form input, .auth-form select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 0.95rem;
}
.auth-form input:focus, .auth-form select:focus,
.chat-form input:focus, .request-form input:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}
.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.1em;
  margin: 0;
}
.btn-primary {
  background: var(--amber);
  color: #1a1206;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* ---------- main layout ---------- */
.main-screen {
  height: 100%;
  display: grid;
  grid-template-columns: 260px 1fr;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  overflow-y: auto;
}
.brand-compact { margin-bottom: 24px; }
.brand-compact h1 { font-size: 1.15rem; }

.room-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 24px; }
.room-item {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; color: var(--text-muted);
  text-align: left; padding: 10px 12px; border-radius: 8px;
  cursor: pointer; font-size: 0.92rem;
}
.room-item:hover { background: var(--bg); color: var(--text); }
.room-item.active { background: var(--bg); color: var(--text); font-weight: 600; }
.room-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.room-item.active .room-dot { background: var(--amber); }
.request-dot { background: var(--teal); }
.block-dot { background: var(--danger); }
.badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 0.68rem; font-weight: 700; border-radius: 999px;
  padding: 1px 7px; line-height: 1.4;
}

.online-list { margin-bottom: 20px; }
.online-list h2 {
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted); letter-spacing: 0.03em; margin: 0 0 10px 4px;
}
.online-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; font-size: 0.85rem; color: var(--text);
}
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
.online-item.role-dj { color: var(--amber); font-weight: 600; }

.dj-list h2 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin: 0 0 10px 4px;
}
.dj-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; background: none; border: none; color: var(--text);
  text-align: left; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  font-size: 0.9rem;
}
.dj-item:hover { background: var(--bg); }
.dj-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--amber-dim); color: var(--amber);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.75rem; flex-shrink: 0;
}

.user-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--teal-dim); color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.85rem;
}
.user-name { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

/* ---------- chat pane ---------- */
.chat-pane { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.chat-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.chat-header h2 { font-family: var(--font-display); font-size: 1.1rem; margin: 0 0 3px; }
.chat-header p { margin: 0; color: var(--text-muted); font-size: 0.85rem; }

.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg { max-width: 72ch; }
.msg-meta {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px;
}
.msg-name { font-weight: 600; font-size: 0.85rem; }
.msg-name.role-dj { color: var(--amber); }
.msg-time { font-size: 0.72rem; color: var(--text-muted); }
.location-tag {
  font-size: 0.7rem; color: var(--teal); background: var(--teal-dim);
  padding: 1px 7px; border-radius: 999px;
}
.msg-body { font-size: 0.94rem; line-height: 1.5; }
.msg.own { align-self: flex-end; text-align: right; }
.msg.own .msg-meta { justify-content: flex-end; }

/* request ticket styling — visually distinct from chat bubbles */
.request-ticket {
  border: 1px solid var(--teal-dim);
  background: linear-gradient(180deg, #2dd4bf14, transparent);
  border-radius: 10px;
  padding: 12px 14px;
  max-width: 72ch;
}
.request-ticket .ticket-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--teal);
  margin-bottom: 4px;
}
.request-ticket .ticket-song { font-weight: 600; font-size: 0.98rem; }
.request-ticket .ticket-artist { color: var(--text-muted); font-size: 0.85rem; }
.request-ticket .ticket-note { margin-top: 6px; font-size: 0.88rem; color: var(--text-muted); }
.request-ticket .ticket-status {
  display: inline-block; margin-top: 8px;
  font-size: 0.72rem; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted);
}
.request-ticket .ticket-status.played { border-color: var(--teal); color: var(--teal); }
.request-ticket .ticket-status.declined { border-color: var(--danger); color: var(--danger); }
.ticket-actions { margin-top: 10px; display: flex; gap: 8px; }
.ticket-actions button {
  font-size: 0.78rem; padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  cursor: pointer;
}
.ticket-actions button:hover { border-color: var(--teal); color: var(--teal); }

.empty-state { color: var(--text-muted); font-size: 0.9rem; padding: 20px 0; }

/* moderation controls on individual messages */
.msg-actions { margin-top: 6px; display: flex; gap: 8px; }
.msg-actions button {
  font-size: 0.7rem; padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text-muted);
  cursor: pointer;
}
.msg-actions button:hover { color: var(--text); border-color: var(--text-muted); }
.msg-actions button.danger:hover { color: var(--danger); border-color: var(--danger); }

/* banner shown to a blocked listener */
.blocked-banner {
  background: #e5566f1a; border-bottom: 1px solid var(--danger);
  color: var(--danger); font-size: 0.85rem; padding: 10px 24px;
}

/* blocked-users management list (DJ view) */
.blocked-user-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px;
}
.blocked-user-actions { display: flex; gap: 8px; }
.blocked-user-row button {
  font-size: 0.78rem; padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--teal); background: var(--bg); color: var(--teal); cursor: pointer;
}
.blocked-user-row button:hover { background: var(--teal-dim); }
.blocked-user-row button.danger { border-color: var(--danger); color: var(--danger); }
.blocked-user-row button.danger:hover { background: #e5566f1a; }

/* forms */
.chat-form, .request-form {
  display: flex; gap: 10px; padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.request-form { flex-wrap: wrap; background: var(--teal-dim); }
.chat-form input, .request-form input {
  flex: 1; min-width: 110px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 11px 14px; font-size: 0.94rem;
}
.btn-icon {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 42px; font-size: 1.1rem; cursor: pointer; flex-shrink: 0;
}
.btn-icon:hover { border-color: var(--teal); }

/* ---------- responsive: mobile ---------- */
@media (max-width: 760px) {
  .main-screen {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .sidebar {
    position: fixed; inset: auto 0 0 0; z-index: 20;
    flex-direction: row; align-items: center; justify-content: space-around;
    padding: 8px 6px; height: 64px; border-right: none; border-top: 1px solid var(--border);
    overflow: visible;
  }
  .brand-compact, .dj-list, .user-footer { display: none; }
  .room-list { flex-direction: row; margin: 0; gap: 2px; flex: 1; justify-content: space-around; }
  .room-item { flex-direction: column; gap: 3px; font-size: 0.68rem; padding: 6px 8px; }
  .chat-pane { padding-bottom: 64px; }
  .message-list { padding: 16px; }
  .chat-form, .request-form { padding: 12px 16px; }
  .chat-header { padding: 14px 16px; }
}

/* focus visibility */
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
