*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --rojo: #D11F38;
  --rojo-oscuro: #a8182d;
  --gris-fondo: #f5f5f5;
  --gris-borde: #ccc;
  --gris-texto: #333;
  --blanco: #fff;
  --verde-exito: #2e7d32;
  --rojo-error: #c62828;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background-color: var(--gris-fondo);
  color: var(--gris-texto);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  width: min(95%, 640px);
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem);
}

.banner {
  width: 100%;
  margin-bottom: 1.5rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.banner img {
  width: 100%;
  height: auto;
  display: block;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  color: var(--rojo);
  margin-bottom: 0.25rem;
}

header .subtitle {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: #555;
}

form {
  background: var(--blanco);
  border-radius: 12px;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--gris-texto);
}

input[type="text"],
input[type="email"],
input[type="tel"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--gris-borde);
  border-radius: 8px;
  transition: border-color 0.2s;
  background: var(--blanco);
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--rojo);
  box-shadow: 0 0 0 3px rgba(209, 31, 56, 0.1);
}

input.input-error,
select.input-error {
  border-color: var(--rojo-error);
}

.error-msg {
  display: block;
  font-size: 0.8rem;
  color: var(--rojo-error);
  min-height: 1.2em;
  margin-top: 0.25rem;
}

/* RUT row */
.form-row {
  display: flex;
  gap: 0.75rem;
}

.rut-row .rut-cedula {
  flex: 1;
}

.rut-row .rut-dv {
  width: 70px;
  flex-shrink: 0;
}

/* Checkbox */
.checkbox-group {
  margin-top: 1.5rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--rojo);
}

.checkbox-label span {
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Button */
button[type="submit"] {
  display: block;
  width: 100%;
  padding: 0.9rem;
  margin-top: 1.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--blanco);
  background-color: var(--rojo);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

button[type="submit"]:hover {
  background-color: var(--rojo-oscuro);
}

button[type="submit"]:active {
  transform: scale(0.98);
}

button[type="submit"]:disabled {
  background-color: #999;
  cursor: not-allowed;
  transform: none;
}

/* Messages */
.mensaje-exito {
  margin-top: 1rem;
  padding: 1rem;
  background: #e8f5e9;
  color: var(--verde-exito);
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
}

.mensaje-error {
  margin-top: 1rem;
  padding: 1rem;
  background: #ffebee;
  color: var(--rojo-error);
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
}

.hidden {
  display: none;
}

/* Autocomplete */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--blanco);
  border: 2px solid var(--gris-borde);
  border-top: none;
  border-radius: 0 0 8px 8px;
  list-style: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.autocomplete-list li {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.autocomplete-list li:hover,
.autocomplete-list li.active {
  background: #fde8eb;
  color: var(--rojo);
}

.autocomplete-list.hidden {
  display: none;
}

/* Responsive */
@media (max-width: 480px) {
  .rut-row {
    flex-direction: row;
  }

  .rut-row .rut-dv {
    width: 60px;
  }
}
