/* ═══════════════════════════════════════════════════════════════
   KLINAFY - ESTILOS PARA PLAN DE TRATAMIENTO
   Estilos para el nuevo sistema de recomendaciones por planos
   con alternativas priorizadas
   
   CREADO: 1 Febrero 2026
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   CONTENEDOR PRINCIPAL DEL PLAN
   ═══════════════════════════════════════════════════════════════ */

.plan-tratamiento {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.plan-tratamiento-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
}

.plan-tratamiento-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.plan-tratamiento-header .plan-icono {
  font-size: 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   SECCIONES POR PLANO
   ═══════════════════════════════════════════════════════════════ */

.plano-seccion {
  background: white;
  border-radius: 12px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.plano-seccion:last-child {
  margin-bottom: 0;
}

/* Headers de cada plano */
.plano-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #3a5a8a 0%, #1b2d51 100%);
  color: white;
}

.plano-header.transversal {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.plano-header.sagital {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
}

.plano-header.vertical {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.plano-header.mantenimiento {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.plano-icono {
  font-size: 1.25rem;
}

.plano-nombre {
  font-weight: 600;
  font-size: 1rem;
}

.plano-problema {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-left: auto;
  font-weight: 400;
}

/* Contenido del plano */
.plano-contenido {
  padding: 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════
   GRUPOS DE TRATAMIENTO (dentro de cada plano)
   ═══════════════════════════════════════════════════════════════ */

.grupo-tratamiento {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed #e2e8f0;
}

.grupo-tratamiento:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.grupo-nombre {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.grupo-nombre::before {
  content: '';
  width: 4px;
  height: 16px;
  background: #3a5a8a;
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   APARATO RECOMENDADO (★)
   ═══════════════════════════════════════════════════════════════ */

.aparato-recomendado {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  position: relative;
}

.etiqueta-recomendado {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.aparato-recomendado .aparato-nombre-principal {
  font-size: 1.1rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 0.35rem;
}

.aparato-recomendado .aparato-motivo {
  font-size: 0.85rem;
  color: #78350f;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.aparato-recomendado .btn-ver-detalles {
  background: white;
  color: #92400e;
  border: 1px solid #f59e0b;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.aparato-recomendado .btn-ver-detalles:hover {
  background: #fffbeb;
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════
   ALTERNATIVAS (○)
   ═══════════════════════════════════════════════════════════════ */

.alternativas-container {
  margin-bottom: 1rem;
}

.etiqueta-alternativas {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.6rem;
}

.alternativas-lista {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.aparato-alternativa {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.aparato-alternativa:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.aparato-alternativa .alt-bullet {
  color: #3a5a8a;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.aparato-alternativa .alt-contenido {
  flex: 1;
  min-width: 0;
}

.aparato-alternativa .alt-nombre {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  display: block;
  margin-bottom: 0.2rem;
}

.aparato-alternativa .alt-motivo {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.3;
}

.aparato-alternativa .btn-ver-alt {
  background: transparent;
  color: #3a5a8a;
  border: none;
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.aparato-alternativa .btn-ver-alt:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   CONTRAINDICADOS (⛔)
   ═══════════════════════════════════════════════════════════════ */

.contraindicados-container {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.8rem 1rem;
}

.etiqueta-evitar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #dc2626;
  margin-bottom: 0.5rem;
}

.contraindicados-lista {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.aparato-contraindicado {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0;
}

.aparato-contraindicado .contra-bullet {
  color: #dc2626;
  flex-shrink: 0;
  margin-top: 2px;
}

.aparato-contraindicado .contra-nombre {
  font-size: 0.85rem;
  font-weight: 600;
  color: #991b1b;
}

.aparato-contraindicado .contra-motivo {
  font-size: 0.8rem;
  color: #b91c1c;
  margin-left: 0.3rem;
}

/* ═══════════════════════════════════════════════════════════════
   DISCLAIMER
   ═══════════════════════════════════════════════════════════════ */

.disclaimer-clinico {
  background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.disclaimer-icono {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.disclaimer-texto {
  font-size: 0.85rem;
  color: #92400e;
  line-height: 1.5;
}

.disclaimer-texto strong {
  color: #78350f;
}

/* ═══════════════════════════════════════════════════════════════
   ESTADO VACÍO (sin problemas en un plano)
   ═══════════════════════════════════════════════════════════════ */

.plano-vacio {
  text-align: center;
  padding: 1.5rem;
  color: #94a3b8;
}

.plano-vacio-icono {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.plano-vacio-texto {
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════
   RESUMEN COMPACTO (para vista rápida)
   ═══════════════════════════════════════════════════════════════ */

.plan-resumen-compacto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.resumen-plano-card {
  background: white;
  border-radius: 10px;
  padding: 1rem;
  border-left: 4px solid #3a5a8a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.resumen-plano-card.transversal {
  border-left-color: #3b82f6;
}

.resumen-plano-card.sagital {
  border-left-color: #8b5cf6;
}

.resumen-plano-card.vertical {
  border-left-color: #06b6d4;
}

.resumen-plano-card.mantenimiento {
  border-left-color: #10b981;
}

.resumen-plano-titulo {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.resumen-plano-aparato {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
}

.resumen-plano-alternativas {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════
   ANIMACIONES
   ═══════════════════════════════════════════════════════════════ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.plano-seccion {
  animation: fadeInUp 0.3s ease-out;
}

.plano-seccion:nth-child(1) { animation-delay: 0s; }
.plano-seccion:nth-child(2) { animation-delay: 0.1s; }
.plano-seccion:nth-child(3) { animation-delay: 0.2s; }
.plano-seccion:nth-child(4) { animation-delay: 0.3s; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .plan-tratamiento {
    padding: 1rem;
    border-radius: 12px;
  }

  .plano-header {
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
  }

  .plano-problema {
    width: 100%;
    margin-left: 0;
    margin-top: 0.5rem;
    font-size: 0.8rem;
  }

  .plano-contenido {
    padding: 1rem;
  }

  .aparato-recomendado {
    padding: 0.85rem 1rem;
  }

  .aparato-recomendado .aparato-nombre-principal {
    font-size: 1rem;
  }

  .aparato-alternativa {
    padding: 0.5rem 0.6rem;
  }

  .plan-resumen-compacto {
    grid-template-columns: 1fr;
  }

  .disclaimer-clinico {
    flex-direction: column;
    text-align: center;
  }

  .disclaimer-icono {
    margin-top: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TEMA OSCURO
   ═══════════════════════════════════════════════════════════════ */

[data-theme="dark"] .plan-tratamiento {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

[data-theme="dark"] .plano-seccion {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .grupo-nombre {
  color: #94a3b8;
}

[data-theme="dark"] .aparato-recomendado {
  background: linear-gradient(135deg, #422006 0%, #451a03 100%);
  border-color: #b45309;
}

[data-theme="dark"] .aparato-recomendado .aparato-nombre-principal {
  color: #fcd34d;
}

[data-theme="dark"] .aparato-recomendado .aparato-motivo {
  color: #fde68a;
}

[data-theme="dark"] .aparato-alternativa {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .aparato-alternativa .alt-nombre {
  color: #e2e8f0;
}

[data-theme="dark"] .aparato-alternativa .alt-motivo {
  color: #94a3b8;
}

[data-theme="dark"] .contraindicados-container {
  background: #450a0a;
  border-color: #7f1d1d;
}

[data-theme="dark"] .disclaimer-clinico {
  background: linear-gradient(135deg, #422006 0%, #451a03 100%);
  border-color: #b45309;
}

[data-theme="dark"] .disclaimer-texto {
  color: #fde68a;
}

[data-theme="dark"] .resumen-plano-card {
  background: #1e293b;
}

[data-theme="dark"] .resumen-plano-aparato {
  color: #f1f5f9;
}

/* ═══════════════════════════════════════════════════════════════
   IMPRESIÓN
   ═══════════════════════════════════════════════════════════════ */

@media print {
  .plan-tratamiento {
    background: white !important;
    box-shadow: none;
    padding: 0;
  }

  .plano-seccion {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .plano-header {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .aparato-recomendado {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .btn-ver-detalles,
  .btn-ver-alt {
    display: none;
  }
}
