/* =========================
   Reset y base
   ========================= */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: Arial, sans-serif;
  margin: 0;
  color: #1f2937;
  background-image: url('../img/calarajada.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* =========================
   Layout
   ========================= */
.center-container{
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;     /* que empiece arriba (se ve el selector de idioma) */
  padding: 20px 12px;
}

/* Tarjeta translúcida */
.overlay{
  display: flex;
  flex-direction: column;
  gap: 10px;

  /* tamaño compacto y responsivo */
  max-width: 520px;
  width: min(92vw, 520px);
  max-height: 70vh;            /* << clave: limita la altura total */
  margin: 16px auto 24px;
  padding: 20px 22px;

  /* estética */
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(2px);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  text-align: left;
}

/* Elementos que no deben crecer */
.overlay > .lang-switch,
.overlay > h1,
.overlay > #logo { flex: 0 0 auto; }

/* El formulario ocupa el resto y hace scroll interno */
#survey-form{
  flex: 1 1 auto;
  min-height: 0;               /* imprescindible para que flex permita encoger */
  overflow-y: auto;
  padding-right: 6px;          /* respiro para la scrollbar */
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

/* Scrollbar (Chromium/WebKit) */
#survey-form::-webkit-scrollbar{ width: 10px; }
#survey-form::-webkit-scrollbar-thumb{
  background: rgba(0,0,0,.15);
  border-radius: 8px;
}

/* =========================
   Tipografía y estructura
   ========================= */
h1{
  text-align: center;
  color: #2c3e50;
  font-size: 1.9rem;
  margin: 4px 0 10px;
}

#survey-form .field{ margin: 10px 0; }
.field-label{ font-weight: 600; display: block; margin-bottom: .35rem; }
.req{ color:#e11d48; margin-left:.25rem; }
.help{ font-size:.9rem; color:#6b7280; margin-top:.25rem; }

/* Campos de formulario */
#survey-form input,
#survey-form select,
#survey-form textarea,
#survey-form button:not(.star){
  width: 100%;
  padding: 10px 12px;
  margin-top: 4px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}
#survey-form textarea{ min-height: 96px; resize: vertical; }

/* Foco accesible */
#survey-form input:focus,
#survey-form select:focus,
#survey-form textarea:focus,
#survey-form button:not(.star):focus{
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* Radios/checkbox agrupados */
.options .opt{ display: inline-flex; align-items: center; margin-right: 10px; margin-bottom: 6px; }

/* Botón enviar */
#survey-form button:not(.star){
  background:#2980b9;
  color:#fff;
  font-weight:700;
  border:none;
  box-shadow:0 2px 6px rgba(0,0,0,.08);
  cursor:pointer;
  transition: background .15s ease, transform .06s ease;
}
#survey-form button:not(.star):hover{ background:#3498db; }
#survey-form button:not(.star):active{ transform: translateY(1px); }

/* =========================
   Switch de idiomas
   (tu HTML ya inyecta .lang-switch)
   ========================= */
.lang-switch{
  display:flex;
  gap:.5rem;
  justify-content:center;
  margin-bottom:.5rem;
}
.lang-switch a,
.lang-switch button{
  padding:.45rem .8rem;
  border:1px solid #e5e7eb;
  border-radius:10px;
  background:#fff;
  color:#1f2937;
  cursor:pointer;
  text-decoration:none;
  line-height:1.2;
}
.lang-switch button[aria-current="true"]{ font-weight:700; }

/* =========================
   Rating (estrellas)
   ========================= */
.field.rating{ margin: 12px 0; }

.stars{
  display:inline-flex;
  gap:10px;
  align-items:center;
  touch-action: manipulation;
}

.star{
  display:inline-grid;
  place-items:center;
  width:30px;
  height:30px;
  font-size:22px;
  line-height:1;
  cursor:pointer;
  color:#c9c9c9;               /* estrella “apagada” */
  user-select:none;
  transition: color .15s, transform .08s;
}
.star.is-active,
.star.is-preview{ color:#ffb400; }

@media (pointer:fine){
  .star:hover { transform: scale(1.12); }
}

.rating-hint{ font-size:.9rem; color:#555; margin-top:6px; }
.nojs .stars{ display:none; }

/* =========================
   Logo
   ========================= */
#logo img{
  width: 160px;
  max-width: 60%;
  height: auto;
  display: block;
  margin: 6px auto 0;
}

/* =========================
   Breakpoints
   ========================= */
@media (max-width: 992px){
  .overlay{ max-width: 500px; }
}

@media (max-width: 768px){
  .overlay{
    max-width: 480px;
    width: 94vw;
    max-height: 72vh;          /* un poco más alto en tablet */
    padding: 18px 20px;
  }
  h1{ font-size: 1.7rem; margin: 4px 0 10px; }
  .star{ width:28px; height:28px; font-size:20px; }
  #survey-form button:not(.star){ padding:12px; }
}

@media (max-width: 480px){
  .overlay{
    max-width: 95vw;
    width: 95vw;
    max-height: 76vh;          /* algo más alto en móvil */
    padding: 14px 16px;
    border-radius: 10px;
  }
  h1{ font-size: 1.45rem; }
  /* evita el zoom de iOS al enfocar */
  #survey-form input,
  #survey-form select,
  #survey-form textarea,
  #survey-form button:not(.star){ font-size:16px; }
  .star{ width:26px; height:26px; font-size:20px; }
}
/* Más alto el contenedor general */
.overlay{
  max-height: 80vh;      /* antes 70vh; si lo prefieres, usa 75vh */
  gap: 8px;              /* menos hueco entre bloques */
}

/* El área de preguntas ocupa, como mínimo, media pantalla */
#survey-form{
  flex: 1 1 auto;
  min-height: 50vh;      /* <- lo que pedías: ~50% de la ventana */
  overflow-y: auto;
  padding-right: 6px;
}

/* Comprimir encabezado y pie para darle más espacio al form */
.overlay > .lang-switch{ margin-bottom: .25rem; }
.overlay > h1{ margin: .25rem 0 .5rem; }
.overlay > #logo{ margin-top: .25rem; }

/* Ajustes en móvil/tablet: un poco menos agresivo para no tapar el header */
@media (max-width: 768px){
  .overlay{ max-height: 78vh; }
  #survey-form{ min-height: 52vh; }
}
@media (max-width: 480px){
  .overlay{ max-height: 76vh; }
  #survey-form{ min-height: 54vh; }
}
