:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #dc2626;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --text: #1f2937;
  --error-bg: #fee2e2;
}

/* ======== Base ======== */
body {
  min-width: 300px;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-behavior: smooth;
}

h1 {
  text-align: center;
  margin-bottom: 24px;
  color: var(--primary-dark);
  font-size: clamp(1.4rem, 4vw, 2rem);
  line-height: 1.3;
}

/* ======== Formulario ======== */
#surveyForm {
  width: 100%;
  max-width: 900px;
}

/* ======== Tarjetas ======== */
.card {
  margin: 18px 0;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--primary-dark);
  border-bottom: 2px solid rgba(37, 99, 235, 0.2);
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.card .form-group input {
  width: 50%;
  flex-direction: column;
  text-align: justify;
  align-content: center;
  margin: 0px;
}
#surveyForm .card .form-group:nth-of-type(1) input {
  width: 90%;
}
#surveyForm .card .form-group:nth-of-type(2) input {
  width: 10%;
}
#surveyForm .card .form-group:nth-of-type(3) select{
  width: 20%;
}

/* ======== Grupos ======== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all 0.25s ease;
  background: #fff;
}
.form-group select option {
  white-space: normal; /* permite salto de l¨ªnea dentro del option */
  word-wrap: break-word;
  font-size: 1rem;
  max-width: 100%;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ======== Preguntas ======== */
.question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid #e5e7eb;
  gap: 14px;
  flex-wrap: wrap;
}

.question:first-child {
  border-top: none;
}

.question p {
  margin: 0;
  flex: 1 1 70%;
  line-height: 1.5;
  font-size: clamp(0.95rem, 2vw, 1rem);
  transition: color 0.3s ease;
}

.form-group select {
  background: linear-gradient(to right, #fff, #f9fafb);
  transition: all 0.25s ease;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  appearance: none; /* quita el estilo nativo del sistema */
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px; /* espacio para la flecha */
  background-image: linear-gradient(45deg, transparent 50%, var(--primary) 50%),
                    linear-gradient(135deg, var(--primary) 50%, transparent 50%);
  background-position: right 12px center, right 8px center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* ======== Opciones ======== */
.options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.options input {
  display: none;
}

.options label {
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 0.95rem;
  user-select: none;
}

.options label:hover {
  transform: scale(1.03);
}

.options input:checked + span {
  background: var(--primary);
  color: #fff;
  transform: scale(1.3);
}

.options label span {
  display: inline-block;
  padding: 5px 15px;
  border-radius: 6px;
  border: 1px solid #003bfc5e;
  text-align: center;
  width: 40%;
}

/* ======== Bot¨®n ======== */
button {
  display: block;
  width: 100%;
  max-width: 250px;
  margin: 28px auto;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

button:active {
  transform: scale(0.98);
  background: var(--primary-dark);
}

/* ======== Resultados ======== */
#result {
  max-width: 700px;
  margin: 20px auto;
  padding: 20px;
  border-radius: var(--radius);
  font-weight: 500;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.5;
  display: none;
}

.ok {
  background: #ecfdf5;
  border: 2px solid var(--success);
  color: var(--success);
}
.warning {
  background: #fffbeb;
  border: 2px solid var(--warning);
  color: #92400e;
}
.danger {
  background: #fef2f2;
  border: 2px solid var(--danger);
  color: var(--danger);
}

.error {
  background-color: var(--error-bg) !important;
  border-color: var(--danger) !important;
}

/* ======== Modales ======== */
.modal-content {
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ======== RESPONSIVE ======== */

/* Tablets */
@media (max-width: 768px) {
  body { padding: 14px; }
  h1 { font-size: 1.5rem; }
  .question p { font-size: 1.05rem; }
  .options label span { font-size: 1.05rem; }
  button { font-size: 1.1rem; padding: 14px; }
}

/* M¨®viles */
@media (max-width: 480px) {
  h1 { font-size: 1.3rem; }

  .card input {
    flex-direction: column;
    text-align: center;
    align-content: center;
    margin: 0px;
  }
  #surveyForm .card .form-group:nth-of-type(1) input{
    width: 90%;
  }
  #surveyForm .card .form-group:nth-of-type(2) input{
    width: 50%;
  }
  #surveyForm .card .form-group:nth-of-type(3) select{
    width: 100%;
  }
  #surveyForm .card .form-group:nth-of-type(4) input{
    width: 90%;
  }
  .question {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .form-group select {
    font-size: 1.05rem;
    padding: 14px;
  }
  .question p {
    font-size: 1.05rem;
    line-height: 1.6;
  }

  .options {
    width: 100%;
    flex-direction: column;
    display: flex;
    text-align: center;
    align-content: center;
  }

  .options label {
    width: 50%;
    max-width: 50px;
    text-align: center;
    border-radius: 10px;
    transition: all 0.25s ease;
  }

  .options label span {
    text-align: center;
    border-radius: 10px;
    transition: all 0.25s ease;
  }

  .options input:checked + span {
    transform: scale(1.2);
  }

  button {
    font-size: 1.05rem;
    padding: 14px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  body {
    padding: 10px;
    font-size: 0.9rem;
  }

  h1 {
    font-size: 1.2rem;
    text-align: center;
  }

  .card {
    padding: 16px 18px;
  }

  .form-group input,
  .form-group select {
    width: 100%;
    padding: 10px;
    font-size: 0.95rem;
  }

  .options {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .options label {
    width: auto;
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  button {
    width: 90%;
    font-size: 1rem;
    padding: 12px;
  }
}
