/* ==========================================================================
   AI Assistant Chatbot Floating Widget & Full Page Styles
   ========================================================================== */

/* Floating Launcher Button */
.ai-chat-launcher {
  position: fixed;
  bottom: 25px;
  right: 25px;
  left: auto;
  z-index: 1040;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #06b6d4 100%);
  color: #ffffff;
  border: none;
  border-radius: 50px;
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.45), 0 0 15px rgba(6, 182, 212, 0.3);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
}

.ai-chat-launcher:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 15px 35px rgba(124, 58, 237, 0.6), 0 0 25px rgba(6, 182, 212, 0.5);
  color: #ffffff;
}

.ai-launcher-icon {
  position: relative;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-launcher-pulse {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  background-color: #10b981;
  border-radius: 50%;
  border: 2px solid #1e1b4b;
  animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Chat Widget Container */
.ai-assistant-widget {
  position: fixed;
  bottom: 85px;
  right: 25px;
  left: auto;
  width: 400px;
  max-width: calc(100vw - 30px);
  height: 580px;
  max-height: calc(100vh - 110px);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(124, 58, 237, 0.15);
  z-index: 1045;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  direction: rtl;
}

.ai-assistant-widget.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Widget Header */
.ai-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(90deg, rgba(30, 27, 75, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.ai-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
  line-height: 1.2;
}

.ai-header-subtitle {
  font-size: 0.72rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ai-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  display: inline-block;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-header-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
}

.ai-header-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Chat Messages Scroll Container */
.ai-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.ai-widget-messages::-webkit-scrollbar {
  width: 5px;
}
.ai-widget-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Message Bubbles */
.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: ai-msg-fade 0.25s ease-out;
}

@keyframes ai-msg-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-msg-user {
  align-self: flex-start;
  align-items: flex-start;
}

.ai-msg-assistant {
  align-self: flex-end;
  align-items: flex-end;
}

.ai-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: break-word;
}

.ai-msg-user .ai-bubble {
  background: linear-gradient(135deg, #6d28d9 0%, #4f46e5 100%);
  color: #ffffff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 15px rgba(109, 40, 217, 0.3);
}

.ai-msg-assistant .ai-bubble {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.ai-msg-assistant .ai-bubble strong {
  color: #f1f5f9;
}

.ai-msg-assistant .ai-bubble code {
  background: rgba(15, 23, 42, 0.8);
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
  font-size: 0.84rem;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.ai-msg-time {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 4px;
  padding: 0 4px;
}

/* Typing Indicator */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.7);
  border-radius: 14px;
  width: fit-content;
  border-bottom-right-radius: 4px;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  background: #a855f7;
  border-radius: 50%;
  animation: ai-dot-pulse 1.4s infinite ease-in-out both;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes ai-dot-pulse {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Quick Suggestion Chips */
.ai-suggestions-tray {
  padding: 8px 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(15, 23, 42, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-suggestions-tray::-webkit-scrollbar {
  display: none;
}

.ai-chip {
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ai-chip:hover {
  background: rgba(124, 58, 237, 0.25);
  border-color: rgba(139, 92, 246, 0.6);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Chat Input Form */
.ai-widget-footer {
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.ai-chat-input {
  flex: 1;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 10px 16px;
  color: #f8fafc;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}

.ai-chat-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
  background: rgba(30, 41, 59, 0.95);
}

.ai-chat-input::placeholder {
  color: #64748b;
  font-size: 0.84rem;
}

.ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.ai-send-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Full Page AI Assistant View */
.ai-page-workspace {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  min-height: 650px;
  display: flex;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.ai-page-sidebar {
  width: 320px;
  background: rgba(30, 41, 59, 0.4);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ai-page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 650px;
}

@media (max-width: 768px) {
  .ai-page-workspace {
    flex-direction: column;
    height: auto;
  }
  .ai-page-sidebar {
    width: 100%;
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .ai-page-main {
    height: 520px;
  }
  .ai-assistant-widget {
    bottom: 80px;
    left: 10px;
    right: 10px;
    width: auto;
    height: 80vh;
  }
  .ai-chat-launcher {
    bottom: 20px;
    right: 20px;
    left: auto;
    padding: 10px 14px;
    font-size: 0.84rem;
  }
}

/* ==========================================================================
   AI Assistant Custom Confirm Modal (Dark Glassmorphic Theme)
   ========================================================================== */
.ai-confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 12, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s ease;
  padding: 16px;
  direction: rtl;
}

.ai-confirm-modal-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ai-confirm-modal-box {
  background: linear-gradient(145deg, #13182b 0%, #0c101e 100%);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 22px;
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(124, 58, 237, 0.2);
  transform: scale(0.92) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.ai-confirm-modal-overlay.show .ai-confirm-modal-box {
  transform: scale(1) translateY(0);
}

.ai-confirm-modal-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.ai-confirm-modal-title {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.ai-confirm-modal-desc {
  color: #94a3b8;
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

.ai-confirm-modal-actions {
  display: flex;
  gap: 12px;
}

.ai-modal-btn-cancel {
  flex: 1;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-modal-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: translateY(-2px);
}

.ai-modal-btn-delete {
  flex: 1.2;
  padding: 12px 18px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: none;
  color: #ffffff;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ai-modal-btn-delete:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.6);
}
