/* ==========================================================
   _forms.css — Estilos semânticos de formulários
   Baseado em estrutura de tags HTML semânticas.
   Uso: <form class="[nome]"><fieldset><div class="field">…
   ========================================================== */

/* ── Formulário: layout em coluna ─────────────────────────── */
form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ── Fieldset: agrupamento semântico sem borda visual ────── */
fieldset {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5em 1.5em 1em 1.5em;
}

fieldset>legend {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: .5rem;
}

/* ── Field: wrapper de campo (label + input + hint) ──────── */
.field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.field>label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.field>label small {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
  color: var(--text-light);
}

/* Dica / instrução abaixo do input */
.field>p {
  font-size: .8125rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Inputs, selects, textareas ──────────────────────────── */
input:not(:is([type="radio"], [type="checkbox"], [type="hidden"])),
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius-md);
  padding: 0.5em 0.75em;
  font: inherit;
  font-size: .9375rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

input::placeholder {
  color: var(--text-light);
}

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

/* Select customizado com chevron */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

/* ── Estados de validação (após interação do usuário) ────── */
.field:has(input:user-invalid) input,
.field:has(select:user-invalid) select,
.field:has(textarea:user-invalid) textarea {
  border-color: var(--danger) !important;
}

.field:has(input:user-invalid)>p,
.field:has(select:user-invalid)>p,
.field:has(textarea:user-invalid)>p {
  color: var(--danger);
}

/* Validação inline no form */
form :is(input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]):not([type="file"]),
  select,
  textarea):user-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}

form .field:has(:is(input, select, textarea):user-invalid)>label,
form .field:has(:is(input, select, textarea):user-invalid)>p {
  color: var(--danger);
}

/* ── Avatar / upload de imagem ───────────────────────────── */
figure.avatar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 4px;
}

figure.avatar img {
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--line);
}

figure.avatar .photo-upload {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  align-items: flex-start;
}

figure.avatar .change-image {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand);
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--t);
  user-select: none;
}

figure.avatar .change-image:hover {
  background: var(--brand-soft);
}

figure.avatar .change-image svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
}

figure.avatar p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

figure.avatar input[type="file"] {
  display: none;
}

/* ── Radio / Checkbox group dentro de fieldset.field ─────── */
.field.radio>div,
.field.checkbox>div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field.radio input[type="radio"],
.field.checkbox input[type="checkbox"] {
  width: auto;
  accent-color: var(--brand);
}

.field.radio label,
.field.checkbox label {
  font-size: .9375rem;
  font-weight: 500;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

input:is([type="radio"], [type="checkbox"]):checked+label {
  font-weight: 600;
  color: var(--text);
}

.field:is(.radio, .checkbox) .options {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
}

/* ── Chips (checkboxes/radios estilizados) ───────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.25em 0.75em;
  border-radius: 100px;
  line-height: 1.1;
  border: 1.5px solid var(--line);
  font-size: .8125em;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  background: var(--bg);
  transition: background var(--t), border-color var(--t), color var(--t);
}

.chip:hover {
  border-color: var(--line-dark);
}

.chip input[type="checkbox"],
.chip input[type="radio"] {
  display: none;
}

.chip:has(input:checked) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Botões ──────────────────────────────────────────────── */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.5em 0.75em;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: background var(--t), border-color var(--t), opacity var(--t);
  line-height: 1.25;
}

button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Submit / ação primária */
.submit,
button[type="submit"] {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

button[type="submit"]:not(:disabled):hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

/* Botão comum / secundário */
.button,
button[type="button"] {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--line-dark);
}

button[type="button"]:not(:disabled):hover {
  filter: brightness(1.1) contrast(0.9);
}

/* Botão de perigo */
button.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

button.danger:not(:disabled):hover {
  filter: brightness(.9);
}

button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

button.full {
  width: 100%;
}

/* Estado selecionado (dias da semana, chips, opções) */
button.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 129, 194, .35);
}

/* Spinner de loading */
.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}

button[data-loading] .spinner {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Botão em estilo de texto (inline, sem borda) */
.text {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: .8125rem;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.text:hover {
  text-decoration: underline;
}

/* Link com aparência de botão secundário */
a.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.25em 0.5em;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  border: 1.5px solid var(--line-dark);
  background: transparent;
  color: var(--text-muted);
  transition: background var(--t), border-color var(--t), opacity var(--t);
}

a.button:hover,
button .button:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

a.button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Link com aparência de botão primário (submit) */
a.button.submit,
button .button.submit {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  margin: 0 0 0 auto;
}

a.button.submit:hover,
button .button.submit:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

/* ── Botões de ação .buttons ─────────────────────────────── */
.buttons {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ── Feedback do formulário ──────────────────────────────── */
.form-feedback {
  font-size: .875rem;
  min-height: 1.25em;
  text-align: right;
  margin-top: -.5rem;
}

.form-feedback:empty {
  display: none;
}

.form-feedback.ok {
  color: var(--success);
}

.form-feedback.error {
  color: var(--danger);
}

/* ── Hint de campo (classe adicional) ────────────────────── */
.field-hint {
  font-size: .8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.field-error {
  font-size: .8125rem;
  color: var(--danger);
}

/* ── Rodapé do formulário ────────────────────────────────── */
.form-actions {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-error {
  font-size: .8125rem;
  color: var(--danger);
  min-height: 0;
  transition: min-height var(--t);
}

/* ----------------------------------------------------------
   Badges (labels de status, fase, tipo)
   Uso: <span class="badge status-aberta">Aberta</span>
        <span class="badge stage" style="--clr:#6c63ff">Entender</span>
   ---------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  /* font-weight: 600; */
  padding: 2px 9px;
  border-radius: 100px;
  white-space: nowrap;
}

/* Fase — cor controlada por --clr definido no elemento */
.badge.stage {
  background: color-mix(in srgb, var(--clr, #64748b) 15%, transparent);
  color: var(--clr, #64748b);
  border: 1px solid color-mix(in srgb, var(--clr, #64748b) 40%, transparent);
}

/* Tipo */
.badge.task {
  background: #f1f5f9;
  color: #475569;
}

.badge.activity {
  background: var(--brand-soft, #eff6ff);
  color: var(--brand);
}

/* Status de demanda */
.badge.status-aberta {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.badge.status-em-andamento {
  background: #fefce8;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge.status-concluida {
  background: #f0fdf4;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge.status-em-atraso {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge.status-encerrada {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* Status de proposta */
.badge.approved {
  background: #f0fdf4;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge.delivered {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.badge.mine {
  background: #eff6ff;
  color: #2563eb;
  font-size: .65rem;
}

/* Ciclo de vida completo da proposta (usado em demanda.html) */
.badge.status-pr-em-progresso {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.badge.status-pr-concluida {
  background: #fefce8;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge.status-pr-aprovada {
  background: #f0fdf4;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge.status-pr-reprovada {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge.status-pr-reprovada-proposta {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge.status-pr-reprovada-execucao {
  background: #fdf4ff;
  color: #7c3aed;
  border: 1px solid #e9d5ff;
}

/* Lista horizontal de badges — dentro de <ul class="badges"> */
ul.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 4px 0;
}



/* ----------------------------------------------------------
   Tags de especialidade e técnica
   Uso: <ul class="tags"><li class="spec">UX Research</li></ul>
        ou <span class="spec">UX Research</span> isolado
   ---------------------------------------------------------- */
ul.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0;
}

.spec {
  font-size: .7rem;
  background: #f1f5f9;
  color: #334155;
  padding: 2px 9px;
  border-radius: 100px;
  font-weight: 500;
}

.tech {
  font-size: .7rem;
  background: #faf5ff;
  color: #6d28d9;
  padding: 2px 9px;
  border-radius: 100px;
  font-weight: 500;
}

/* ----------------------------------------------------------
   Quem pode propor uma demanda — linha informativa
   Uso: <p class="access-who"><span class="label">Aceita de:</span><span class="access-tag">...</span></p>
   ---------------------------------------------------------- */

.access-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 5px 0 0;
}

.access-who .label {
  font-size: .7rem;
  color: var(--text-muted);
  white-space: nowrap;
  margin-right: 2px;
}

.access-tag {
  font-size: .7rem;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 1px 8px;
  border-radius: 100px;
  font-weight: 500;
}

figure.act-img {
  margin: 0;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

figure.act-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

a.back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 20px 0 8px;
  font-size: .8125rem;
  color: var(--text-muted);
  text-decoration: none;
}

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

a.back svg {
  display: inline;
  vertical-align: middle;
}