/* ==========================================================
   Sistema de Inscrição — URI Santo Ângelo
   Folha de estilos única (sem dependências externas)
   ========================================================== */

:root {
  --primary: #0b4a8b;
  --primary-dark: #08365f;
  --primary-light: #e8f0fa;
  --accent: #f2a900;
  --success: #1e7e44;
  --success-bg: #e6f4ec;
  --warning: #9a6700;
  --warning-bg: #fff6dd;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --info: #175cd3;
  --info-bg: #eaf2ff;

  --bg: #f3f5f9;
  --surface: #ffffff;
  --text: #1d2433;
  --muted: #5f6b7d;
  --border: #dde3ec;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  --sidebar-w: 260px;
  --header-h: 64px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* ---------- Topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.topbar .title { font-weight: 600; font-size: 1.05rem; }
.topbar .title small { display: block; font-weight: 400; opacity: .8; font-size: .8rem; }
.topbar .spacer { flex: 1; }
.topbar .logo {
  height: 44px; display: flex; align-items: center;
  background: #fff; border-radius: 8px; padding: 4px 10px;
  color: var(--primary); font-weight: 700; font-size: .85rem;
}
.topbar .logo img { height: 36px; }
.menu-toggle {
  display: none;
  background: transparent; border: 0; color: #fff;
  width: 40px; height: 40px; border-radius: 8px; cursor: pointer;
}
.menu-toggle:hover { background: rgba(255, 255, 255, .12); }

/* ---------- Rodapé ---------- */
.footer {
  text-align: center; color: var(--muted);
  font-size: .85rem; padding: 24px 16px;
}

/* ---------- Cartões ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card + .card { margin-top: 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.card-header h2, .card-header h3 { margin: 0; }

/* ---------- Formulários ---------- */
.form-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(12, 1fr);
}
.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-1 { grid-column: span 1; min-width: 72px; }

.field label {
  display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px;
}
.field label .req { color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 110px; resize: vertical; }
.input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 74, 139, .15);
}
.input[readonly], .input:disabled { background: #f1f3f7; color: var(--muted); }
.field.invalid .input { border-color: var(--danger); }
.field .error { display: none; color: var(--danger); font-size: .82rem; margin-top: 4px; }
.field.invalid .error { display: block; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }

.input-group { position: relative; }
.input-group .input { padding-right: 44px; }
.input-group .toggle-pass {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  width: 36px; height: 36px; border-radius: 6px;
}
.input-group .toggle-pass:hover { background: var(--bg); }

.check {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; background: #fff;
}
.check input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--primary); }
.field label.check { font-weight: 400; font-size: .92rem; margin-bottom: 0; }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }

.instrucoes { border-left: 4px solid var(--primary); }
.instrucoes ol { margin: 0; padding-left: 20px; }
.instrucoes li { margin-bottom: 6px; }
.instrucoes li:last-child { margin-bottom: 0; }

.subsection {
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 16px; margin-top: 8px; background: #fafbfd;
}

.form-actions {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end;
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border);
}

/* Medidor de força da senha */
.strength { height: 6px; border-radius: 4px; background: var(--border); margin-top: 8px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.rules { list-style: none; padding: 0; margin: 10px 0 0; font-size: .85rem; }
.rules li { color: var(--muted); padding-left: 22px; position: relative; }
.rules li::before { content: "○"; position: absolute; left: 4px; }
.rules li.ok { color: var(--success); }
.rules li.ok::before { content: "✓"; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600;
  padding: 10px 18px; min-height: 42px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-block { width: 100%; }
.btn .spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Alertas e selos ---------- */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; margin-bottom: 16px; font-size: .92rem;
}
.alert strong { display: block; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #c6dbff; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bfe3cd; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #f5dc94; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #f5c2bd; }
.alert .alert-icon { font-size: 1.2rem; line-height: 1.2; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: #eef1f5; color: var(--muted); }

/* ---------- Páginas de acesso (login / cadastro) ---------- */
.auth-wrap {
  min-height: calc(100vh - var(--header-h));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 860px; }
.auth-card .head { text-align: center; margin-bottom: 20px; }
.auth-card .head .icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary); font-size: 1.6rem; margin-bottom: 8px;
}
.info-concurso {
  background: var(--primary-light); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 16px; font-size: .9rem;
  display: flex; flex-direction: column; gap: 4px; text-align: center;
}
.auth-links { text-align: center; margin-top: 16px; font-size: .92rem; }
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: .85rem; margin: 20px 0;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Indicador de etapas */
.steps {
  display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px;
  counter-reset: step;
}
.steps li {
  flex: 1; text-align: center; font-size: .82rem; color: var(--muted);
  position: relative; padding-top: 38px;
}
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--border); color: var(--muted); font-weight: 700;
}
.steps li.active { color: var(--primary); font-weight: 600; }
.steps li.active::before { background: var(--primary); color: #fff; }
.steps li.done::before { content: "✓"; background: var(--success); color: #fff; }

/* ---------- Área do Inscrito ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar .user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.sidebar .user .name { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.sidebar .user .cpf { font-size: .8rem; color: var(--muted); }
.nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 12px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-weight: 500;
}
.nav-link .ico { width: 20px; text-align: center; }
.nav-link:hover { background: var(--bg); }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-link.disabled { opacity: .45; pointer-events: none; }
.nav-link .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.sidebar .bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.sidebar-overlay { display: none; }
.content { padding: 24px; min-width: 0; }
.content-inner { max-width: 1100px; margin: 0 auto; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title p { margin: 0; color: var(--muted); }

/* Painel de informações */
.info-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.info-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.info-item .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.info-item .value { font-size: 1.05rem; font-weight: 600; word-break: break-word; }
.info-item .value.code { font-family: Consolas, "Courier New", monospace; letter-spacing: .03em; }

.dl { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: .9rem; }
.dl dd { margin: 0; font-weight: 500; }

.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.doc-list li:last-child { border-bottom: 0; }
.doc-list .doc-name { flex: 1; min-width: 180px; }
.doc-list .doc-name small { display: block; color: var(--muted); }

.recurso-item { display: block; }
.recurso-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.recurso-resposta { margin-top: 10px; padding: 10px 12px; background: var(--success-bg); border-radius: var(--radius-sm); font-size: .92rem; }
.recurso-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.recurso-acoes:empty { display: none; }

.empty {
  text-align: center; padding: 32px 16px; color: var(--muted);
}
.empty .ico { font-size: 2.2rem; display: block; margin-bottom: 8px; }

/* Tabela responsiva */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { font-size: .8rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 24, 40, .5);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 480px;
  padding: 24px; box-shadow: 0 20px 40px rgba(0, 0, 0, .2);
  animation: pop .15s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal .actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast-area {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px);
}
.toast {
  padding: 12px 16px; border-radius: var(--radius-sm); color: #fff;
  background: var(--text); box-shadow: var(--shadow); max-width: 380px;
  animation: pop .2s ease-out;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ---------- Simulador (apenas protótipo) ---------- */
.demo-bar {
  background: #fff8e1; border: 1px dashed #e0b84a; border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 20px; font-size: .85rem;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.demo-bar select { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid #e0b84a; }

/* ---------- Responsividade ---------- */
@media (max-width: 960px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 40;
    width: var(--sidebar-w); transform: translateX(-100%);
    transition: transform .2s ease; overflow-y: auto;
    box-shadow: 4px 0 16px rgba(0, 0, 0, .1);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: var(--header-h) 0 0 0; z-index: 35;
    background: rgba(16, 24, 40, .4); display: none;
  }
  .sidebar-overlay.open { display: block; }
  .col-8, .col-6, .col-4, .col-3, .col-1 { grid-column: span 12; }
}
@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .content { padding: 16px; }
  .card { padding: 16px; }
  .topbar .title small { display: none; }
  .topbar .logo { height: 38px; padding: 2px 8px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 10px; }
  .form-actions .btn { flex: 1; }
  .steps li { font-size: .72rem; }
}
