/* ───────────────────────────────────────────────────────────
   Reclutamiento · Grupo FR — chat de aspirantes
   Paleta corporativa (la misma de la Evaluación 360)
   ─────────────────────────────────────────────────────────── */
:root {
  --verde: #00B500;
  --verde-osc: #024F01;
  --verde-medio: #046B04;
  --verde-claro: #E8F6E8;
  --verde-borde: #CBE5CB;
  --rojo: #D8262B;
  --tinta: #16210F;
  --gris: #5C6A5C;
  --gris-claro: #8A968A;
  --linea: #E1E9E1;
  --fondo: #F1F4F1;
  --fondo-chat: #EEF3EC;
  --burbuja-bot: #FFFFFF;
  --burbuja-yo: #D9F5D3;
  --blanco: #FFFFFF;
  --sombra: 0 1px 2px rgba(2, 40, 2, .06), 0 10px 30px rgba(2, 40, 2, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.app {
  height: 100vh;
  height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--fondo-chat);
}
@media (min-width: 800px) {
  body { padding: 24px 16px; background: linear-gradient(160deg, #DDE9DA, var(--fondo) 60%); }
  .app { height: calc(100dvh - 48px); border-radius: 18px; overflow: hidden; box-shadow: var(--sombra); border: 1px solid var(--linea); }
}

/* ── Barra superior ─────────────────────────────────────── */
.barra-chat {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(125deg, var(--verde-osc) 0%, var(--verde-medio) 70%, #0A8A0A 130%);
  color: #fff;
  flex: none;
}
.barra-texto { flex: 1; min-width: 0; }
.barra-titulo { font-weight: 800; font-size: 16px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-estado { font-size: 12.5px; opacity: .85; }
.boton-icono {
  background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 50%;
  width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
}
.boton-icono:hover { background: rgba(255,255,255,.22); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #fff; flex: none;
  display: grid; place-items: center; overflow: hidden; border: 1px solid var(--verde-borde);
}
.avatar img { width: 82%; height: auto; }
.avatar.grande { width: 42px; height: 42px; border: 0; }

/* ── Conversación ───────────────────────────────────────── */
.conversacion {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 18px;
  display: flex; flex-direction: column; gap: 6px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.dia {
  align-self: center; font-size: 11.5px; font-weight: 700; color: var(--gris);
  background: rgba(255,255,255,.75); padding: 3px 12px; border-radius: 999px; margin-bottom: 6px;
}

.fila { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.fila.bot { justify-content: flex-start; }
.fila.yo { justify-content: flex-end; }
.fila.bot .avatar { visibility: hidden; }
.fila.bot.ultima .avatar { visibility: visible; }
.fila + .fila.yo, .fila.yo + .fila.bot { margin-top: 6px; }

.burbuja {
  max-width: min(82%, 520px);
  padding: 9px 13px;
  border-radius: 16px;
  box-shadow: 0 1px 1px rgba(2, 40, 2, .08);
  overflow-wrap: anywhere;
  animation: aparecer .22s ease-out;
}
.bot .burbuja { background: var(--burbuja-bot); border-bottom-left-radius: 6px; }
.yo .burbuja { background: var(--burbuja-yo); border-bottom-right-radius: 6px; }
.burbuja.error { background: #FFF0F0; color: #8E1B1B; border: 1px solid #F5C9C9; }
.burbuja ul { margin: 4px 0 0; padding-left: 20px; }
.burbuja .omitida { color: var(--gris); font-style: italic; }

@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .burbuja, .puntos i { animation: none !important; } .conversacion { scroll-behavior: auto; } }

.escribiendo .burbuja { padding: 12px 14px; }
.puntos { display: inline-flex; gap: 4px; }
.puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--gris-claro); animation: rebote 1.1s infinite; }
.puntos i:nth-child(2) { animation-delay: .15s; }
.puntos i:nth-child(3) { animation-delay: .3s; }
@keyframes rebote { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Tarjetas dentro de la conversación */
.tarjeta-chat {
  background: #fff; border: 1px solid var(--linea); border-radius: 14px;
  padding: 12px 14px; max-width: min(88%, 520px); margin-left: 40px;
  animation: aparecer .22s ease-out; font-size: 14px;
}
.tarjeta-chat h3 { margin: 0 0 6px; font-size: 14px; color: var(--verde-osc); }
.tarjeta-chat p { margin: 0; color: #2B352B; }
.tarjeta-chat a { color: var(--verde-medio); font-weight: 700; }

.resumen { width: 100%; border-collapse: collapse; font-size: 14px; }
.resumen th { text-align: left; font-weight: 600; color: var(--gris); padding: 6px 8px 6px 0; vertical-align: top; width: 34%; font-size: 13px; }
.resumen td { padding: 6px 0; vertical-align: top; font-weight: 600; overflow-wrap: anywhere; }
.resumen tr + tr th, .resumen tr + tr td { border-top: 1px solid #F0F3F0; }
.resumen .cambiar {
  background: none; border: 0; color: var(--verde-medio); font-weight: 700; font-size: 12.5px;
  cursor: pointer; padding: 2px 0 2px 8px; white-space: nowrap; font-family: inherit;
}
.resumen .cambiar:hover { text-decoration: underline; }
.resumen td.accion { width: 1%; text-align: right; }

.folio { font-family: ui-monospace, Consolas, monospace; font-weight: 800; color: var(--verde-osc); letter-spacing: .5px; }

/* Archivo */
.archivo {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: 10px 12px;
}
.yo .burbuja .archivo { background: rgba(255,255,255,.6); border-color: transparent; padding: 6px 8px; }
.icono-pdf {
  width: 36px; height: 42px; border-radius: 6px; background: var(--rojo); color: #fff; flex: none;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
}
.archivo-datos { min-width: 0; flex: 1; }
.archivo-nombre { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archivo-peso { font-size: 12px; color: var(--gris); }
.avance { height: 5px; background: var(--linea); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.avance > i { display: block; height: 100%; width: 0; background: var(--verde); transition: width .15s; }

/* ── Composer (zona de respuesta) ───────────────────────── */
.composer {
  flex: none;
  background: #F7F9F6;
  border-top: 1px solid var(--linea);
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
  max-height: 55%;
  overflow-y: auto;
}
.composer:empty { display: none; }

.linea-entrada { display: flex; gap: 8px; align-items: center; }
.linea-entrada input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 16px; /* 16px evita el zoom automático en iPhone */
  padding: 12px 16px; border-radius: 999px;
  border: 1px solid var(--verde-borde); background: #fff; color: var(--tinta);
  outline: none;
}
.linea-entrada input:focus { border-color: var(--verde); box-shadow: 0 0 0 3px rgba(0, 181, 0, .15); }
.linea-entrada input[aria-invalid="true"] { border-color: var(--rojo); box-shadow: 0 0 0 3px rgba(216, 38, 43, .12); }

.enviar {
  width: 48px; height: 48px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  background: var(--verde-medio); color: #fff; display: grid; place-items: center;
}
.enviar:hover { background: var(--verde-osc); }
.enviar:disabled { background: #B7C4B7; cursor: default; }

.aviso-entrada { font-size: 13px; color: var(--rojo); padding: 0 8px; min-height: 0; }
.aviso-entrada:empty { display: none; }
.ayuda { font-size: 12.5px; color: var(--gris); padding: 0 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14.5px; font-weight: 600;
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--verde-borde); background: #fff; color: var(--verde-osc);
  text-align: left;
}
.chip:hover { border-color: var(--verde); background: var(--verde-claro); }
.chip.sugerido { border-color: var(--verde); background: var(--verde-claro); }
.chip.secundario { color: var(--gris); border-style: dashed; }
.chip.chica { font-size: 13px; padding: 6px 12px; }

.boton {
  font: inherit; font-weight: 700; font-size: 15.5px;
  padding: 13px 18px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--verde-medio); color: #fff; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.boton:hover { background: var(--verde-osc); }
.boton:disabled { background: #B7C4B7; cursor: default; }
.boton.claro { background: #fff; color: var(--verde-osc); border: 1.5px solid var(--verde-borde); }
.boton.claro:hover { background: var(--verde-claro); }
.botones { display: flex; gap: 8px; }
.botones .boton { flex: 1; }

.aviso-privacidad { font-size: 12.5px; color: var(--gris); text-align: center; }
.aviso-privacidad a { color: var(--verde-medio); }

.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

:focus-visible { outline: 3px solid rgba(0, 181, 0, .45); outline-offset: 2px; }
.tarjeta-chat .enlace-aviso { margin-top: 6px; }

/* ── Vacantes publicadas ────────────────────────────────── */
.vacantes { display: flex; flex-direction: column; gap: 8px; }
.vacante {
  display: flex; align-items: stretch; gap: 0;
  background: #fff; border: 1.5px solid var(--verde-borde); border-radius: 14px; overflow: hidden;
}
.vacante.sugerida { border-color: var(--verde); background: var(--verde-claro); }
.vacante-elegir {
  flex: 1; min-width: 0; text-align: left; font: inherit; cursor: pointer;
  background: none; border: 0; padding: 11px 14px; color: var(--verde-osc);
  display: flex; flex-direction: column; gap: 1px;
}
.vacante-elegir:hover { background: var(--verde-claro); }
.vacante-titulo { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.vacante-region { font-size: 12.5px; color: var(--gris); }
.vacante-info {
  flex: none; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  background: #F3F8F3; color: var(--verde-medio); border: 0; border-left: 1px solid var(--verde-borde); padding: 0 12px;
}
.vacante-info:hover { background: var(--verde-borde); }

/* ── Hoja de detalle de la vacante ──────────────────────── */
.hoja-fondo {
  position: fixed; inset: 0; z-index: 40; background: rgba(10, 25, 10, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.hoja {
  width: 100%; max-width: 560px; max-height: 88dvh; background: #fff;
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); animation: subir .22s ease-out;
}
@media (min-width: 800px) {
  .hoja-fondo { align-items: center; }
  .hoja { border-radius: 18px; max-height: 80dvh; }
}
@keyframes subir { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hoja { animation: none; } }
.hoja-cabeza { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 10px; }
.hoja-cabeza > div { flex: 1; min-width: 0; }
.hoja-cabeza h3 { margin: 0; font-size: 18px; color: var(--verde-osc); overflow-wrap: anywhere; }
.hoja-region { font-size: 13px; color: var(--gris); margin-top: 2px; }
.hoja-cerrar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: #EEF3EE; color: var(--gris); font-size: 14px;
}
.hoja-cuerpo { overflow-y: auto; padding: 0 18px 8px; display: flex; flex-direction: column; gap: 14px; }
.hoja-descripcion { margin: 0; white-space: pre-line; overflow-wrap: anywhere; color: #2B352B; }
.hoja-seccion h4 {
  margin: 0 0 6px; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--verde-medio);
}
.hoja-seccion ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.hoja-seccion li { overflow-wrap: anywhere; }
.hoja-pie { padding: 12px 18px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--linea); }
