/* RESET Y BODY */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Inter", sans-serif;
  background: #f5f7fa url('../images/fondo.jpeg') no-repeat center center fixed;
  background-size: cover;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* CONTENEDOR PRINCIPAL */
.chat-container {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ÁREA DE MENSAJES */
.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* BURBUJAS */
.message {
  position: relative;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 15px;
  word-wrap: break-word;
  max-width: 100%;
}
.message.bot {
  background: #e8f0fe;
  color: #1a3db8;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 16px;
}
.message.user {
  background: #0052cc;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 16px;
}

/* TABLA DE PRESUPUESTO: filas flex y forzado */
.message.bot table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.message.bot table tr {
  display: flex !important;
  justify-content: space-between;
  padding: 6px 0;
}
.message.bot table td {
  /* Solo usamos los dos primeros td de cada fila */
  flex: 1 1 auto;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.message.bot table tr td:first-child {
  /* texto a la izquierda */
  text-align: left;
}
.message.bot table tr td:last-child {
  /* precio a la derecha */
  text-align: right;
  flex: 0 0 auto;
}

/* INPUT Y BOTONES */
.input-container {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: #f1f3f5;
}
.input-container input#user-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 15px;
}
.input-container button#send-button {
  flex-shrink: 0;
  padding: 12px 16px;
  background: #0052cc;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  box-shadow: 0 4px 8px rgba(0,82,204,0.2);
  transition: background 0.2s;
}
.input-container button#send-button:hover {
  background: #003ea5;
}

/* BOTONES DE ACCIÓN */
/* BOTONES DE ACCIÓN: verticales, misma anchura y separación */
.show-buttons-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;     /* separación vertical uniforme */
  margin: 16px 0;
}

.action-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background: #0052cc;
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 10px 0;     /* mismo padding arriba/abajo */
  width: 100%;         /* ocupan toda la anchura posible */
  max-width: 220px;    /* límite para pantallas grandes */
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,82,204,0.2);
  transition: background 0.2s, transform 0.1s;
}
.action-button:hover {
  background: #003ea5;
}
.action-button:active {
  transform: translateY(1px);
}

/* MODAL INICIAL */
.modal {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 1000;
}
.modal.active {
  visibility: visible;
  opacity: 1;
}
.modal-content {
  position: relative;
  width: 90%;
  max-width: 600px;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.modal-content #intro-player {
  width: 100%;
  height: 100%;
}
.modal-content .close {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 24px; color: #fff;
  cursor: pointer;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* BOTÓN FULLSCREEN */
#intro-fullscreen {
  position: absolute;
  bottom: 12px; right: 12px;
  background: rgba(255,255,255,0.8);
  color: #0052cc;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,82,204,0.2);
  z-index: 10;
}
#intro-fullscreen:hover {
  background: rgba(255,255,255,1);
}

/* SCROLLBAR PERSONALIZADO */
.chat-box::-webkit-scrollbar {
  width: 6px;
}
.chat-box::-webkit-scrollbar-thumb {
  background: rgba(0,82,204,0.4);
  border-radius: 3px;
}
.chat-box::-webkit-scrollbar-track {
  background: transparent;
}
/* Centrar los dos últimos párrafos con teléfono en todas las pantallas */
.message.bot p:nth-last-of-type(2),
.message.bot p:last-of-type {
  text-align: center;
}
/* RESPONSIVE */
@media (max-width: 480px) {
  .chat-container {
    margin: 10px;
    max-width: 100%;
    max-height: 100vh;
  }
  .modal-content {
    width: 100%;
    max-width: none;
    border-radius: 0;
  }
  #intro-fullscreen {
    bottom: 8px; right: 8px;
    padding: 4px 8px; font-size: 12px;
  }
  /* En móvil, permitir cortes suaves dentro de los textos */
  .message { word-break: break-word; }
}
/* Ajustes para el vídeo de UCaaS en la última pregunta */
#ucaas-video {
  width: 100% !important;      /* que nunca sobrepase el 100% del contenedor */
  max-width: 300px;            /* opcional: límite de ancho en escritorio */
  height: auto !important;     /* conserva la proporción */
  aspect-ratio: 16/9;          /* refuerza la relación 16:9 */
  display: block;
  margin: 0 auto 8px;          /* centrado y separador inferior */
}

/* Asegura que el contenedor no se estreche */
#ucaas-video + p {
  margin-top: 0;
}

