/**
 * TakTek Chatbot - Estilos alineados con la estética del sitio
 * Colores: #ffc451 (acento), #151515 (oscuro), #444444 (texto)
 */

/* Botón flotante del chatbot */
.taktek-chat-toggle {
  position: fixed;
  bottom: 70px;
  right: 15px;
  z-index: 99998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffc451;
  color: #151515;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 20px rgba(255, 196, 81, 0.4);
  transition: all 0.3s ease;
}

.taktek-chat-toggle:hover,
.taktek-chat-toggle:focus {
  background: #ffd584;
  color: #151515;
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(255, 196, 81, 0.5);
}

.taktek-chat-toggle:focus {
  outline: 2px solid #ffc451;
  outline-offset: 3px;
}

.taktek-chat-toggle[aria-expanded="true"] {
  background: #151515;
  color: #ffc451;
}

/* Ventana del chatbot */
.taktek-chat-window {
  position: fixed;
  bottom: 140px;
  right: 15px;
  width: 380px;
  max-width: calc(100vw - 30px);
  height: 480px;
  max-height: calc(100vh - 180px);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  z-index: 99997;
  display: flex;
  flex-direction: column;
  font-family: "Open Sans", sans-serif;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.taktek-chat-window.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header del chatbot */
.taktek-chat-header {
  background: #151515;
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.taktek-chat-header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.taktek-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  font-family: "Raleway", sans-serif;
}

.taktek-chat-header-subtitle {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.85;
}

.taktek-chat-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.taktek-chat-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  font-size: 14px;
  transition: color 0.2s, background 0.2s;
}

.taktek-chat-btn:hover {
  color: #ffc451;
  background: rgba(255, 196, 81, 0.15);
}

.taktek-chat-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.taktek-chat-btn:disabled:hover {
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
}

.taktek-chat-btn:focus {
  outline: 2px solid #ffc451;
  outline-offset: 2px;
}

/* Área de mensajes */
.taktek-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #fafafa;
}

.taktek-chat-msg {
  margin-bottom: 12px;
  display: flex;
  animation: taktek-msg-in 0.3s ease;
}

@keyframes taktek-msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.taktek-chat-msg.user {
  justify-content: flex-end;
}

.taktek-chat-msg.bot {
  justify-content: flex-start;
}

.taktek-chat-msg-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.taktek-chat-msg.user .taktek-chat-msg-bubble {
  background: #ffc451;
  color: #151515;
  border-bottom-right-radius: 4px;
}

.taktek-chat-msg.bot .taktek-chat-msg-bubble {
  background: #fff;
  color: #444444;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom-left-radius: 4px;
}

.taktek-chat-msg-bubble p {
  margin: 0 0 6px 0;
}

.taktek-chat-msg-bubble p:last-child {
  margin-bottom: 0;
}

.taktek-chat-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
}

.taktek-chat-typing span {
  width: 6px;
  height: 6px;
  background: #444444;
  border-radius: 50%;
  animation: taktek-typing 1.4s infinite ease-in-out;
}

.taktek-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.taktek-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes taktek-typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input del chatbot */
.taktek-chat-input-wrap {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.taktek-chat-input-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.taktek-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  font-size: 14px;
  font-family: "Open Sans", sans-serif;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  transition: border-color 0.2s;
}

.taktek-chat-input:focus {
  outline: none;
  border-color: #ffc451;
  box-shadow: 0 0 0 2px rgba(255, 196, 81, 0.2);
}

.taktek-chat-input::placeholder {
  color: #6b6b6b;
}

.taktek-chat-send {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border: none;
  border-radius: 6px;
  background: #ffc451;
  color: #151515;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s, color 0.2s;
}

.taktek-chat-send:hover {
  background: #ffd584;
  color: #151515;
}

.taktek-chat-send:focus {
  outline: 2px solid #ffc451;
  outline-offset: 2px;
}

/* Mensaje de bienvenida inicial */
.taktek-chat-welcome {
  text-align: center;
  padding: 24px 16px;
  color: #444444;
}

.taktek-chat-welcome p {
  margin: 0 0 8px 0;
  font-size: 14px;
}

.taktek-chat-welcome strong {
  color: #151515;
}

/* Responsive */
@media (max-width: 480px) {
  .taktek-chat-window {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 70vh;
    border-radius: 12px 12px 0 0;
  }

  .taktek-chat-toggle {
    right: 15px;
    bottom: 20px;
  }
}
