/* Componentes reutilizables: botón, campo, alerta. */

/* Botón */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-pill);
  font: 600 16px/1 var(--font);
  cursor: pointer;
  transition: background-color .15s, transform .1s;
}

.btn:active {
  transform: scale(.98);
}

.btn--primary {
  background: var(--lime);
  color: var(--ink);
}

.btn--primary:hover {
  background: var(--lime-strong);
}

.btn[disabled] {
  cursor: default;
}

.btn[disabled]:active {
  transform: none;
}

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(13, 13, 13, .25);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.btn.is-loading .btn__spinner {
  display: inline-block;
}

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

/* Campo de formulario */
.field {
  display: grid;
  gap: 8px;
}

.field>label {
  font-size: 14px;
  font-weight: 500;
}

.input-wrap {
  position: relative;
}

.input {
  width: 100%;
  height: 54px;
  padding: 0 18px;
  background: var(--field);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  font: 400 16px/1 var(--font);
  color: var(--ink);
  transition: border-color .15s, background-color .15s;
}

.input::placeholder {
  color: #9a9a94;
}

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

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

.input[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-bg);
}

/* El autocompletado del navegador no debe cambiar el color del campo */
.input:-webkit-autofill,
.input:-webkit-autofill:hover {
  -webkit-box-shadow: 0 0 0 100px var(--field) inset;
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
}

.input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px var(--surface) inset;
}

.input--area {
  height: auto;
  padding: 14px 18px;
  resize: vertical;
  line-height: 1.5;
}

.input--with-action {
  padding-right: 56px;
}

.input-action {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.input-action:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, .05);
}

.field__error {
  font-size: 13px;
  color: var(--danger);
}

/* Alerta */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}

/* Permisos: elementos sin permiso (gris, sin click) y atributo hidden siempre efectivo */
.is-disabled {
  opacity: .4;
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

/* FIX iOS: el input de fecha ignora el ancho y se sale del contenedor */
input.input[type="date"],
input.input[type="time"],
input.input[type="datetime-local"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
}

/* Sin esto, iOS colapsa la altura cuando el campo está vacío */
input.input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.2em;
}