/* ==== VARIABLES ==== */
:root {
  --verde-poliglota: #00c48c;
  --verde-oscuro: #009a75;
  --verde-claro: #a8f5e1;
  --degradado-verde: linear-gradient(to right, #00c48c, #00b8a9);

  --violeta: #a770ef;
  --violeta-oscuro: #7b61ff;
  --violeta-claro: #f4edfd;
  --degradado-violeta: linear-gradient(to right, #a770ef, #7b61ff);

  --gris-suave: #f3f5f9;
  --texto-principal: #2d2d2d;
  --texto-secundario: #555;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* ==== GLOBAL ==== */
body {
  font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(to bottom, #f0fcf7, #e6f7f2);
  color: var(--texto-principal);
  margin: 0;
  padding: 0;
}

/* ==== CARD PRINCIPAL ==== */
.card {
  border-radius: 20px;
  border: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  backdrop-filter: blur(5px);
}

.card-feedback {
  height: 90dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 20px;
  border: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  backdrop-filter: blur(5px);
}

[id^="paso-"] {
  flex: 1;
  min-height: 0; /* necesario para que el overflow funcione dentro de un flexbox */
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

#paso-7{
  padding-bottom: 0 !important;
}

/* ==== INPUTS ==== */
input.form-control {
  border-radius: 10px;
  border: 1px solid #ced4da;
  padding: 12px 14px;
  font-size: 1rem;
  background-color: #f9fbfd; /* <- este es el fondo suave recomendado */
  transition: border-color 0.2s ease;
  color: #2d2d2d;
}

input.form-control:focus {
  border-color: var(--violeta);
  box-shadow: 0 0 0 0.2rem rgba(167,112,239,0.25);
}

/* ==== BOTONES ==== */
.btn {
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
}

.btn-primary {
  background: var(--degradado-violeta);
  border: none;
  color: white;
  box-shadow: 0 4px 12px rgba(167, 112, 239, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(to right, #8f4df5, #5a4bff);
}

.btn-success {
  background: var(--degradado-verde);
  border: none;
  color: white;
  box-shadow: 0 4px 10px rgba(0, 196, 140, 0.25);
}
.btn-success:hover {
  background: linear-gradient(to right, #00b48a, #009b8a);
}

.btn-secondary {
  background: #e4e6eb;
  color: #333;
  border: none;
}
.btn-secondary:hover {
  background: #d0d3d8;
}

/* ==== BOTONES CIRCULARES ==== */
.btn-circular {
  border-radius: 50%;
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==== BURBUJAS DE DIÁLOGO ==== */
.bubble-left {
  background: #f4edfd;
  color: #2d2d2d;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 6px;
  max-width: 75%;
  word-wrap: break-word;
  box-shadow: 0 2px 4px rgba(167, 112, 239, 0.05);
  margin-bottom: 8px;
  border: 1px solid #e9dafa;
}

.bubble-right {
  background: var(--degradado-verde);
  color: white;
  padding: 10px 14px;
  border-radius: 18px 18px 6px 18px;
  max-width: 75%;
  word-wrap: break-word;
  align-self: flex-end;
  box-shadow: 0 3px 6px rgba(0, 196, 140, 0.2);
  margin-bottom: 8px;
}

/* ==== PILLS DE SUGERENCIA ==== */
.pill-situacion {
  display: inline-block;
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid var(--violeta);
  border-radius: 999px;
  color: var(--violeta-oscuro);
  font-size: 0.85rem;
  margin: 4px 6px 0 0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pill-situacion:hover {
  background: var(--violeta-claro);
}

.pill-situacion:last-child {
  border-color: var(--violeta);
  font-weight: 500;
  color: var(--violeta-oscuro);
}

/* ==== ÁREA DEL CHAT ==== */
#chat {
  height: 60vh;
  overflow-y: auto;
  padding: 15px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
}

/* ==== ESTADO DEL MICRÓFONO ==== */
.btn-mic-muted {
  background-color: #d0d3d8;
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.08);
  transform: translateY(1px) scale(0.97);
  transition: all 0.1s ease;
}

/* ==== INDICADOR DE ESTADO ==== */
.estado-indicador {
  background-color: var(--gris-suave);
  color: var(--texto-secundario);
  font-size: 0.85rem;
  padding: 6px 12px;
  text-align: center;
  border-top: 1px solid #dee2e6;
  transition: all 0.3s ease;
}

.estado-indicador.d-none {
  opacity: 0;
  pointer-events: none;
}

/* ==== ICONO DE ESTADO ==== */
.estado-icono {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  text-align: center;
  color: white;
  position: relative;
}

/* ==== ESTADOS ANIMADOS ==== */
.estado-escucha {
  background-color: var(--verde-poliglota);
  animation: respirar 2.5s ease-in-out infinite;
}

.estado-grabando {
  background-color: #ff8888;
  animation: respirar 1.4s ease-in-out infinite;
}

.estado-hablando {
  width: 30px;
  height: 30px;
  background-color: #ced4da;
}

.estado-procesando i.fas.fa-spinner {
  font-size: 1.9rem;
  color: #6c757d;
}

/* ==== BARRA DE PROGRESO DE PASOS ==== */
#barra-progreso-contenedor {
  width: 100%;
  padding: 0 1rem;
  margin-bottom: 1rem;
}

#texto-progreso {
  font-size: 0.85rem;
  color: #666;
  text-align: right;
}

#texto-progreso {
  text-align: right;
  font-size: 0.85rem;
  color: var(--texto-secundario);
  margin-bottom: 8px;
}

/* ==== ANIMACIONES ==== */
@keyframes respirar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

@keyframes puntosParpadeando {
  0% { content: "."; }
  33% { content: ".."; }
  66% { content: "..."; }
  100% { content: "."; }
}
.animacion-puntos::after {
  content: ".";
  animation: puntosParpadeando 1s steps(1, end) infinite;
}

/* ==== AVATAR ==== */
#contenedor-avatar {
  width: 120px;
  margin: 0 auto 10px auto;
  text-align: center;
}
#contenedor-avatar svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.05));
}

/* ==== FEEDBACK FINAL ==== */
#paso-9 h2 {
  font-size: 1.5rem;
}
#feedback-nivel {
  font-size: 1.2rem;
  background: var(--degradado-verde);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}

/* ==== SELECTOR DE NIVEL VISUAL ==== */
.nivel-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  line-height: 1.3;
  font-weight: 300;
  color: #2c2c2c;
  background-color: white;
  transition: all 0.2s ease;
  padding: 12px 16px;
}

.nivel-btn:hover {
  background-color: #f8f6ff;
  cursor: pointer;
}

.nivel-btn.active {
  background-color: #f4edfd;
  border-color: #a770ef;
  box-shadow: 0 0 0 2px rgba(167, 112, 239, 0.15);
}

/* Alineación visual */
.nivel-btn span {
  display: inline-block;
  vertical-align: middle;
  margin-left: 2px;
}

.nivel-icon {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
  width: fit-content;
}

.barra {
  width: 6px;
  background-color: #e0defa;
  border-radius: 3px;
}

.barra-corta {
  height: 8px;
}
.barra-mediana {
  height: 14px;
}
.barra-larga {
  height: 20px;
}

/* Nivel bajo → solo 1 activa */
.nivel-btn[data-nivel="bajo"] .barra-corta {
  background-color: #a770ef;
}

/* Nivel medio → 2 activas */
.nivel-btn[data-nivel="medio"] .barra-corta,
.nivel-btn[data-nivel="medio"] .barra-mediana {
  background-color: #a770ef;
}

/* Nivel alto → todas activas */
.nivel-btn[data-nivel="alto"] .barra {
  background-color: #7b61ff;
}

.icono-instruccion {
  font-size: 1.3rem;
  min-width: 28px;
  display: inline-block;
  background: var(--degradado-violeta);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  line-height: 1.2;
  overflow: visible;
}

#paso-1 h2 {
  font-weight: 600;
  font-size: 1.5rem;
}

#paso-1 img {
  max-height: 280px;
}

#pantallas {
  width: 100%;
  max-width: 390px;
  height: 90dvh;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  backdrop-filter: blur(5px);
}


#logo-poliglota {
  max-height: 64px;
  width: auto;
  display: block;
}

@media (max-width: 767px) {
  #logo-poliglota {
    max-height: 6vh;
    margin: 0 auto !important;
  }

  #pantallas {
    height: 90dvh;
  }

  .col-app{
    margin-top: 10px !important;
  }

  #paso-7 {
    overflow-y: auto;
    padding-top: 0 !important;
  }

  #contenedor-avatar {
    margin: 10px auto 0 auto;
  }
}

/* ==== FEEDBACK FINAL ==== */
#feedback-render {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.2rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--texto-principal);
}

#feedback-boton-final {
  padding: 1rem;
  border-top: 1px solid #eee;
  background: white;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.03);
}

/* Título principal */
#feedback-render h2 {
  font-weight: 600;
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

/* Nivel CEFR */
#feedback-render .display-3 {
  font-size: 2rem;
  font-weight: 700;
  background: var(--degradado-violeta);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 0.3rem;
  margin-bottom: 0.2rem;
}

/* Lista de observaciones */
.lista-observaciones {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem 0;
}

.observacion-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 16px;
  margin-bottom: 0.8rem;
}

.observacion-item i {
  font-size: 1rem;
  margin-top: 4px;
  flex-shrink: 0;
}

/* Botón final */
#feedback-render .btn {
  min-width: 160px;
  font-size: 0.95rem;
  padding: 10px 20px;
}

/* Responsive */
@media (max-width: 576px) {
  #feedback-render {
    padding: 1.2rem 1rem;
  }

  #feedback-render h2 {
    font-size: 1.15rem;
  }

  #feedback-render .display-3 {
    font-size: 2.2rem;
  }

  .observacion-item {
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
  }
}

.idioma-opcion {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  background-color: #fff;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.idioma-opcion span.fi.fis {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background-size: cover;
  display: inline-block;
  flex-shrink: 0;
  border: none !important;
}

.idioma-opcion:hover {
  background-color: #f4edfd;
  border-color: var(--violeta);
}

.idioma-opcion.selected {
  background-color: #e9dafa;
  border-color: var(--violeta);
  font-weight: 500;
}
