/**
 * AAA City Chat Widget - Styling
 * Customized styling to match AAA City's design
 */

/* Base container */
.tde-chat-container {
  position: fixed;
  bottom: 30px; /* Same position as back-to-top button */
  right: 20px; /* Move to the right edge of screen */
  left: auto; /* Remove left positioning */
  z-index: 9999;
  font-family: 'Jost', sans-serif;
  transition: all 0.3s ease;
}

/* Chat bubble message that appears from the right */
.tde-chat-bubble {
  position: absolute;
  bottom: 50px; /* Position it closer to the icon */
  right: 10px; /* Adjust right position to align with icon */
  background-color: transparent;
  color: white;
  padding: 10px 15px;
  border-radius: 15px;
  border-bottom-right-radius: 0; /* Changed to create space for pointer */
  font-size: 14px;
  border: 1px solid white;
  box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.15);
  max-width: 300px; /* Increased from 220px to fit text on one line */
  min-width: 250px; /* Added minimum width to ensure text fits */
  width: max-content;
  white-space: nowrap; /* Changed back to nowrap to keep text on one line */
  animation: bubble-in 0.5s ease-out forwards;
  opacity: 0;
  transform: translateX(50px);
  pointer-events: none;
  z-index: 9998;
}

/* Add triangle pointer to make bubble appear from the icon */
.tde-chat-bubble:after {
  content: '';
  position: absolute;
  bottom: -10px;
  right: 15px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid white;
}

@keyframes bubble-in {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Hide bubble when chat is expanded */
.tde-chat-container:not(.minimized) .tde-chat-bubble {
  display: none;
}

/* Display bubble with delay after page load */
.tde-chat-bubble.show {
  display: block;
}

/* Minimized state */
.tde-chat-container.minimized {
  width: auto;
  height: auto;
  cursor: pointer;
}

.tde-chat-container.minimized .tde-chat-expanded {
  display: none;
}

.tde-chat-container.minimized .tde-chat-minimized {
  display: flex;
}

/* Expanded state */
.tde-chat-container:not(.minimized) {
  width: 320px;
  height: 480px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tde-chat-container:not(.minimized) .tde-chat-minimized {
  display: none;
}

.tde-chat-container:not(.minimized) .tde-chat-expanded {
  display: flex;
}

/* Minimized button - Updated to match back-to-top */
.tde-chat-minimized {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  background-color: #0576ee !important; /* Match the accent blue color */
  color: white;
  border-radius: 0.25rem;
  box-shadow: 0px 3px 15px 0px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease-in-out;
}

.tde-chat-minimized:hover {
  background-color: rgba(5, 118, 238, 0.8) !important; /* Accent blue with opacity */
  transform: translateY(-2px);
}

.tde-chat-minimized img {
  width: 2rem;
  height: 2rem;
  filter: brightness(0) invert(1) !important; /* Force SVG to be white */
  color: white !important;
  padding: 0;
  margin: 0;
}

.tde-chat-minimized span {
  display: none; /* Hide the text to match back-to-top style */
}

/* Expanded view */
.tde-chat-expanded {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Header */
.tde-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  background: var(--bs-primary, #0576ee); /* Use AAA City primary blue */
  color: #ffffff;
  min-height: 65px;
}

.tde-chat-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tde-chat-title .title-main {
  font-size: 16px;
  font-weight: 600;
}

.tde-chat-title .title-sub {
  font-size: 12px;
  opacity: 0.85;
}

.tde-chat-close-btn {
  background: rgba(255, 255, 255, 0.35);
  border: none;
  color: #ffffff;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.tde-chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.45);
}

/* Messages area */
.tde-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tde-chat-message {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
}

.tde-chat-message.bot {
  align-self: flex-start;
  background: #f5f5f5;
  border-bottom-left-radius: 4px;
}

.tde-chat-message.user {
  align-self: flex-end;
  background: var(--bs-primary, #0576ee); /* Use AAA City primary blue */
  color: white;
  border-bottom-right-radius: 4px;
}

/* Input area */
.tde-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-top: 1px solid #eee;
  background: white;
  min-height: 35px;
}

.tde-chat-input {
  flex: 1;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: white;
  color: #000000; /* Ensuring text is black */
}

.tde-chat-input:focus {
  border-color: var(--bs-primary, #0576ee); /* Use AAA City primary blue */
}

.tde-chat-send {
  height: 28px;
  padding: 0 12px;
  background: var(--bs-primary, #0576ee); /* Use AAA City primary blue */
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tde-chat-send:hover {
  background: #0461c7; /* Slightly darker blue */
}

/* Loading indicator styles */
.tde-chat-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(5, 118, 238, 0.1); /* Primary blue with opacity */
  border-radius: 8px;
  margin: 8px 0;
  align-self: flex-start;
}

.tde-chat-loading .dots {
  display: flex;
  gap: 4px;
}

.tde-chat-loading .dot {
  width: 6px;
  height: 6px;
  background: var(--bs-primary, #0576ee); /* Use AAA City primary blue */
  border-radius: 50%;
  animation: dot-pulse 1.5s infinite;
}

.tde-chat-loading .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.tde-chat-loading .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.7);
    opacity: 0.5;
  }
}

/* Disable input during processing */
.tde-chat-container.processing .tde-chat-input,
.tde-chat-container.processing .tde-chat-send {
  opacity: 0.7;
  cursor: not-allowed;
}

.tde-chat-container.processing .tde-chat-input {
  background-color: #f9f9f9;
} 