/* ============================================================
   form.css · Formulario: entrada, ejemplos, tonos, botón
   generar, modo IA y mensajes de error
   ============================================================ */

.field-label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 16px;
  font: inherit;
  font-size: 1rem;
  background: var(--bg);
  color: var(--ink);
  transition: box-shadow var(--speed);
}

textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--line); }

/* ---------- Ejemplos rápidos ---------- */
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.examples button {
  border: 1px dashed var(--ink-faint);
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
  transition: border-color var(--speed), color var(--speed);
}

.examples button:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Tipo de tarea ---------- */
.tones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.tone {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--speed);
}

.tone[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.mt { margin-top: 24px; }

/* ---------- Botón generar ---------- */
#generar {
  width: 100%;
  margin-top: 24px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity var(--speed);
}

#generar:hover:not(:disabled) { opacity: .85; }
#generar:disabled { opacity: .55; cursor: wait; }

.spinner {
  width: 17px;
  height: 17px;
  border: 2.5px solid color-mix(in srgb, currentColor 28%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}

.loading .spinner { display: inline-block; }

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

.hint { text-align: center; color: var(--ink-faint); font-size: .76rem; margin-top: 10px; }

/* ---------- Modo IA opcional ---------- */
details.ai {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: .88rem;
}

details.ai summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); }
details.ai[open] summary { margin-bottom: 10px; }
details.ai p { color: var(--ink-faint); font-size: .8rem; margin-bottom: 8px; }

details.ai input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font: inherit;
  font-size: .85rem;
  font-family: var(--mono);
}

details.ai input:focus { outline: none; border-color: var(--ink); }

/* ---------- Error ---------- */
#error {
  display: none;
  margin-top: 16px;
  border: 1px solid var(--ink);
  border-left: 4px solid var(--ink);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: .9rem;
  background: var(--panel);
}
