/* ===== APLICACIONESTI - CHATBOT STYLES ===== */

/* ===== CHATBOT CONTAINER ===== */
.chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 350px;
  height: 70vh;
  max-height: 600px;
  min-height: 450px;
  background: var(--gradient-card);
  border: 1px solid rgba(120, 135, 148, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: all 0.3s ease;
}

.chatbot-container:hover {
  border-color: var(--microsoft-blue);
  box-shadow: 0 25px 50px rgba(0, 120, 212, 0.2);
}

/* ===== CHATBOT HEADER ===== */
.chatbot-header {
  background: var(--gradient-accent);
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  position: relative;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.chatbot-info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.chatbot-info .status {
  font-size: 11px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chatbot-info .status::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #00d4aa;
  border-radius: 50%;
  display: inline-block;
}

.chatbot-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* ===== MESSAGES AREA ===== */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: rgba(15, 15, 26, 0.3);
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: rgba(120, 135, 148, 0.1);
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--microsoft-blue);
  border-radius: 2px;
}

.message {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  animation: slideIn 0.3s ease;
}

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

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.user-message .message-avatar {
  background: var(--gradient-accent);
  order: 1;
}

.bot-message .message-avatar {
  background: var(--gradient-card);
  border: 1px solid rgba(120, 135, 148, 0.2);
}

.message-content {
  flex: 1;
  background: var(--secondary-dark);
  border: 1px solid rgba(120, 135, 148, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  position: relative;
}

.user-message .message-content {
  background: var(--gradient-accent);
  color: white;
}

.message-content p {
  margin: 0;
  line-height: 1.5;
  font-size: 14px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 5px;
  text-align: right;
}

/* ===== CHATBOT OPTIONS ===== */
.chatbot-options {
  padding: 15px 20px;
  background: var(--secondary-dark);
  border-top: 1px solid rgba(120, 135, 148, 0.1);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.option-btn {
  background: var(--gradient-card);
  border: 1px solid rgba(120, 135, 148, 0.1);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-weight: 500;
}

.option-btn:hover {
  background: var(--microsoft-blue);
  color: white;
  border-color: var(--microsoft-blue);
  transform: translateY(-1px);
}

/* ===== INPUT AREA ===== */
.chatbot-input-area {
  padding: 15px 20px;
  background: var(--secondary-dark);
  border-top: 1px solid rgba(120, 135, 148, 0.1);
  display: flex;
  gap: 10px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid rgba(120, 135, 148, 0.2);
  border-radius: 8px;
  background: var(--accent-dark);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all 0.3s ease;
}

.chatbot-input:focus {
  border-color: var(--microsoft-blue);
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

.chatbot-input::placeholder {
  color: var(--text-muted);
}

.chatbot-send {
  width: 35px;
  height: 35px;
  background: var(--gradient-accent);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s ease;
}

.chatbot-send:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0, 120, 212, 0.3);
}

/* ===== WHATSAPP SECTION ===== */
.chatbot-whatsapp {
  padding: 15px 20px;
  background: var(--accent-dark);
  border-top: 1px solid rgba(120, 135, 148, 0.1);
  text-align: center;
}

.chatbot-whatsapp p {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.whatsapp-btn {
  display: inline-block;
  background: #25d366;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.whatsapp-btn:hover {
  background: #128c7e;
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

/* ===== CHATBOT TOGGLE BUTTON ===== */
.chatbot-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: var(--gradient-accent);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 120, 212, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
  gap: 2px;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 35px rgba(0, 120, 212, 0.4);
}

.toggle-icon {
  font-size: 18px;
  line-height: 1;
}

.toggle-text {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .chatbot-container {
    width: calc(100vw - 40px);
    height: 75vh;
    max-height: 500px;
    min-height: 400px;
    bottom: 10px;
    right: 10px;
    left: 10px;
    border-radius: 12px;
  }

  .chatbot-toggle {
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
  }

  .chatbot-options {
    grid-template-columns: 1fr;
    padding: 12px 15px;
  }

  .option-btn {
    font-size: 11px;
    padding: 8px 10px;
  }

  .chatbot-messages {
    padding: 15px;
  }

  .chatbot-input-area,
  .chatbot-whatsapp {
    padding: 12px 15px;
  }
}

@media (max-width: 480px) {
  .chatbot-container {
    height: 80vh;
    max-height: 450px;
    min-height: 350px;
    bottom: 5px;
    right: 5px;
    left: 5px;
    width: calc(100vw - 10px);
    border-radius: 10px;
  }

  .chatbot-messages {
    padding: 12px;
  }

  .chatbot-input-area,
  .chatbot-options,
  .chatbot-whatsapp {
    padding: 10px 12px;
  }

  .chatbot-header {
    padding: 12px 15px;
  }

  .option-btn {
    font-size: 10px;
    padding: 6px 8px;
  }

  .chatbot-input {
    font-size: 12px;
    padding: 8px 10px;
  }

  .chatbot-send {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .chatbot-container {
    height: 85vh;
    max-height: 400px;
    min-height: 320px;
    width: calc(100vw - 8px);
    bottom: 4px;
    right: 4px;
    left: 4px;
  }

  .chatbot-messages {
    padding: 10px;
  }

  .chatbot-input-area,
  .chatbot-options,
  .chatbot-whatsapp {
    padding: 8px 10px;
  }

  .chatbot-header {
    padding: 10px 12px;
  }

  .chatbot-info h4 {
    font-size: 13px;
  }

  .chatbot-info .status {
    font-size: 10px;
  }
}

/* ===== ANIMATIONS ===== */
.message {
  animation: slideIn 0.3s ease;
}

/* ===== LOADING ANIMATION ===== */
.bot-message.typing .message-content::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typing 1s infinite;
  margin-left: 5px;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

/* ===== ENHANCED HOVER EFFECTS ===== */
.option-btn:active {
  transform: scale(0.95);
}

.chatbot-input:focus {
  background: rgba(26, 26, 46, 0.8);
}

/* ===== MOBILE KEYBOARD OPTIMIZATION ===== */
@media (max-width: 768px) and (orientation: landscape) {
  .chatbot-container {
    height: 90vh;
    max-height: 400px;
  }
}

/* ===== SAFE AREA SUPPORT FOR MOBILE DEVICES ===== */
@supports (padding: max(0px)) {
  .chatbot-container {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  @media (max-width: 768px) {
    .chatbot-container {
      padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
  }

  @media (max-width: 480px) {
    .chatbot-container {
      padding-bottom: max(5px, env(safe-area-inset-bottom));
    }
  }
}

/* ===== IMPROVED SCROLL BEHAVIOR ===== */
.chatbot-messages {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  .chatbot-container {
    background: rgba(15, 15, 26, 0.95);
    border-color: rgba(120, 135, 148, 0.2);
  }

  .message-content {
    background: rgba(26, 26, 46, 0.8);
  }
}
