/* =======================================================
   Executive Translucent Glassmorphism AI Assistant Chatbot
   Full Markdown Styling & Frosted Glass Aesthetics
======================================================= */

/* Floating Corner Trigger Button */
#aiChatToggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: rgba(8, 14, 32, 0.78);
  border: 2px solid rgba(0, 210, 255, 0.75);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 210, 255, 0.45);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
  outline: none;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
#aiChatToggle:hover {
  transform: scale(1.1) translateY(-4px);
  border-color: #00d2ff;
  background: rgba(10, 20, 48, 0.88);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85), 0 0 35px rgba(0, 210, 255, 0.7);
}
#aiChatToggle img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 210, 255, 0.5));
  animation: floatBotIcon 3s ease-in-out infinite;
}
@keyframes floatBotIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.chat-status-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #070a14;
  box-shadow: 0 0 10px #10b981;
}

.chat-tooltip {
  position: absolute;
  right: 78px;
  background: rgba(8, 14, 32, 0.85);
  color: #00d2ff;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border-radius: 20px;
  border: 1px solid rgba(0, 210, 255, 0.4);
  white-space: nowrap;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
  font-family: "Poppins", sans-serif;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#aiChatToggle:hover .chat-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Translucent Glassmorphic Chat Window */
#aiChatWindow {
  position: fixed;
  bottom: 105px;
  right: 28px;
  width: 400px;
  max-width: calc(100vw - 36px);
  height: 570px;
  max-height: calc(100vh - 130px);
  background: rgba(6, 11, 26, 0.76);
  border: 1.5px solid rgba(0, 210, 255, 0.38);
  border-radius: 24px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.85), 0 0 45px rgba(0, 210, 255, 0.22);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.92) translateY(20px);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: "Poppins", sans-serif;
  text-transform: none !important;
}
#aiChatWindow *,
#aiChatWindow *::before,
#aiChatWindow *::after {
  text-transform: none !important;
}
#aiChatWindow.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

/* Translucent Header */
.chat-header {
  padding: 1.3rem 1.6rem;
  background: rgba(12, 20, 46, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.chat-header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 210, 255, 0.15);
  border: 1.5px solid rgba(0, 210, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  flex-shrink: 0;
}
.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.chat-header-info h4 {
  font-size: 1.55rem;
  color: #ffffff;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.chat-ai-pill {
  font-size: 1rem;
  color: #00d2ff;
  background: rgba(0, 210, 255, 0.15);
  border: 1px solid rgba(0, 210, 255, 0.4);
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase !important;
}
.chat-header-info p {
  font-size: 1.15rem;
  color: #94a3b8;
  margin: 0.2rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.chat-header-info p .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.chat-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.25s ease;
}
.chat-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.5);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  padding: 1.4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.chat-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 210, 255, 0.3);
  border-radius: 4px;
}

.chat-msg {
  display: flex;
  gap: 0.8rem;
  max-width: 94%;
  animation: fadeInMsg 0.3s ease forwards;
}
@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bot-avatar-small {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 210, 255, 0.15);
  border: 1px solid rgba(0, 210, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  flex-shrink: 0;
  margin-top: 2px;
}
.bot-avatar-small img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Glass Message Bubbles */
.msg-bubble {
  padding: 1.1rem 1.4rem;
  border-radius: 16px;
  font-size: 1.35rem;
  line-height: 1.55;
  text-align: left;
  word-break: break-word;
  text-transform: none !important;
}
.bot-msg .msg-bubble {
  background: rgba(14, 22, 50, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border-top-left-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.user-msg {
  align-self: flex-end;
  margin-left: auto;
}
.user-msg .msg-bubble {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.9) 0%, rgba(0, 210, 255, 0.9) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-top-right-radius: 4px;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 114, 255, 0.35);
}

/* Markdown Specific Elements */
.chat-code-block {
  background: rgba(3, 7, 18, 0.9);
  border: 1px solid rgba(0, 210, 255, 0.25);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0.6rem 0;
  overflow-x: auto;
  color: #38bdf8;
  font-family: Consolas, Monaco, monospace;
  font-size: 1.2rem;
  text-transform: none !important;
}
.chat-inline-code {
  background: rgba(0, 210, 255, 0.12);
  color: #00d2ff;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  font-family: Consolas, Monaco, monospace;
  font-size: 1.2rem;
  text-transform: none !important;
}
.chat-link {
  color: #00d2ff;
  text-decoration: underline;
  font-weight: 600;
  transition: color 0.2s ease;
}
.chat-link:hover {
  color: #a855f7;
}
.chat-ul,
.chat-ol {
  margin: 0.4rem 0 0.6rem;
  padding-left: 1.6rem;
}
.chat-li,
.chat-num-li {
  margin-bottom: 0.35rem;
  font-size: 1.3rem;
  line-height: 1.5;
  color: #cbd5e1;
  text-transform: none !important;
}
.chat-li strong,
.chat-num-li strong,
.msg-bubble strong {
  color: #ffffff;
  font-weight: 600;
  text-transform: none !important;
}
.chat-h3, .chat-h4, .chat-h5 {
  color: #00d2ff;
  margin: 0.8rem 0 0.3rem;
  font-weight: 700;
  font-size: 1.45rem;
  text-transform: none !important;
}

/* Quick Suggestions */
.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}
.chat-quick-btn {
  background: rgba(0, 210, 255, 0.08);
  border: 1px solid rgba(0, 210, 255, 0.3);
  color: #00d2ff;
  padding: 0.65rem 1.2rem;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: "Poppins", sans-serif;
}
.chat-quick-btn:hover {
  background: rgba(0, 210, 255, 0.2);
  border-color: #00d2ff;
  transform: translateX(4px);
}

/* Typing Indicator */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 1.4rem;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  background: #00d2ff;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* Translucent Footer Input Area */
.chat-input-area {
  padding: 1.2rem 1.4rem;
  background: rgba(10, 16, 38, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.chat-input-area input {
  flex: 1;
  background: rgba(6, 11, 26, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 1rem 1.4rem;
  color: #ffffff;
  font-size: 1.35rem;
  outline: none;
  font-family: "Poppins", sans-serif;
  transition: all 0.25s ease;
}
.chat-input-area input:focus {
  border-color: #00d2ff;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.35);
  background: rgba(8, 14, 32, 0.85);
}
.chat-input-area input::placeholder {
  color: #64748b;
}
.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #00d2ff 0%, #0072ff 100%);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 114, 255, 0.35);
  flex-shrink: 0;
}
.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 210, 255, 0.55);
}

@media (max-width: 600px) {
  #aiChatToggle {
    bottom: 18px;
    right: 18px;
    width: 58px;
    height: 58px;
  }
  #aiChatToggle img {
    width: 40px;
    height: 40px;
  }
  .chat-tooltip {
    display: none;
  }
  #aiChatWindow {
    right: 10px;
    left: 10px;
    bottom: 82px;
    width: auto;
    max-width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    max-height: 520px;
    border-radius: 20px;
  }
  .chat-header {
    padding: 1rem 1.3rem;
  }
  .chat-header-info h4 {
    font-size: 1.35rem;
  }
  .chat-messages {
    padding: 1.2rem;
    gap: 1rem;
  }
  .msg-bubble {
    font-size: 1.3rem;
    padding: 0.9rem 1.2rem;
  }
  .chat-input-area {
    padding: 1rem 1.2rem;
  }
  .chat-input-area input {
    height: 44px;
    font-size: 1.3rem;
    padding: 0 1.2rem;
  }
  .chat-send-btn {
    width: 40px;
    height: 40px;
  }
}
