/* ===== ESTILOS GENERALES DEL SITIO ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
}

/* ===== HEADER ===== */
.site-header {
  background: linear-gradient(135deg, #663399 0%, #8a2be2 100%);
  color: white;
  padding: 2rem 0;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.header-logo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid white;
}

.logo-container h1 {
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header-subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 300;
}

/* ===== CONTENIDO PRINCIPAL ===== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.welcome-section {
  text-align: center;
  margin-bottom: 3rem;
}

.welcome-section h2 {
  font-size: 2.5rem;
  color: #663399;
  margin-bottom: 1rem;
  font-weight: 600;
}

.welcome-section > p {
  font-size: 1.2rem;
  color: #666;
  max-width: 800px;
  margin: 0 auto 3rem;
  line-height: 1.8;
}

/* ===== GRID DE CARACTERÍSTICAS ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.feature-card {
  background: white;
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: center;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  color: #663399;
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.feature-card p {
  color: #666;
  line-height: 1.6;
}

/* ===== SECCIÓN CTA ===== */
.cta-section {
  background: white;
  padding: 3rem;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  text-align: center;
  margin-bottom: 3rem;
}

.cta-section p {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 2rem;
}

.cta-button {
  background: linear-gradient(135deg, #663399 0%, #8a2be2 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 5px 15px rgba(102, 51, 153, 0.3);
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 51, 153, 0.4);
}

.cta-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid white;
}

/* ===== FOOTER ===== */
.site-footer {
  background: #333;
  color: white;
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-content p {
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.footer-content p:last-child {
  margin-bottom: 0;
  font-size: 0.9rem;
  opacity: 0.6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .logo-container h1 {
    font-size: 2rem;
  }
  
  .welcome-section h2 {
    font-size: 2rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .main-content {
    padding: 2rem 1rem;
  }
  
  .cta-section {
    padding: 2rem 1.5rem;
  }
}

/* ===== ESTILOS EXISTENTES DEL CHATBOT ===== */
.hidden {
  display: none !important;
}

#chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 100%;
  max-width: 380px;
  height: min(85vh, 850px);
  display: flex;
  flex-direction: column;
  background-color: #f9f9f9;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 10000;
  transition: all 0.3s ease;
}

/* En pantallas de poca altura (desktop), priorizar que el header siempre sea visible */
@media (max-height: 800px) and (min-width: 769px) {
  #chatbot-container {
    top: 10px;
    bottom: 10px;
    height: calc(100vh - 20px);
  }
}

@media (max-width: 768px) {
  #chatbot-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100dvh;
    max-width: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    z-index: 10000;
  }
  
  #chat-bubble {
    display: block !important;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
  }
  
  /* Solo ocultar la burbuja cuando el chat está abierto */
  #chatbot-container:not(.hidden) ~ #chat-bubble {
    display: none !important;
  }
  
  #chat-header {
    border-radius: 0;
    padding: 15px 20px;
    background-color: #fafafa !important;
    color: #333 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: relative;
  }
  
  #chat-header span {
    color: #333 !important;
    font-weight: 600;
    flex: 1;
    margin-right: 10px;
    display: flex !important;
    align-items: center !important;
  }
  
  #new-chat-button {
    color: #333 !important;
    font-size: 16px !important;
    padding: 6px 8px !important;
    margin-left: 8px !important;
    background: #f0f0f0 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    display: inline-block !important;
    vertical-align: middle;
    cursor: pointer !important;
    position: relative !important;
    z-index: 10001 !important;
    transition: all 0.2s ease !important;
  }
  
  #new-chat-button:hover {
    background-color: #e0e0e0 !important;
    transform: scale(1.05) !important;
  }
  
  .close-chat-btn {
    display: inline-block !important;
    background: #f0f0f0 !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
    font-size: 14px !important;
    margin-left: 8px !important;
    cursor: pointer !important;
    padding: 6px 8px !important;
    font-weight: bold !important;
    position: relative !important;
    z-index: 10001 !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
  }
  
  .close-chat-btn:hover {
    background-color: #e0e0e0 !important;
    transform: scale(1.05) !important;
  }
  
  #chat-log {
    flex: 1;
    padding: 15px 20px;
    background-color: white;
  }
  
  #chat-form {
    padding: 15px 20px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
  }
  
  .bot-message {
    margin-bottom: 15px;
    padding: 12px 16px;
  }
  
  .user-message {
    margin-bottom: 15px;
    padding: 12px 16px;
  }
}

@media (max-width: 420px) {
  #chatbot-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100dvh;
    max-width: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    z-index: 10000;
  }
  
  #chat-bubble {
    display: block !important;
    bottom: 15px;
    right: 15px;
    width: 55px;
    height: 55px;
  }
  
  /* Solo ocultar la burbuja cuando el chat está abierto */
  #chatbot-container:not(.hidden) ~ #chat-bubble {
    display: none !important;
  }
  
  #chat-header {
    border-radius: 0;
    padding: 12px 15px;
    background-color: #fafafa !important;
    color: #333 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: relative;
  }
  
  #chat-header span {
    color: #333 !important;
    font-weight: 600;
    flex: 1;
    margin-right: 10px;
  }
  
  #new-chat-button {
    color: #333 !important;
    font-size: 14px !important;
    padding: 5px 7px !important;
    margin-left: 6px !important;
    background: #f0f0f0 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    display: inline-block !important;
    vertical-align: middle;
    cursor: pointer !important;
    position: relative !important;
    z-index: 10001 !important;
    transition: all 0.2s ease !important;
  }
  
  #new-chat-button:hover {
    background-color: #e0e0e0 !important;
    transform: scale(1.05) !important;
  }
  
  .close-chat-btn {
    display: inline-block !important;
    background: #f0f0f0 !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
    font-size: 12px !important;
    margin-left: 6px !important;
    cursor: pointer !important;
    padding: 5px 7px !important;
    font-weight: bold !important;
    position: relative !important;
    z-index: 10001 !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
  }
  
  .close-chat-btn:hover {
    background-color: #e0e0e0 !important;
    transform: scale(1.05) !important;
  }
  
  #chat-log {
    flex: 1;
    padding: 12px 15px;
    background-color: white;
  }
  
  #chat-form {
    padding: 12px 15px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
  }
  
  .bot-message {
    margin-bottom: 12px;
    padding: 10px 14px;
  }
  
  .user-message {
    margin-bottom: 12px;
    padding: 10px 14px;
  }
}

#chat-header {
  background-color: #fafafa;
  color: #333;
  padding: 12px 8px;
  font-weight: 500;
  font-size: 16px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  border-bottom: 1px solid #e0e0e0;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
}

#chat-header span {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-left: 0;
  padding-left: 0;
  color: #333;
}

#chat-header::before {
  content: "";
  width: 40px;
  height: 40px;
  background-image: url('../images/Logo UC Christus_1752870432321.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 50%;
  border: 1px solid #663399;
  margin-right: 0;
}

#new-chat-button {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #666;
  cursor: pointer;
  transition: color 0.3s ease;
  margin-left: auto;
}



.close-chat-btn {
  display: none;
}





#new-chat-button:hover {
  color: #333;
}


#chat-log {
  flex-grow: 1;
  overflow-y: auto;
  min-height: 0; /* permite que el área scrollable se ajuste en contenedores pequeños */
  padding: 10px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
}

/* Bot */
.bot-message {
  align-self: flex-start;
  margin-bottom: 10px;
  padding: 12px 16px;
  border-radius: 20px;
  background-color: rgba(228, 228, 231, 0.5);
  color: #3f3f46;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.25;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", "Helvetica Neue", Arial, sans-serif !important;
  text-align: left;
  word-wrap: break-word;
  hyphens: auto;
  white-space: normal;
  text-wrap: wrap;
  break-words: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-smooth: always;
}

.bot-message strong {
  display: block;
  font-weight: 600;
  margin-bottom: 0;
  font-size: 14px;
  color: #09090b;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

/* Estilos para texto en negrita dentro del contenido del mensaje */
.bot-message div strong {
  display: inline;
  font-weight: 600;
  color: #3f3f46;
}

/* Mejorar espaciado de listas y párrafos */
.bot-message div {
  white-space: normal;
  line-height: 1.25;
  font-size: 14px;
  color: #3f3f46;
  letter-spacing: -0.01em;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", "Helvetica Neue", Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-smooth: always;
}

.bot-message div p {
  margin: 0 0 8px 0;
}

.bot-message div ol,
.bot-message div ul {
  margin: 8px 0;
  padding-left: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", "Helvetica Neue", Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bot-message div ol li {
  display: list-item;
  list-style-type: none;
}

.bot-message div li {
  margin-bottom: 4px;
  line-height: 1.25;
  display: list-item;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", "Helvetica Neue", Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-left: 0;
}

/* Estilos específicos para bullets con puntos grises */
.bot-message div ul {
  list-style-type: none !important;
  margin-left: 0 !important;
  padding-left: 0 !important;
}

.bot-message div ul li {
  position: relative !important;
  padding-left: 24px !important;
  margin-bottom: 8px !important;
  line-height: 1.5 !important;
  list-style-type: none !important;
}

.bot-message div ul li::before {
  content: "•" !important;
  color: #6b7280 !important;
  font-size: 18px !important;
  position: absolute !important;
  left: 8px !important;
  top: -2px !important;
  display: block !important;
  font-weight: bold !important;
}

/* Estilos para listas numeradas */
.bot-message div ol {
  list-style-type: none !important;
  margin-left: 0 !important;
  padding-left: 0 !important;
}

.bot-message div ol li {
  margin-bottom: 12px !important;
  line-height: 1.4 !important;
  padding-left: 0 !important;
  list-style-type: none !important;
}

.bot-message div ol li strong {
  font-weight: 600 !important;
  color: #3f3f46 !important;
}

/* Estilos para bullets con guiones dentro de listas numeradas */
.bot-message div ol li br + strong:before {
  content: "• ";
  color: #6b7280;
  margin-right: 4px;
}

.bot-message div ol li br + strong {
  display: block;
  margin-top: 4px;
  margin-left: 16px;
  font-weight: 600;
}

.bot-message div br {
  display: block;
  margin-bottom: 4px;
}

/* Eliminamos el pseudo-elemento ya que ahora usamos una imagen real */

/* Usuario */
.user-message {
  background-color: #007bff;
  color: #fff;
  max-width: 80%;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 18px;
  align-self: flex-end;
  position: relative;
  white-space: pre-wrap;
}

#chat-form {
  display: flex;
  border-top: 1px solid #ddd;
  background-color: #fff;
}

#chat-input {
  flex-grow: 1;
  padding: 10px;
  border: none;
  border-radius: 0;
  font-size: 14px;
}

#chat-input:focus {
  outline: none;
}

/* Deshabilitar autocompletado del navegador */
#chat-input:-webkit-autofill,
#chat-input:-webkit-autofill:hover,
#chat-input:-webkit-autofill:focus,
#chat-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px white inset !important;
  -webkit-text-fill-color: #333 !important;
}

/* Ocultar sugerencias de autocompletado */
#chat-input::-webkit-calendar-picker-indicator {
  display: none !important;
}

/* Deshabilitar completamente el autocompletado */
#chat-input::-webkit-contacts-auto-fill-button,
#chat-input::-webkit-credentials-auto-fill-button {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Deshabilitar historial de formulario */
#chat-form {
  autocomplete: off;
}

#chat-form button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-form button::before {
  content: "";
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

#chat-form button:hover {
  background-color: #0056b3;
}

#chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-image: url('../images/Logo UC Christus_1752870432321.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid #663399;
    transition: all 0.3s ease;
    overflow: hidden;
}

#chat-bubble.open {
  background-image: none !important;
  background-color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #333;
}

#chat-bubble.open::after {
  content: "";
  width: 24px;
  height: 24px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2.3' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: #999;
  font-style: italic;
  font-size: 14px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #999;
  border-radius: 50%;
  animation: blink 1.2s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

.bot-message ul {
  margin: 10px 0;
  padding-left: 20px;
}

.bot-message li {
  margin-bottom: 5px;
}

.bot-message strong {
  font-weight: bold;
}

.bot-message em {
  font-style: italic;
}

.bot-message br {
  margin-bottom: 5px;
}

.loader {
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #663399;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 10px auto;
}

.loader::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-top-color: #663399;
  border-radius: 50%;
  animation: spin 1s linear infinite reverse;
}

#chat-log:empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-style: italic;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.typing-indicator-bubble {
  align-self: flex-start;
  margin-bottom: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  background-color: #f1f1f1;
  color: #333;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  position: relative;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #999;
  font-style: italic;
  font-size: 14px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #999;
  border-radius: 50%;
  animation: blink 1.2s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}