/* =====================================================================
   style.css — Quiz PWA Offline
   ===================================================================== */

/* ── Fundo fixo ───────────────────────────────────────────────────── */
#bg-fixed {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
#bg-fixed img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --surface:     rgba(255, 255, 252, 0.88);
  --surface-2:   rgba(220, 218, 205, 0.55);
  --accent:      #2d6a2d;
  --accent-dark: #1f4f1f;
  --success:     #2d6a2d;
  --danger:      #c0392b;
  --warning:     #e07b39;
  --text:        #1a2e1a;
  --text-muted:  #5a7a5a;
  --radius:      14px;
  --radius-sm:   10px;
  --shadow:      0 4px 24px rgba(30,60,30,.13);
  --transition:  .2s ease;
}

html {
  height: 100%;
  background-color: #f5f2e8;
}

body {
  min-height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  background: transparent;
}

/* Bootstrap container acima do fundo */
.container-sm {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ── #app: coluna central sem fundo próprio ───────────────────────── */
#app {
  position: relative;
  z-index: 1;
}

/* ── Telas ────────────────────────────────────────────────────────── */
.screen { display: none; flex-direction: column; gap: 16px; }
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.screen.active { animation: fadeIn .3s ease; }

/* ── Header ───────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
}
.app-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--accent); margin: 0; }
.btn-admin {
  background: transparent;
  border: 1px solid rgba(45, 106, 45, 0.3);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.btn-admin:hover { border-color: var(--accent); color: var(--accent); }

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface) !important;
  border-radius: var(--radius) !important;
  padding: 20px !important;
  box-shadow: var(--shadow) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.6) !important;
  margin-bottom: 16px;
}

/* ── Formulário ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.form-group label { font-size: .85rem; color: var(--text-muted); font-weight: 500; }

input, select {
  background: rgba(240, 237, 225, 0.7);
  border: 1px solid rgba(45, 106, 45, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  width: 100%;
}
input:focus, select:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 250, 0.9);
  box-shadow: none;
}
input.error { border-color: var(--danger); }
input::placeholder { color: var(--text-muted); }
select option { background: #f5f2e8; color: var(--text); }

.field-hint { font-size: .75rem; color: var(--danger); min-height: 16px; }

/* ── Checkbox ─────────────────────────────────────────────────────── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text);
  font-weight: 500;
  padding: 4px 0;
}
.checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid rgba(45, 106, 45, 0.4);
  border-radius: 5px;
  background: rgba(240, 237, 225, 0.7);
  cursor: pointer;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
  padding: 0;
}
.checkbox-label input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px; left: 6px;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Botões ───────────────────────────────────────────────────────── */
.btn {
  border: none;
  border-radius: var(--radius-sm) !important;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 20px;
  transition: filter var(--transition), transform var(--transition);
  width: 100%;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--accent) !important;  color: #fff !important; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-success  { background: var(--success) !important; color: #fff !important; }
.btn-danger   { background: var(--danger)  !important; color: #fff !important; }
.btn-secondary { background: var(--surface-2) !important; color: var(--text) !important; }

/* ── Tela de Quiz ─────────────────────────────────────────────────── */
.progress-bar-wrap {
  background: var(--surface-2);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  background: linear-gradient(90deg, var(--accent), #4a9c4a);
  height: 100%;
  transition: width .4s ease;
}
.quiz-meta {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}
.alternatives { display: flex; flex-direction: column; gap: 10px; }

.alt-btn {
  background: rgba(240, 237, 225, 0.65);
  border: 2px solid rgba(45, 106, 45, 0.15);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: .95rem;
  padding: 12px 16px;
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
  width: 100%;
}
.alt-btn:hover:not(:disabled) { border-color: var(--accent); background: rgba(45,106,45,.08); }
.alt-btn.correct  { border-color: var(--success); background: rgba(45,106,45,.15); }
.alt-btn.wrong    { border-color: var(--danger);  background: rgba(192,57,43,.10); }
.alt-btn:disabled { cursor: default; }

/* ── Resultado ────────────────────────────────────────────────────── */
.result-score {
  font-size: 4rem; font-weight: 800;
  color: var(--accent); text-align: center; line-height: 1;
  text-shadow: 0 2px 12px rgba(45,106,45,.2);
}
.result-label { text-align: center; color: var(--text-muted); margin-top: 4px; }

.prize-box {
  border: 2px solid var(--warning);
  border-radius: var(--radius);
  padding: 16px; text-align: center;
  background: rgba(224, 123, 57, 0.08);
}
.prize-box h3 { color: var(--warning); font-size: 1rem; margin-bottom: 4px; }
.prize-box p  { font-size: 1.2rem; font-weight: 700; }

/* ── Admin ────────────────────────────────────────────────────────── */
.admin-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  background: rgba(240, 237, 225, 0.6);
  border: 1px solid rgba(45,106,45,.15);
  border-radius: var(--radius-sm);
  padding: 14px; text-align: center;
}
.stat-card .stat-number { font-size: 2rem; font-weight: 800; color: var(--accent); }
.stat-card .stat-label  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

.sync-status {
  border-radius: var(--radius-sm); font-size: .85rem;
  min-height: 36px; padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
}
.sync-status.idle    { background: rgba(220,218,205,.5); color: var(--text-muted); }
.sync-status.loading { background: rgba(45,106,45,.1);   color: var(--accent); }
.sync-status.ok      { background: rgba(45,106,45,.12);  color: var(--accent); }
.sync-status.err     { background: rgba(192,57,43,.1);   color: var(--danger); }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(45,106,45,.92);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  color: #fff; font-size: .9rem; max-width: 320px;
  opacity: 0; padding: 12px 20px; text-align: center;
  transition: transform .3s ease, opacity .3s ease;
  width: 90%; z-index: 999;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Utilitários ──────────────────────────────────────────────────── */
h2 { font-size: 1.2rem; font-weight: 700; }
p  { font-size: .9rem; color: var(--text-muted); line-height: 1.5; }
.mt-auto { margin-top: auto; }

hr { border: none; border-top: 1px solid var(--surface-2); margin: 4px 0; }
