/* ========================================
   AI TWIN CHAT WIDGET STYLES
   ======================================== */

#ai-chat-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998; /* Below custom cursor (9999) */
  font-family: var(--font-he, 'Heebo', sans-serif);
  direction: rtl;
}

#ai-chat-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-gradient, linear-gradient(135deg, #00d4ff 0%, #7b61ff 100%));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), var(--accent-glow, 0 0 30px rgba(0, 212, 255, 0.3));
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform var(--transition-fast, 0.2s);
  font-size: 28px;
}

#ai-chat-bubble:hover {
  transform: scale(1.1);
}

#ai-chat-window {
  display: none;
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  height: 500px;
  max-width: calc(100vw - 48px);
  background-color: var(--bg-secondary, #0c1018);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
  border-radius: var(--radius-md, 16px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease-out forwards;
}

#ai-chat-window.open {
  display: flex;
}

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

#ai-chat-header {
  background: var(--bg-tertiary, #111827);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

#ai-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #f0f4f8);
  display: flex;
  align-items: center;
  gap: 8px;
}

#ai-chat-close {
  background: none;
  border: none;
  color: var(--text-secondary, #8899aa);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

#ai-chat-close:hover {
  color: var(--text-primary, #f0f4f8);
}

#ai-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle, rgba(255,255,255,0.1)) transparent;
}

/* Webkit Scrollbar */
#ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}
#ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#ai-chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-subtle, rgba(255,255,255,0.2));
  border-radius: 10px;
}
#ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 255, 0.4);
}

.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  animation: fadeIn 0.2s ease-out forwards;
}

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

.chat-message.user {
  background: var(--bg-tertiary, #111827);
  color: var(--text-primary, #f0f4f8);
  align-self: flex-start;
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
  border-bottom-right-radius: 2px;
}

.chat-message.ai {
  background: rgba(0, 212, 255, 0.1);
  color: var(--text-primary, #f0f4f8);
  align-self: flex-end;
  border: 1px solid var(--border-accent, rgba(0,212,255,0.2));
  border-bottom-left-radius: 2px;
}

.chat-message.ai p {
  margin: 0 0 8px 0;
}
.chat-message.ai p:last-child {
  margin: 0;
}
.chat-message.ai ul, .chat-message.ai ol {
  margin: 0 0 8px 0;
  padding-right: 20px;
  padding-left: 0;
}
.chat-message.ai li {
  margin-bottom: 4px;
}

#ai-chat-input-container {
  display: flex;
  padding: 16px;
  background: var(--bg-tertiary, #111827);
  border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

#ai-chat-input {
  flex: 1;
  background: var(--bg-secondary, #0c1018);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
  color: var(--text-primary, #f0f4f8);
  padding: 10px 14px;
  border-radius: var(--radius-sm, 8px);
  outline: none;
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition-fast, 0.2s);
}

#ai-chat-input:focus {
  border-color: var(--accent-primary, #00d4ff);
}

#ai-chat-send {
  background: var(--accent-gradient, linear-gradient(135deg, #00d4ff 0%, #7b61ff 100%));
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm, 8px);
  margin-right: 8px; /* RTL spacing */
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity var(--transition-fast, 0.2s);
}

#ai-chat-send:hover {
  opacity: 0.9;
}

/* Skeleton Loader for typing */
.typing-skeleton {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(0, 212, 255, 0.05);
  border-radius: 12px;
  align-self: flex-end;
  border-bottom-left-radius: 2px;
}

.typing-skeleton .dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-primary, #00d4ff);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

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

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}
