/* === ESTILOS GENERALES === */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.5rem 1rem;
}

.logo img {
  height: 120px;
  max-height: 15vh;
  min-height: 80px;
}

.language {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.language span {
  cursor: pointer;
  transition: all 0.2s ease;
}

.language span:hover,
.language .active {
  font-weight: bold;
  text-decoration: underline;
}

main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
}

/*Interlineado aviso legal*/
.legal-container {
  line-height: 1.8;
}


/* === BOTONES === */
/* Estilos para los grupos de botones en todas las vistas */
.button-group {
  display: flex;
  /* Convierte el grupo en un contenedor flexible */
  flex-wrap: wrap;
  /* Permite que los elementos pasen a la siguiente línea si no caben */
  justify-content: center;
  /* Centra los botones dentro de su grupo */
  gap: 0.2rem;
  /* Espacio entre los botones */
  margin-bottom: 1rem;
  /* Espacio debajo de cada grupo de botones */
}

.button {
  background-color: #b6d1ec;
  border: none;
  padding: 1rem 2rem;
  margin: 0.5rem 0;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  border-radius: 10px;
  min-width: 100px;
  text-decoration: none;
  /* Quita el subrayado */
  color: inherit;
  /* Usa el color de texto del padre (habitualmente negro) */
  display: inline-block;
  /* Permite aplicar padding y dimensiones */
  text-align: center;
  /* Centra el texto horizontalmente */
}

.button:visited {
  color: inherit;
  /* Evita cambio de color al visitar */
}

.home-button {
  display: block;
  min-width: 240px;
  margin: 0.5rem auto;
  /* centrado horizontal */
  text-align: center;
}


/* === FOOTER === */
footer {
  display: flex;
  justify-content: center;
  padding: 0.5rem;
  margin-top: auto;
  /* Para empujar el footer hacia abajo */
  flex-direction: column;
  /* Apilar iconos arriba, enlaces abajo */
  align-items: center;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  width: 50%;
  max-width: 300px;
}

.footer-content img {
  cursor: pointer;
  height: 32px;
}

/* Nuevos estilos para los enlaces legales */
.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  /* Separación de los iconos */
  padding: 8px 20px;
  font-size: 12px;
  width: 100%;
}

.footer-links a {
  color: #6b7280;
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 4px 8px;
}

.footer-links a:hover {
  color: #2563eb;
  text-decoration: underline;
}

.footer-links span {
  color: #d1d5db;
  font-weight: 300;
}

/* Responsive para móviles */
@media (max-width: 480px) {
  .footer-links {
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
  }

  .footer-links span {
    display: none;
    /* Ocultar separadores en móvil */
  }
}

/* === MEDICATIONS.HTML - ESTILOS ESPECÍFICOS === */
.filter-container {
  margin: 1rem auto;
  max-width: 600px;
  text-align: center;
}

#med-filter {
  width: 100%;
  max-width: 300px;
  padding: 0.5rem;
  font-size: 1rem;
}

.filter-section {
  margin: 1rem auto;
  max-width: 800px;
  padding: 1rem;
  text-align: center;
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.filter-tag {
  background-color: #e0e0e0;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
  transition: all 0.2s ease-in-out;
}

.filter-tag.active {
  background-color: #90c5f0;
  font-weight: bold;
}

.treatment-group {
  border-radius: 10px;
  padding: 1rem;
  box-sizing: border-box;
  margin: 0 auto;
}

.treatment-class-title {
  display: inline-block;
  font-size: 1.8rem;
  font-weight: bold;
  margin-bottom: 1rem;
  border-bottom: 2px solid #3498db;
  padding-bottom: 0.3rem;
  width: 320px;
  text-align: center;
}


/* === SCORES.HTML - ESTILOS ESPECÍFICOS === */
.scores {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
  padding-top: 1rem;
  margin: 0 auto;
  /* Centrar en pantalla ancha */
  /* ... otras reglas ... */
  align-items: center;
  /* ¡Esto alinea las columnas arriba! */
  text-align: center;
}

.disease {
  border-radius: 10px;
  padding: 1rem;
  box-sizing: border-box;
  /* para que el padding no agrande la caja */
  /* Añadido para asegurar que la tarjeta se centre si es más estrecha que el contenedor */
  margin: 0 auto;
}

.disease-title {
  display: inline-block;
  /* Para que text-align:center en el padre funcione */
  font-size: 1.8rem;
  font-weight: bold;
  margin-bottom: 1rem;
  border-bottom: 2px solid #3498db;
  /* línea debajo para separar */
  padding-bottom: 0.3rem;
  /* Ancho fijo para la línea */
  width: 320px;
  text-align: center;
  /* Para que la línea esté centrada bajo el texto */
}

/* === VISTA ESCRITORIO: DOS COLUMNAS === */
@media (min-width: 768px) {
  .scores {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .disease {
    flex: 1;
    margin: 0 1rem;
  }

  .button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    /* Centra los botones en cada fila */
    gap: 0.5rem;
  }

  .button {
    flex: 0 1 calc(50% - 0.5rem);
    max-width: 100%;
    padding: 1rem 1rem;
    text-align: center;

  }


}

/* Calculadoras */
.calculator {
  max-width: 600px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: #f9f9f9;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.05);
}

.calculator-title {
  font-size: 2.2rem;
  font-weight: bold;
  color: #2c3e50;
  text-align: center;
  margin-bottom: 2rem;
}

/* Calculadora UCEIS */
.uceis-group {
  margin-bottom: 2rem;
}

.group-title {
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.option-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.option-buttons button {
  padding: 0.6rem 1rem;
  border: 1px solid #ccc;
  border-radius: 999px;
  background: white;
  cursor: pointer;
  font-size: 1rem;
  transition: 0.2s;
}

.option-buttons button.active {
  background-color: #3498db;
  color: white;
  border-color: #2980b9;
}

.resultado-uceis {
  background-color: #ecf0f1;
  padding: 1rem;
  border-radius: 10px;
  font-size: 1.6rem;
  font-weight: bold;
  color: #2c3e50;
  margin-top: 2rem;
  text-align: center;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.05);
}

/* Calculadora Mayo */
.copy-btn {
  display: block;
  margin: 1rem auto 0;
  padding: 0.5rem 1.2rem;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.resultado-mayo {
  font-size: 1.6rem;
  font-weight: bold;
  text-align: center;
  color: #2c3e50;
  margin-top: 2rem;
}

/* Calculadora CDAI */
.cdai-group {
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
}

.cdai-group label {
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.cdai-group input[type="number"] {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}

.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

/* --- ESTILOS LIMPIOS Y CUADRADOS PARA INPUTS CDAI --- */
.cdai-grid input[type="number"] {
  width: 40px;
  height: 40px;
  border: 1.5px solid #bbb;
  border-radius: 6px;
  margin: 0 6px;
  text-align: center;
  font-size: 1.1rem;
  background: #fff;
  box-shadow: none;
  outline: none;
  transition: border 0.2s;
  padding: 0;
}

.cdai-grid input[type="number"]:focus {
  border: 1.5px solid #0077b6;
}

.cdai-item {
  margin-bottom: 2.5rem !important;
}

.cdai-item label {
  display: block;
  text-align: left;
  font-size: 1.08rem;
  font-weight: 500;
  margin-bottom: 0.7rem;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

.cdai-grid {
  margin-bottom: 0.2rem;
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}


/* Eliminar spin buttons de TODOS los inputs type="number" en CDAI */
.cdai-item input[type="number"]::-webkit-inner-spin-button,
.cdai-item input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cdai-item input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.cdai-grid input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Ajuste especial para el grid de peso */
.cdai-weight-row {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.cdai-weight-row label {
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 400;
  min-width: 110px;
  text-align: right;
}

.cdai-weight-row input[type="number"] {
  width: 70px;
  height: 40px;
  border: 1.5px solid #bbb;
  border-radius: 6px;
  text-align: center;
  font-size: 1.1rem;
  background: #fff;
  box-shadow: none;
  outline: none;
  transition: border 0.2s;
  padding: 0;
}

.input-error {
  border: 2px solid #e74c3c !important;
  background: #fdecea !important;
}

.input-error-msg {
  color: #e74c3c;
  font-size: 0.92em;
  margin-top: 2px;
  margin-bottom: 2px;
  font-weight: 500;
}

.cdai-radio-group {
  display: flex;
  gap: 18px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.cdai-radio-group label {
  font-weight: 400;
  font-size: 1rem;
}

/* Estilo general para todos los inputs de la calculadora CDAI */
.cdai-input {
  width: 70px;
  height: 40px;
  border: 1.5px solid #bbb;
  border-radius: 6px;
  text-align: center;
  font-size: 1.1rem;
  background: #fff;
  box-shadow: none;
  outline: none;
  transition: border 0.2s;
  padding: 0;
  margin: 0 6px 0 0;
  display: inline-block;
}

.cdai-input:focus {
  border: 1.5px solid #0077b6;
}

/* Para centrar el input de complicaciones debajo de los checkboxes */
#complications.cdai-input {
  display: inline-block;
  margin: 0 auto;
  text-align: center;
}

/* Para inputs en línea con el texto (antidiarreicos y hematocrito) */
.cdai-item label[for="antidiarrheals"],
.cdai-item label[for="hematocrit"] {
  vertical-align: middle;
  margin-right: 8px;
  font-weight: 500;
}

/* Opcional: para que los radios de sexo y masa abdominal estén alineados y con espacio */
.cdai-radio-group {
  display: flex;
  gap: 18px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.cdai-radio-group label {
  font-weight: 400;
  font-size: 1rem;
}

.cdai-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.cdai-row .cdai-label {
  min-width: 220px;
  margin-bottom: 0;
  text-align: left;
}

/* Botón no disponible/pulsable */
.button.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* === TOAST NOTIFICATION === */
.toast {
  text-align: center;
  font-style: italic;
  margin-top: 1rem;
  /* separación respecto al botón */
  color: #333;
  font-size: 0.95rem;
  display: none;
}

/* ========================================
   SISTEMA DE COOKIES 
   ======================================== */

/* Banner de cookies - CSS CORREGIDO */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 3px solid #2563eb;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  padding: 20px;
  z-index: 10000;
  transform: translateY(100%);
  /* Oculto por defecto */
  transition: transform 0.3s ease-in-out;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cookie-banner.show {
  transform: translateY(0);
  /* Visible con animación */
}

/* SOLO para casos donde realmente queremos ocultar completamente */
.cookie-banner.hidden {
  display: none !important;
}

/* Modal sigue igual */
.cookie-modal.hidden {
  display: none !important;
}

.cookie-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.cookie-text {
  flex: 1;
  min-width: 300px;
}

.cookie-text h4 {
  margin: 0 0 8px 0;
  color: #1e40af;
  font-size: 16px;
  font-weight: 600;
}

.cookie-text p {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.4;
}

.cookie-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.cookie-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  white-space: nowrap;
}

.btn-accept {
  background: #2563eb;
  color: white;
}

.btn-accept:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-essential {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-essential:hover {
  background: #e5e7eb;
}

.btn-config {
  background: transparent;
  color: #6b7280;
  text-decoration: underline;
  padding: 10px 8px;
}

.btn-config:hover {
  color: #374151;
}

/* Modal de configuración */
.cookie-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cookie-modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 30px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
  color: #1e40af;
  font-size: 18px;
  font-weight: 600;
}

.cookie-category {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fafafa;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.category-title {
  font-weight: 600;
  color: #374151;
  font-size: 15px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 24px;
  transition: 0.2s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}

input:checked+.slider {
  background-color: #2563eb;
}

input:checked+.slider:before {
  transform: translateX(20px);
}

input:disabled+.slider {
  opacity: 0.5;
  cursor: not-allowed;
}

input:disabled+.slider:before {
  background-color: #e5e7eb;
}

.category-description {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
  margin: 0;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 25px;
  border-top: 1px solid #e5e7eb;
  padding-top: 20px;
}


/* Estilos responsivos para cookies */
@media (max-width: 768px) {
  .cookie-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .cookie-actions {
    width: 100%;
    justify-content: space-between;
  }

  .cookie-btn {
    flex: 1;
    text-align: center;
    min-width: 0;
    font-size: 13px;
    padding: 8px 12px;
  }

  .modal-content {
    margin: 10px;
    padding: 20px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .cookie-btn {
    width: 100%;
  }

  .cookie-settings-btn {
    bottom: 15px;
    left: 15px;
    width: 45px;
    height: 45px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .cookie-banner {
    padding: 15px;
  }

  .cookie-text h4 {
    font-size: 15px;
  }

  .cookie-text p {
    font-size: 13px;
  }
}