/* ============================================================
   Feedback System — Estilos globais
   ============================================================ */

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

:root {
  --primary:     #1a56db;
  --primary-dk:  #1240a8;
  --surface:     #ffffff;
  --bg:          #f3f6fb;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --border:      #cbd5e1;
  --radius:      10px;
  --shadow:      0 2px 16px rgba(0,0,0,.08);

  /* Status */
  --aberto:     #2563eb;
  --analisando: #d97706;
  --respondida: #7c3aed;
  --ignorada:   #64748b;
  --concluida:  #059669;
}

html { font-size: 16px; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

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

img { max-width: 100%; height: auto; display: block; }

/* ── Layout público ─────────────────────────────────────── */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  padding: 16px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.site-header img {
  height: 56px;
  width: auto;
}

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}
.site-footer img { height: 36px; }
.footer-privacy {
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 560px;
}
.footer-privacy strong { color: var(--text); }

/* ── Card principal ─────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 40px;
  width: 100%;
  max-width: 660px;
}

.card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.card-subtitle {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ── Formulário ─────────────────────────────────────────── */
.form-group { margin-bottom: 22px; }

label.form-label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
label.form-label span.req { color: #e11d48; }

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  color: var(--text);
  background: #fff;
  transition: border .2s;
  outline: none;
}
input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

textarea { resize: vertical; min-height: 130px; }

/* ── Checkboxes de tags ──────────────────────────────────── */
.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tag-chip input[type="checkbox"] { display: none; }
.tag-chip label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
  user-select: none;
  color: var(--text-muted);
}
.tag-chip label:hover { border-color: var(--primary); color: var(--primary); }
.tag-chip input:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Toggle "deseja resposta" ────────────────────────────── */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
}
.toggle-wrapper input[type="checkbox"] { display: none; }
.toggle-track {
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.toggle-wrapper input:checked ~ .toggle-track { background: var(--primary); }
.toggle-wrapper input:checked ~ .toggle-track .toggle-thumb { transform: translateX(20px); }
.toggle-label { font-size: .9rem; font-weight: 500; }

/* Campos de contato ocultos inicialmente */
#contactFields {
  display: none;
  padding: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-top: 14px;
}
#contactFields.visible { display: block; }
#contactFields .form-group:last-child { margin-bottom: 0; }

/* ── Botão ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: 8px;
  font-size: .97rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, transform .1s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover  { background: var(--primary-dk); }
.btn-primary:active { transform: scale(.98); }
.btn-sm { padding: 7px 16px; font-size: .82rem; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #b0bec5; }
.btn-block { width: 100%; justify-content: center; }

/* ── Mensagens de erro/sucesso ───────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: .9rem;
  margin-bottom: 18px;
}
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Success page ────────────────────────────────────────── */
.success-box {
  text-align: center;
  padding: 48px 24px;
}
.success-icon { font-size: 4rem; margin-bottom: 16px; }
.success-box h2 { font-size: 1.4rem; margin-bottom: 10px; color: var(--primary); }
.success-box p  { color: var(--text-muted); font-size: .95rem; }

/* ============================================================
   ADMIN
   ============================================================ */

/* ── Layout admin ────────────────────────────────────────── */
.admin-wrap {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: #1e293b;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 0;
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #334155;
}
.sidebar-brand img  { height: 36px; margin-bottom: 6px; }
.sidebar-brand span { display: block; font-size: .78rem; color: #64748b; }

.sidebar-nav { padding: 16px 12px; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #94a3b8;
  font-size: .9rem;
  margin-bottom: 4px;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #334155;
  color: #e2e8f0;
  text-decoration: none;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #334155;
  font-size: .82rem;
  color: #64748b;
}
.sidebar-footer a { color: #94a3b8; }

.admin-main {
  flex: 1;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-topbar h1 { font-size: 1.1rem; font-weight: 700; }

.admin-content { padding: 28px; flex: 1; }

/* ── Tabela de submissions ───────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
thead th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
tbody tr:hover { background: #f8fafc; }

/* ── Badges de status ────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-aberto     { background:#dbeafe; color:var(--aberto); }
.badge-analisando { background:#fef3c7; color:var(--analisando); }
.badge-respondida { background:#ede9fe; color:var(--respondida); }
.badge-ignorada   { background:#f1f5f9; color:var(--ignorada); }
.badge-concluida  { background:#d1fae5; color:var(--concluida); }

/* ── Filtros ─────────────────────────────────────────────── */
.filters-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.filter-group select,
.filter-group input[type="text"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .88rem;
  background: #fff;
  outline: none;
}
.filter-group select:focus,
.filter-group input:focus { border-color: var(--primary); }

/* ── Detalhe da submission ───────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.detail-card h3 {
  font-size: .8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
}
.detail-message {
  font-size: .95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Histórico de status */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-dot {
  position: absolute;
  left: -17px; top: 5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
}
.timeline-date  { font-size: .78rem; color: var(--text-muted); }
.timeline-body  { font-size: .88rem; margin-top: 2px; }
.timeline-note  { font-size: .83rem; color: var(--text-muted); font-style: italic; margin-top: 3px; }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 40px rgba(0,0,0,.3);
}
.login-card img { height: 44px; margin: 0 auto 24px; }
.login-card h1 { text-align: center; font-size: 1.3rem; margin-bottom: 4px; }
.login-card p  { text-align: center; color: var(--text-muted); font-size: .88rem; margin-bottom: 28px; }

/* ── Stats cards ──────────────────────────────────────────── */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  flex: 1;
  min-width: 130px;
}
.stat-card .stat-num  { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label{ font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Responsivo ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .card { padding: 24px 18px; }

  .admin-wrap { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .sidebar-brand { padding: 12px 16px; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px; }
  .sidebar-nav a { padding: 7px 10px; font-size: .82rem; }
  .sidebar-footer { padding: 10px 16px; }

  .admin-topbar { padding: 12px 16px; }
  .admin-content { padding: 16px; }

  .detail-grid { grid-template-columns: 1fr; }

  .filters-row { flex-direction: column; }
  .filter-group { width: 100%; }
  .filter-group select,
  .filter-group input { width: 100%; }
}

@media (max-width: 480px) {
  .card { padding: 20px 14px; }
  .card-title { font-size: 1.2rem; }
}
