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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e4e4e7;
  --muted: #888;
  --primary: #6c63ff;
  --primary-hover: #5a52e0;
  --danger: #ef4444;
  --success: #22c55e;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.container {
  width: 100%;
  max-width: 480px;
}

h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.1rem; margin-bottom: 0.75rem; color: var(--muted); }

.subtitle { color: var(--muted); margin-bottom: 1.5rem; }

/* ── Privacy banner ──────────────────────────────────────────────── */
.privacy-banner {
  background: #2a1f00;
  border: 1px solid #5c4a00;
  color: #fbbf24;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 1.5rem;
  line-height: 1.45;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.3rem;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

/* ── Forms ───────────────────────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="file"] {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  width: 100%;
}
input[type="text"]:focus,
input[type="password"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.join-form {
  display: flex;
  gap: 0.5rem;
}
.join-form input { flex: 1; text-transform: uppercase; letter-spacing: 0.15em; }

.divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider span { padding: 0 0.75rem; }

/* ── QR & shortcode ──────────────────────────────────────────────── */
#qr-container {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}
#qr-container canvas { border-radius: 12px; }

.shortcode-display {
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  letter-spacing: 0.25em;
}

/* ── Status ──────────────────────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
}
.status-bar.connected { border-color: var(--success); color: var(--success); }
.status-bar.alone { border-color: #f59e0b; color: #f59e0b; }

.btn-exit {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.btn-exit:hover { color: var(--danger); border-color: var(--danger); }

.waiting { color: var(--muted); font-size: 0.9rem; text-align: center; }

/* ── Upload ──────────────────────────────────────────────────────── */
.password-section {
  margin: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.password-section label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.password-section input[type="password"] { margin-top: 0.4rem; }

.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface);
  overflow: hidden;
  margin: 0.75rem 0 0.5rem;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.2s;
}

/* ── File list ───────────────────────────────────────────────────── */
#file-list {
  list-style: none;
  padding: 0;
}
#file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
#file-list a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
#file-list a:hover { text-decoration: underline; }

/* ── Section divider ──────────────────────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── Helpers ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.error { color: var(--danger); font-size: 0.88rem; margin-top: 0.5rem; }
.muted { color: var(--muted); font-size: 0.88rem; }
.info { color: var(--success); text-align: center; font-size: 0.9rem; }
