/* =============================================
   MÓDULO DE VALORACIÓN FÍSICA - Nubifit
   ============================================= */

.vf-modulo {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem;
}

.vf-hero {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.vf-hero p {
  color: var(--color-texto-secundario);
  max-width: 720px;
  margin: 0.35rem 0 0;
  line-height: 1.5;
}

.vf-eyebrow {
  display: inline-block;
  color: var(--color-primario);
  font-weight: 800;
  letter-spacing: 0.13em;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.vf-nota {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  margin: 1.25rem 0;
  padding: 0.95rem 1.15rem;
  border: 1px solid #cfe0ff;
  background: linear-gradient(180deg, #f6f9ff 0%, #eef4ff 100%);
  border-radius: var(--radio-lg);
}

.vf-nota i,
.vf-nota svg {
  color: var(--color-primario);
  flex: 0 0 auto;
  margin-top: 0.1rem;
}

.vf-nota p,
.vf-campo-sub,
.vf-publicar > p {
  margin: 0.2rem 0 0;
  color: var(--color-texto-secundario);
  font-size: 0.86rem;
  line-height: 1.45;
}

.vf-controles {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 1rem 0 1.25rem;
}

.vf-controles label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 240px;
  border: 1px solid var(--color-borde);
  padding: 0 0.85rem;
  border-radius: var(--radio-md);
  background: var(--color-superficie);
  transition: border-color var(--transicion-base), box-shadow var(--transicion-base);
}

.vf-controles label:focus-within {
  border-color: var(--color-primario);
  box-shadow: 0 0 0 3px var(--color-primario-light);
}

.vf-controles input,
.vf-controles select {
  border: 0;
  background: transparent;
  padding: 0.7rem 0.25rem;
  width: 100%;
  outline: 0;
  font-size: 0.9rem;
  color: var(--color-texto-principal);
}

.vf-controles > select {
  width: auto;
  min-width: 210px;
  border: 1px solid var(--color-borde);
  padding: 0.7rem 0.85rem;
  border-radius: var(--radio-md);
  background: var(--color-superficie);
}

/* Listado de expedientes */
.vf-lista {
  display: grid;
  gap: 0.85rem;
}

.vf-card {
  background: var(--color-superficie);
  border: 1px solid var(--color-borde);
  border-radius: var(--radio-lg);
  padding: 1.15rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.25rem;
  align-items: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vf-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 8px 22px rgba(15, 39, 92, 0.06);
}

.vf-card h2 {
  font-size: 1.08rem;
  margin: 0.25rem 0 0.2rem;
  color: var(--color-texto-principal);
}

.vf-card p {
  margin: 0.2rem 0 0.45rem;
  color: var(--color-texto-secundario);
  font-size: 0.92rem;
}

.vf-meta {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.83rem;
  color: var(--color-texto-secundario);
}

.vf-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.vf-acciones {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.vf-cargando,
.vf-vacio {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--color-texto-secundario);
  background: var(--color-superficie);
  border: 1px dashed var(--color-borde);
  border-radius: var(--radio-lg);
}

.vf-cargando-expediente {
  min-height: 13rem;
  display: grid;
  place-content: center;
  gap: 0.6rem;
}

.vf-cargando-expediente strong {
  color: var(--color-texto-principal);
}

.vf-cargando-expediente span {
  font-size: 0.88rem;
}

.vf-paginacion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-borde);
  border-radius: var(--radio-lg);
  background: var(--color-superficie);
}

.vf-paginacion p {
  margin: 0;
  color: var(--color-texto-secundario);
  font-size: 0.86rem;
}

.vf-btn-peligro {
  color: #b42318;
  border-color: #fecaca;
  background: #fffafa;
}

.vf-btn-peligro:hover {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* =============================================
   MODAL DE VALORACIÓN FÍSICA (ALINEACIÓN Y PASOS)
   ============================================= */

.vf-modal {
  width: min(880px, calc(100vw - 24px)) !important;
  max-width: min(880px, calc(100vw - 24px)) !important;
  max-height: min(92dvh, 880px) !important;
  overflow: hidden;
}

.vf-expediente-modal {
  width: min(960px, calc(100vw - 24px)) !important;
  max-width: min(960px, calc(100vw - 24px)) !important;
  max-height: min(92dvh, 880px) !important;
  overflow: hidden;
}

.vf-modal-header {
  padding: 1.1rem 1.5rem;
  background: #ffffff;
}

.vf-modal-header h3 {
  margin: 0.15rem 0 0;
  font-size: 1.25rem;
  font-weight: 700;
}

/* Barra de pasos */
.vf-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--color-borde);
  background: #f8fafc;
  flex-shrink: 0;
}

.vf-steps > span {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--color-texto-terciario);
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.vf-steps > span:hover {
  background: #eff6ff;
}

.vf-steps b {
  width: 1.85rem;
  height: 1.85rem;
  flex: 0 0 1.85rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  background: #e2e8f0;
  color: #475569;
  transition: all 0.2s ease;
}

.vf-step-texto {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.vf-step-texto strong {
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
}

.vf-step-texto small {
  font-size: 0.72rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vf-steps > span.completado b {
  background: #dbeafe;
  color: var(--color-primario);
}

.vf-steps > span.activo {
  background: #ffffff;
  border-color: #bfdbfe;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
}

.vf-steps > span.activo b {
  background: var(--color-primario);
  color: #ffffff;
}

.vf-steps > span.activo .vf-step-texto strong {
  color: var(--color-primario);
}

/* Cuerpo del formulario */
.vf-modal .modal-body,
.vf-expediente-modal .modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(92dvh - 210px);
}

.vf-panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.vf-panel.activo {
  display: flex;
}

.vf-panel-ayuda {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0.7rem 0.95rem;
  border-left: 3.5px solid var(--color-primario);
  border-radius: 0 10px 10px 0;
  background: #f4f8ff;
  color: #334155;
  font-size: 0.87rem;
  line-height: 1.4;
}

.vf-panel-ayuda i,
.vf-panel-ayuda svg {
  color: var(--color-primario);
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* Fieldsets y secciones del formulario */
.vf-campo,
.vf-publicar {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 12px;
  padding: 1rem 1.15rem 1.15rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.vf-campo legend,
.vf-publicar legend {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: #1e293b;
}

.vf-campo legend i,
.vf-campo legend svg,
.vf-publicar legend i,
.vf-publicar legend svg {
  width: 16px;
  height: 16px;
  color: var(--color-primario);
}

/* Grids alineados desde arriba para que ninguna fila desplace los inputs */
.vf-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem 1rem;
  align-items: start;
}

.vf-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vf-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.vf-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.vf-grid-2-1 {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.vf-grid-1-2 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}

.vf-separador-interno {
  padding-top: 0.85rem;
  border-top: 1px dashed #e2e8f0;
}

/* Cada campo individual: flex-column alineado al tope */
.vf-field,
.vf-form .grupo-form {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  margin: 0 !important;
  min-width: 0;
  align-self: start;
}

.vf-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
  min-height: 1.35rem;
}

.vf-label em {
  color: #dc2626;
  font-style: normal;
  font-weight: 700;
}

.vf-label small {
  color: #64748b;
  font-weight: 500;
  font-size: 0.76rem;
}

.vf-label i,
.vf-label svg {
  width: 15px;
  height: 15px;
  color: var(--color-primario);
  flex: 0 0 auto;
}

/* Altura uniforme para todos los inputs y selects de una línea */
.vf-form input.input-control,
.vf-form select.input-control {
  height: 2.65rem;
  min-height: 2.65rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.92rem;
  line-height: 1.25;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background-color: #ffffff;
  color: #0f172a;
}

.vf-form input.input-control[readonly] {
  background-color: #f8fafc;
  color: #334155;
  font-weight: 600;
}

.vf-form textarea.input-control {
  min-height: 4.5rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.45;
  resize: vertical;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

.vf-help {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: #64748b;
  line-height: 1.35;
  margin: 0;
}

/* Badge de IMC en Paso 2 */
.vf-imc-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  background: #f1f5f9;
  color: #475569 !important;
}

.vf-imc-badge.normal {
  background: #dcfce7;
  color: #15803d !important;
}

.vf-imc-badge.alerta {
  background: #fef3c7;
  color: #b45309 !important;
}

.vf-imc-badge.alto {
  background: #fee2e2;
  color: #b91c1c !important;
}

/* Cajas de notas en Paso 3 */
.vf-caja-nota {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: #ffffff;
}

.vf-caja-nota .vf-label {
  justify-content: flex-start;
}

.vf-caja-privada {
  background: #fffbeb;
  border-color: #fde68a;
}

.vf-caja-privada .vf-label i,
.vf-caja-privada .vf-label svg {
  color: #d97706;
}

/* Tarjetas de publicación en Mi Portal */
.vf-publicar-opciones {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.vf-check-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #dbe4f3;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.vf-check-card:hover {
  border-color: #93c5fd;
  background: #f0f7ff;
}

.vf-check-card:has(input:checked) {
  border-color: var(--color-primario);
  background: #eff6ff;
}

.vf-check-card input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-top: 0.15rem;
  accent-color: var(--color-primario);
  flex: 0 0 auto;
}

.vf-check-card div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.vf-check-card strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}

.vf-check-card small {
  font-size: 0.72rem;
  font-weight: 400;
  color: #64748b;
  line-height: 1.25;
}

/* Footer del modal */
.vf-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
}

.vf-footer-acciones {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.modal-footer [hidden] {
  display: none !important;
}

/* =============================================
   MODAL EXPEDIENTE FÍSICO (LÍNEA DE TIEMPO ADMIN)
   ============================================= */

.vf-expediente-resumen {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.vf-expediente-resumen div {
  background: #f5f8ff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}

.vf-expediente-resumen span {
  display: block;
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vf-expediente-resumen strong {
  display: block;
  margin-top: 0.2rem;
  color: #102a5c;
  font-size: 0.95rem;
}

.vf-timeline {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-left: 1.75rem;
}

.vf-timeline::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 2px;
  background: linear-gradient(180deg, #2563eb 0%, #bfdbfe 100%);
}

.vf-evento {
  position: relative;
  border: 1px solid #dbe4f3;
  border-radius: 14px;
  background: #ffffff;
  padding: 1.05rem 1.2rem;
  box-shadow: 0 6px 18px rgba(15, 40, 82, 0.04);
}

.vf-evento::before {
  content: "";
  position: absolute;
  width: 0.82rem;
  height: 0.82rem;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 2px #93c5fd;
  left: -1.7rem;
  top: 1.25rem;
}

.vf-evento:first-child::before {
  background: #16a34a;
  box-shadow: 0 0 0 2px #86efac;
}

.vf-evento-cabecera {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.vf-evento h4 {
  margin: 0.35rem 0 0.2rem;
  color: #112a5c;
  font-size: 1.02rem;
}

.vf-evento p {
  margin: 0.35rem 0;
  color: #475569;
  line-height: 1.5;
  font-size: 0.9rem;
}

.vf-evento-datos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.vf-evento-datos span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: #f3f7ff;
  border: 1px solid #e0eaff;
  color: #34527f;
  font-size: 0.81rem;
}

.vf-evento-datos span strong {
  color: #0f275c;
}

.vf-evento-funcional {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.65rem 0;
}

.vf-evento-funcional div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.82rem;
}

.vf-evento-funcional small {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.15rem;
}

.vf-evento-privado {
  margin-top: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e !important;
  font-size: 0.83rem !important;
}

.vf-evento-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 780px) {
  .vf-modulo {
    padding: 0.85rem;
  }
  .vf-card {
    grid-template-columns: 1fr;
  }
  .vf-acciones {
    justify-content: flex-start;
  }
  .vf-grid,
  .vf-grid-2,
  .vf-grid-3,
  .vf-grid-4,
  .vf-grid-2-1,
  .vf-grid-1-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vf-publicar-opciones {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vf-expediente-resumen {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .vf-evento-funcional {
    grid-template-columns: 1fr;
  }
  .vf-modal,
  .vf-expediente-modal {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
  }
  .vf-modal .modal-body,
  .vf-expediente-modal .modal-body {
    padding: 1rem;
    max-height: calc(100dvh - 190px);
  }
}

@media (max-width: 520px) {
  .vf-paginacion {
    align-items: stretch;
    flex-direction: column;
  }

  .vf-paginacion .btn {
    width: 100%;
  }
  .vf-grid,
  .vf-grid-2,
  .vf-grid-3,
  .vf-grid-4,
  .vf-grid-2-1,
  .vf-grid-1-2,
  .vf-publicar-opciones,
  .vf-expediente-resumen {
    grid-template-columns: 1fr;
  }
  .vf-steps {
    padding: 0.65rem 0.75rem;
    gap: 0.35rem;
  }
  .vf-step-texto small {
    display: none;
  }
  .vf-modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .vf-footer-acciones {
    width: 100%;
  }
  .vf-footer-acciones .btn,
  .vf-modal-footer > .btn {
    flex: 1;
    width: 100%;
  }
}
