/* native-controls.css — Estilo Ionic para los controles NATIVOS. Algunos forms deben
 * seguir siendo HTML nativo (POST nativo/multipart/FormData, admin, widgets Django):
 * estas clases replican el look de los ion-* directamente sobre los tokens --ion-*
 * (sin pasar por ningún puente --color-*).
 * Cubre: .input, .select, .textarea, .checkbox, .toggle, .radio, .file-input (+ -bordered/-sm). */

.input,
.select,
.textarea,
.file-input {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: auto;
  font: inherit;
  font-size: 0.875rem;
  color: var(--ion-text-color);
  background-color: var(--ion-background-color);
  border: 1px solid color-mix(in oklab, var(--ion-text-color) 25%, transparent);
  border-radius: 8px;
  padding: 0 0.75rem;
  min-height: 2.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.textarea {
  padding: 0.5rem 0.75rem;
  min-height: 4rem;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus,
.file-input:focus {
  outline: none;
  border-color: var(--ion-color-primary);
  box-shadow: 0 0 0 1px var(--ion-color-primary);
}

.input::placeholder,
.textarea::placeholder {
  color: color-mix(in oklab, var(--ion-text-color) 45%, transparent);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2373726e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

.select-sm {
  min-height: 2rem;
  font-size: 0.8125rem;
}

.file-input {
  padding: 0;
  overflow: hidden;
}
.file-input::file-selector-button {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ion-color-primary-contrast);
  background: var(--ion-color-primary);
  border: none;
  height: 100%;
  min-height: calc(2.5rem - 2px);
  padding: 0 0.875rem;
  margin-right: 0.75rem;
  cursor: pointer;
}

/* ── Checkbox / Radio ─────────────────────────────────────────────────────── */
.checkbox,
.radio {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border: 2px solid color-mix(in oklab, var(--ion-text-color) 35%, transparent);
  background: var(--ion-background-color);
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.checkbox { border-radius: 4px; }
.radio { border-radius: 50%; }
.checkbox-sm { width: 1rem; height: 1rem; }

.checkbox:checked,
.radio:checked {
  border-color: var(--ion-color-primary);
  background-color: var(--ion-color-primary);
}
.checkbox:checked {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 0.75rem;
  background-position: center;
  background-repeat: no-repeat;
}
.radio:checked {
  box-shadow: inset 0 0 0 3px var(--ion-background-color);
}

/* ── Toggle (switch, look ion-toggle) ─────────────────────────────────────── */
.toggle {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 2.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  border: none;
  border-radius: 1rem;
  background: color-mix(in oklab, var(--ion-text-color) 25%, transparent);
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 0.2s ease;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: var(--ion-background-color);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
  transition: transform 0.2s ease;
}
.toggle:checked,
.toggle-primary:checked {
  background: var(--ion-color-primary);
}
.toggle:checked::after {
  transform: translateX(1rem);
}

.checkbox:focus-visible,
.radio:focus-visible,
.toggle:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--ion-color-primary) 50%, transparent);
  outline-offset: 1px;
}
