/* =========================================
   CHATBOT STYLES
   ========================================= */

/* Floating Toggle Button */
.chatbot-toggler {
  position: fixed;
  bottom: 30px; /* Standard corner position */
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--additional, #FD562A); /* Solid Premium Orange */
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 1000;
}

.chatbot-toggler:hover {
  transform: scale(1.1) rotate(10deg);
  background: var(--additional, #FD562A);
  box-shadow: 0 0 30px rgba(253, 86, 42, 0.4);
}

.chatbot-toggler span {
  position: absolute;
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

.chatbot-toggler span:last-child {
  opacity: 0;
  transform: rotate(90deg);
}

body.show-chatbot .chatbot-toggler span:first-child {
  opacity: 0;
  transform: rotate(90deg);
}

body.show-chatbot .chatbot-toggler span:last-child {
  opacity: 1;
  transform: rotate(0);
}

/* Chatbot Window */
.chatbot {
  position: fixed;
  bottom: 100px; /* Above the button */
  right: 30px;
  width: 380px;
  max-width: 90%;
  background: #121212; /* Deep Dark Background */
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5) translateY(50px);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.show-chatbot .chatbot {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

/* Header */
.chatbot header {
  background: #1e1e1e; /* Slightly lighter dark for header */
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chatbot header h2 {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.chatbot header .close-btn {
  color: #888;
  font-size: 1.2rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: color 0.3s ease;
}

.chatbot header .close-btn:hover {
  color: var(--additional, #FD562A);
}

/* Chatbox Messages */
.chatbot-box {
  height: 350px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
  background: #121212;
}

.chatbot-box::-webkit-scrollbar {
  width: 6px;
}
.chatbot-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.chat-message {
  display: flex;
  align-items: flex-end; /* Align bottom for avatar */
  margin-bottom: 5px;
}

.chat-message.incoming {
  justify-content: flex-start;
}

.chat-message.outgoing {
  justify-content: flex-end;
}

.chat-message .message-content {
  max-width: 80%;
  padding: 12px 16px;
  font-size: 0.95rem;
  line-height: 1.4;
  border-radius: 12px;
  position: relative;
}

/* Different Styling for Bot vs User */
.chat-message.incoming .message-content {
  background: #2a2a2a; /* Dark Grey for incoming */
  color: #e0e0e0;
  border-bottom-left-radius: 2px;
}

.chat-message.outgoing .message-content {
  background: var(--additional, #FD562A);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chat-message .bot-icon {
  width: 32px;
  height: 32px;
  background: var(--additional, #FD562A);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  margin-right: 10px;
  flex-shrink: 0;
}

/* Input / Options Area */
.chat-input {
  padding: 15px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: #1e1e1e; /* Slightly lighter dark for input area */
}

.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-option-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ccc;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chat-option-btn:hover {
  background: rgba(253, 86, 42, 0.1);
  border-color: var(--additional, #FD562A);
  color: var(--additional, #FD562A);
}

/* Enforce Dark Mode even if system prefers light */
@media (prefers-color-scheme: light) {
  .chatbot {
    background: #121212 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
  }
  .chatbot header {
    background: #1e1e1e !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  }
  .chatbot header h2 {
    color: #fff !important;
  }
  .chatbot-box {
    background: #121212 !important;
  }
  .chat-message.incoming .message-content {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
  }
  .chat-input {
    background: #1e1e1e !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
  }
  .chat-option-btn {
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ccc !important;
  }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .chatbot {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-width: 100%;
  }
  .chatbot-box {
    height: calc(100% - 130px);
  }
  .chatbot-toggler {
    bottom: 20px;
    right: 20px;
    left: auto;
  }
}
