/* ────────────────────────────────────────────────────────────────────────────
   FrameQuest — Design System
   Tema: Cinema noir — escuro, dramático, contrastes fortes, tipografia editorial
   ──────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────────── */
:root {
  --bg:         #0a0a0c;
  --bg-1:       #111116;
  --bg-2:       #18181f;
  --bg-3:       #22222c;
  --border:     #2a2a38;
  --border-2:   #383848;

  --text:       #e8e8f0;
  --text-2:     #9090a8;
  --text-3:     #5a5a72;

  --accent:     #e8c547;   /* Amarelo cinema */
  --accent-dim: #b89b32;
  --accent-bg:  #1c1a08;

  --red:        #e05252;
  --red-bg:     #1c0a0a;
  --green:      #52c97a;
  --green-bg:   #0a1c12;
  --blue:       #52a8e0;
  --blue-bg:    #0a1220;

  --diff-1: #52c97a;
  --diff-2: #8fd44a;
  --diff-3: #e8c547;
  --diff-4: #e08050;
  --diff-5: #e05252;

  --radius:   8px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;

  --shadow:    0 4px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 48px rgba(0,0,0,.7);
  --glow:      0 0 30px rgba(232,197,71,.15);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Tipografia ──────────────────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: .04em;
  line-height: 1.1;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.3rem; }

p { color: var(--text-2); }

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

/* ── Utilitários ────────────────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-2); }
.text-faint   { color: var(--text-3); }
.text-red     { color: var(--red); }
.text-green   { color: var(--green); }
.font-display { font-family: var(--font-display); letter-spacing: .04em; }
.font-mono    { font-family: var(--font-mono); }

.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1  { gap: .5rem; }
.gap-2  { gap: 1rem; }
.gap-3  { gap: 1.5rem; }
.gap-4  { gap: 2rem; }

.centered-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

/* ── Auth / Join Cards ──────────────────────────────────────────────────────── */
.auth-card { width: min(420px, 92vw); }
.auth-logo { font-family: var(--font-display); font-size: 2rem; letter-spacing: .08em; color: var(--accent); margin-bottom: .25rem; }
.auth-subtitle { color: var(--text-3); font-size: .85rem; margin-bottom: 1.75rem; }
.code-input { font-family: var(--font-mono); font-size: 1.4rem; letter-spacing: .2em; text-transform: uppercase; text-align: center; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* ── Componentes base ────────────────────────────────────────────────────────── */

/* Card */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.card-sm { padding: 1rem; border-radius: var(--radius); }
.card-lg { padding: 2rem; }

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .4; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: #0a0a0c;
  font-weight: 600;
}
.btn-primary:hover { background: #f0d060; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(232,197,71,.3); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text); border-color: var(--border-2); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid #3a1212;
}
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }

.btn-success {
  background: var(--green);
  color: #0a1c12;
  font-weight: 600;
}
.btn-success:hover { background: #6de09a; }

.btn-lg {
  padding: .85rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  padding: .5rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius);
}

/* Badge de dificuldade */
.diff-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  font-family: var(--font-mono);
}
.diff-1 { color: var(--diff-1); background: rgba(82,201,122,.1); }
.diff-2 { color: var(--diff-2); background: rgba(143,212,74,.1); }
.diff-3 { color: var(--diff-3); background: rgba(232,197,71,.1); }
.diff-4 { color: var(--diff-4); background: rgba(224,128,80,.1); }
.diff-5 { color: var(--diff-5); background: rgba(224,82,82,.1); }

/* Input / Select / Textarea */
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,197,71,.1);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select option { background: var(--bg-2); }
.textarea { resize: vertical; min-height: 80px; }

.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-label { font-size: .82rem; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.form-hint  { font-size: .78rem; color: var(--text-3); }
.form-error { font-size: .78rem; color: var(--red); }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1.1rem;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-size: .88rem;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease;
  max-width: 320px;
}
.toast.success { border-color: var(--green); }
.toast.error   { border-color: var(--red); }
.toast.warning { border-color: var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: min(560px, 90vw);
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
}
.modal-wide { width: min(840px, 94vw); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: .04em;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* Divisor */
.divider { height: 1px; background: var(--border); }
.divider-v { width: 1px; background: var(--border); align-self: stretch; }

/* Tag */
.tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .75rem;
  color: var(--text-2);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--text-3);
  text-align: center;
}
.empty-state svg { opacity: .3; }
.empty-state p { max-width: 260px; font-size: .9rem; }

/* Loading spinner */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* Grain overlay sutil */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9998;
  opacity: .5;
}
