/* Chat Widget Styles */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(168,85,247,0.4);
  transition: transform 0.3s, box-shadow 0.3s;
  color: #fff;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(168,85,247,0.6);
}

.chat-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-height: 520px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
}

.chat-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-glass);
}

.chat-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s;
}

.chat-close:hover {
  color: var(--text-primary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
}

.chat-quick-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-glass);
  flex-wrap: wrap;
}

.chat-quick-btn {
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.2);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s;
}

.chat-quick-btn:hover {
  background: rgba(168,85,247,0.2);
  color: var(--text-primary);
  border-color: rgba(168,85,247,0.4);
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border-glass);
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.3s;
}

.chat-input:focus {
  border-color: rgba(168,85,247,0.4);
}

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s;
}

.chat-send:hover {
  transform: scale(1.1);
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple);
  animation: typingDot 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Chat Message Styles */
.chat-msg {
  display: flex;
  max-width: 85%;
}

.chat-msg.user {
  align-self: flex-end;
}

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg-content {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg.user .chat-msg-content {
  background: var(--gradient-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.bot .chat-msg-content {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-msg-content strong {
  font-weight: 600;
  color: var(--accent-1);
}

.chat-msg-content code {
  background: rgba(168, 85, 247, 0.15);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.chat-msg-content a {
  color: var(--accent-1);
  text-decoration: underline;
  word-break: break-all;
}

/* Suggestion Buttons */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}

.chat-suggestion-btn {
  padding: 6px 12px;
  border-radius: 16px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.2);
  color: var(--accent-1);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.chat-suggestion-btn:hover {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.5);
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* Disabled state */
.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

/* Chat header info */
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-header-info h3 {
  font-size: 0.9rem;
  margin: 0;
  color: var(--text-primary);
}

.chat-status {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Chat icon states */
.chat-icon-close {
  display: none;
}

.chat-open .chat-icon-open {
  display: none;
}

.chat-open .chat-icon-close {
  display: block;
}

/* Chat messages scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 4px;
}

/* Day Mode Adjustments */
[data-theme="day"] .chat-msg.bot .chat-msg-content {
  background: rgba(255, 122, 24, 0.06);
  border-color: rgba(255, 122, 24, 0.15);
}

[data-theme="day"] .chat-msg-content strong {
  color: var(--accent-1);
}

[data-theme="day"] .chat-suggestion-btn {
  background: rgba(255, 122, 24, 0.08);
  border-color: rgba(255, 122, 24, 0.2);
  color: var(--accent-1);
}

[data-theme="day"] .chat-suggestion-btn:hover {
  background: rgba(255, 122, 24, 0.18);
  border-color: rgba(255, 122, 24, 0.4);
}

[data-theme="day"] .chat-quick-btn {
  background: rgba(255, 122, 24, 0.1);
  border-color: rgba(255, 122, 24, 0.2);
}

[data-theme="day"] .chat-quick-btn:hover {
  background: rgba(255, 122, 24, 0.2);
  border-color: rgba(255, 122, 24, 0.4);
}

/* Responsive */
@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 48px);
    right: 24px;
  }
}
