/* AI Assistant Styles - Luxury Redesign */
/* Elegant, minimal design with emerald/gold theme */

/* AI Button Container - Draggable wrapper */
.ai-button-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ai-assistant-toggle {
  width: 56px;
  height: 56px;
  background: var(--primary-color);
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(46, 139, 87, 0.25);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  transition: all 0.3s ease, opacity 0.3s ease, transform 0.15s ease;
  user-select: none;
  touch-action: none;
}

.ai-assistant-toggle:hover {
  box-shadow: 0 8px 24px rgba(46, 139, 87, 0.35);
  background: var(--secondary-color);
}

.ai-assistant-toggle.active {
  background: var(--secondary-color);
}

/* Dragging state */
.ai-assistant-toggle.dragging {
  cursor: grabbing;
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(46, 139, 87, 0.4);
  opacity: 0.9;
}

.ai-button-container.dragging {
  transition: none !important;
}

/* Row containing AI toggle and quick mic buttons */
.ai-buttons-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Quick Microphone Button - one-click voice access */
.ai-quick-mic-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  transition: all 0.3s ease;
}

.ai-quick-mic-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.ai-quick-mic-btn:active {
  transform: translateY(0);
}

/* Listening state - pulsing animation */
.ai-quick-mic-btn.listening {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: quickMicPulse 1.5s infinite;
}

@keyframes quickMicPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Processing state - spinning */
.ai-quick-mic-btn.processing {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.ai-quick-mic-btn.processing i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Error state */
.ai-quick-mic-btn.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Snap back button - appears when button is moved from default position */
.ai-snap-btn {
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0;
  transform: scale(0.8);
}

.ai-snap-btn.visible {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.ai-snap-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.ai-snap-btn i {
  font-size: 12px;
}

/* Smooth transition when snapping back */
.ai-button-container.snapping {
  transition: left 0.3s ease-out, top 0.3s ease-out, right 0.3s ease-out, bottom 0.3s ease-out !important;
}

.ai-assistant-panel {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 420px;
  min-width: 320px;
  max-width: 90vw;
  height: 720px;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 16px 16px 0 0;
  box-shadow: -4px 0 24px rgba(10, 29, 31, 0.12);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 998;
  display: flex;
  flex-direction: column;
}

/* Minimized state - collapses to thin line */
.ai-assistant-panel.minimized {
  height: 50px;
  cursor: pointer;
  overflow: hidden;
}

.ai-assistant-panel.minimized .ai-assistant-tabs,
.ai-assistant-panel.minimized .ai-assistant-content,
.ai-assistant-panel.minimized .ai-resize-handle {
  display: none;
}

.ai-assistant-panel.minimized .ai-assistant-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark, #5a67d8));
  color: white;
  cursor: pointer;
  border-radius: 16px 16px 0 0;
}

.ai-assistant-panel.minimized .ai-assistant-title {
  color: white;
  font-weight: 600;
}

.ai-assistant-panel.minimized .ai-minimize-btn,
.ai-assistant-panel.minimized .ai-close-btn {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

.ai-assistant-panel.minimized .ai-minimize-btn:hover,
.ai-assistant-panel.minimized .ai-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.ai-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 999;
  transition: background 0.2s;
}

.ai-resize-handle:hover,
.ai-resize-handle.resizing {
  background: linear-gradient(90deg, var(--primary-color) 0%, transparent 100%);
}

.ai-resize-handle::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 40px;
  background: var(--border-color);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}

.ai-resize-handle:hover::before,
.ai-resize-handle.resizing::before {
  opacity: 1;
}

.ai-assistant-panel.open {
  transform: translateY(0);
}

/* Slim, elegant header */
.ai-assistant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--white);
  border-bottom: 1px solid var(--border-color);
  border-radius: 16px 16px 0 0;
}

.ai-assistant-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dark);
}

.ai-assistant-title i {
  color: var(--primary-color);
  font-size: 1.125rem;
}

.ai-header-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ai-minimize-btn,
.ai-close-btn {
  background: transparent;
  border: none;
  color: var(--text-light);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 1rem;
}

.ai-close-btn {
  font-size: 1.25rem;
}

.ai-minimize-btn:hover,
.ai-close-btn:hover {
  background: var(--bg-light);
  color: var(--text-dark);
}

/* Language Selector Dropdown */
.ai-language-dropdown {
  position: relative;
}

.ai-language-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: white;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  transition: all 0.2s;
}

.ai-language-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.ai-language-btn #ai-language-flag {
  font-size: 18px;
}

.ai-language-btn i {
  font-size: 12px;
  opacity: 0.8;
}

.ai-language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1001;
}

.ai-language-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ai-language-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  color: #1e293b;
}

.ai-language-option:first-child {
  border-radius: 12px 12px 0 0;
}

.ai-language-option:last-child {
  border-radius: 0 0 12px 12px;
}

.ai-language-option:hover {
  background: #f1f5f9;
}

.ai-language-option.active {
  background: #e0f2fe;
  color: #0369a1;
}

.ai-language-option .lang-flag {
  font-size: 20px;
}

.ai-language-option .lang-name {
  font-size: 13px;
  font-weight: 500;
}

/* Slim tabs with more spacing */
.ai-assistant-tabs {
  display: flex;
  background: var(--white);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1rem;
  gap: 0.5rem;
}

.ai-tab {
  flex: 1;
  padding: 0.625rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all 0.2s;
  letter-spacing: -0.01em;
}

.ai-tab:hover {
  color: var(--text-dark);
}

.ai-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Content area - flex container for tabs */
.ai-assistant-content {
  flex: 1;
  overflow: hidden;
  background: var(--white);
  display: flex;
  flex-direction: column;
}

/* Tab content - each tab is a flex column */
.ai-tab-content {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.ai-tab-content.active {
  display: flex;
}

/* Scrollable area within each tab */
.ai-tab-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Fixed footer for action buttons */
.ai-tab-footer {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  background: var(--white);
  border-top: 1px solid var(--border-color);
}

/* Secondary actions row in footer */
.ai-tab-footer-secondary {
  display: flex;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

/* Slim command buttons with more spacing */
.ai-command-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
  margin-bottom: 2rem;
}

.ai-command-btn {
  padding: 0.625rem 0.875rem;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-dark);
  transition: all 0.2s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.ai-command-btn:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(46, 139, 87, 0.08);
}

.ai-command-btn i {
  font-size: 1.125rem;
  color: var(--primary-color);
}

/* Cleaner input areas */
.ai-input-area {
  margin-top: 1.5rem;
}

.ai-input-area label {
  display: block;
  margin-bottom: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dark);
  letter-spacing: -0.01em;
}

.ai-input-area textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
  transition: all 0.2s;
  background: var(--white);
}

.ai-input-area textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.08);
}

/* Slim, elegant process button */
.ai-process-btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.25rem;
  transition: all 0.2s;
  letter-spacing: -0.01em;
}

.ai-process-btn:hover:not(:disabled) {
  background: var(--secondary-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(46, 139, 87, 0.2);
}

.ai-process-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Cleaner result area */
.ai-result-area {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: none;
}

.ai-result-area.visible {
  display: block;
}

.ai-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.ai-result-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: -0.01em;
}

.ai-copy-btn {
  padding: 0.375rem 0.75rem;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.ai-copy-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.ai-save-btn {
  padding: 0.375rem 0.75rem;
  background: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 6px;
  font-size: 0.75rem;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  display: none; /* Hidden by default, shown after generation */
  align-items: center;
  gap: 0.375rem;
}

.ai-save-btn:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.ai-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ai-view-btn {
  padding: 0.375rem 0.75rem;
  background: var(--success-color);
  border: 1px solid var(--success-color);
  border-radius: 6px;
  font-size: 0.75rem;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.ai-view-btn:hover {
  background: #059669;
  border-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.ai-result-text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-dark);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Session Management Bar */
.ai-session-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
}

.ai-session-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s;
}

.ai-session-btn:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.ai-session-info {
  flex: 1;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
}

/* Session History Panel */
.ai-session-history {
  position: absolute;
  top: 120px;
  left: 1rem;
  right: 1rem;
  max-height: 300px;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 10;
  overflow: hidden;
}

.ai-session-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-dark);
}

.ai-session-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.ai-session-close:hover {
  background: var(--bg-light);
  color: var(--text-dark);
}

.ai-session-list {
  max-height: 240px;
  overflow-y: auto;
}

.ai-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.ai-session-item:last-child {
  border-bottom: none;
}

.ai-session-item:hover {
  background: var(--bg-light);
}

.ai-session-item.active {
  background: rgba(46, 139, 87, 0.08);
  border-left: 3px solid var(--primary-color);
}

.ai-session-item-info {
  flex: 1;
  min-width: 0;
}

.ai-session-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-session-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.ai-session-delete-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.2s;
}

.ai-session-item:hover .ai-session-delete-btn {
  opacity: 1;
}

.ai-session-delete-btn:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

/* Dark theme adjustments for sessions */
[data-theme="dark"] .ai-session-history {
  background: var(--card-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .ai-session-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .ai-session-item.active {
  background: rgba(46, 139, 87, 0.15);
}

/* Chat Search Bar */
.ai-chat-search {
  padding: 8px 12px;
  background: var(--bg-light, #f8fafc);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.ai-chat-search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 6px 12px;
}

.ai-chat-search-input-wrapper i.ph-magnifying-glass {
  color: var(--text-muted, #94a3b8);
  font-size: 14px;
}

.ai-chat-search-input-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  outline: none;
  color: var(--text-dark, #1e293b);
}

.ai-chat-search-input-wrapper input::placeholder {
  color: var(--text-muted, #94a3b8);
}

.ai-search-results-count {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}

.ai-search-nav-btn,
.ai-search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
}

.ai-search-nav-btn:hover,
.ai-search-clear-btn:hover {
  background: var(--bg-light, #f1f5f9);
  color: var(--text-dark, #1e293b);
}

/* Search highlights */
.ai-search-highlight {
  background: #fef08a;
  color: #1e293b;
  padding: 1px 2px;
  border-radius: 2px;
}

.ai-search-highlight.ai-search-current {
  background: #fbbf24;
  outline: 2px solid #f59e0b;
}

/* Dark theme search */
[data-theme="dark"] .ai-chat-search {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .ai-chat-search-input-wrapper {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ai-chat-search-input-wrapper input {
  color: #ffffff;
}

[data-theme="dark"] .ai-search-highlight {
  background: #854d0e;
  color: #fef08a;
}

[data-theme="dark"] .ai-search-highlight.ai-search-current {
  background: #a16207;
  outline-color: #ca8a04;
}

/* Minimal chat design */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.ai-message {
  margin-bottom: 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.ai-message.user {
  flex-direction: row-reverse;
}

.ai-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.ai-message.user .ai-message-avatar {
  background: var(--secondary-color);
}

.ai-message-bubble {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--bg-light);
  max-width: 75%;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-dark);
}

.ai-message.user .ai-message-bubble {
  background: var(--primary-color);
  color: white;
}

/* Voice Replay Button (on AI messages) */
.ai-message-bubble {
  position: relative;
}

.ai-voice-replay-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0;
  transition: all 0.2s ease;
}

.ai-message-bubble:hover .ai-voice-replay-btn {
  opacity: 1;
}

.ai-voice-replay-btn:hover {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-dark);
  transform: scale(1.1);
}

.ai-voice-replay-btn.playing {
  opacity: 1;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  animation: replayPulse 1.5s infinite;
}

@keyframes replayPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Voice Stop Button (appears next to replay when playing) */
.ai-voice-stop-btn {
  position: absolute;
  bottom: 4px;
  right: 32px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: #ef4444;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: white;
  opacity: 1;
  transition: all 0.2s ease;
  animation: fadeIn 0.2s ease;
}

.ai-voice-stop-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Slim chat input */
.ai-chat-input-wrapper {
  display: flex;
  gap: 0.625rem;
}

.ai-chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--white);
  transition: all 0.2s;
}

.ai-chat-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.08);
}

.ai-chat-send-btn {
  padding: 0.75rem 1.25rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
  letter-spacing: -0.01em;
}

.ai-chat-send-btn:hover:not(:disabled) {
  background: var(--secondary-color);
  transform: translateY(-1px);
}

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

/* Chat Mic Button (inside chat input area) */
.ai-chat-mic-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-chat-mic-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-1px);
}

.ai-chat-mic-btn.listening {
  background: linear-gradient(135deg, #10b981, #059669);
  animation: chatMicPulse 1.5s infinite;
}

.ai-chat-mic-btn.processing {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.ai-chat-mic-btn.processing i {
  animation: spin 1s linear infinite;
}

.ai-chat-mic-btn.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

@keyframes chatMicPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Voice Input Button */
.ai-voice-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-voice-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.ai-voice-btn:active {
  transform: scale(0.95);
}

.ai-voice-btn.listening {
  background: linear-gradient(135deg, #ef4444, #f97316);
  animation: voicePulse 1.5s ease-in-out infinite;
}

/* Whisper Recording State */
.ai-voice-btn.recording {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  animation: recordingPulse 1s ease-in-out infinite;
}

@keyframes recordingPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
}

.ai-voice-btn.processing {
  background: linear-gradient(135deg, #f59e0b, #eab308);
}

.ai-voice-btn.processing i {
  animation: spin 1s linear infinite;
}

.ai-voice-btn.error {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Voice Button Variants for Different Input Types */

/* Wrapper for input + voice button inline */
.ai-input-with-voice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-input-with-voice input {
  flex: 1;
}

/* Inline voice button (smaller, for text inputs) */
.ai-voice-btn-inline {
  width: 36px;
  height: 36px;
  font-size: 1rem;
  border-radius: 8px;
}

/* Wrapper for textarea + floating voice button */
.ai-textarea-with-voice {
  position: relative;
}

.ai-textarea-with-voice textarea {
  width: 100%;
  padding-right: 50px; /* Make room for voice button */
}

/* Textarea voice button (floating in corner) */
.ai-voice-btn-textarea {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  border-radius: 8px;
  opacity: 0.85;
}

.ai-voice-btn-textarea:hover {
  opacity: 1;
}

/* Setup input wrapper adjustments */
.ai-setup-input-wrapper .ai-voice-btn {
  width: 40px;
  height: 40px;
  font-size: 1rem;
  border-radius: 8px;
}

/* Voice Permission Modal */
.ai-voice-permission-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  transition: background 0.2s ease;
  backdrop-filter: blur(0);
}

.ai-voice-permission-modal.visible {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.ai-voice-permission-content {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 320px;
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-voice-permission-modal.visible .ai-voice-permission-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

[data-theme="dark"] .ai-voice-permission-content {
  background: #1e293b;
  color: #f1f5f9;
}

.ai-voice-permission-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: white;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.ai-voice-permission-content h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.ai-voice-permission-content p {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
}

[data-theme="dark"] .ai-voice-permission-content p {
  color: #94a3b8;
}

.ai-voice-permission-buttons {
  display: flex;
  gap: 0.75rem;
}

.ai-voice-permission-cancel,
.ai-voice-permission-allow {
  flex: 1;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.ai-voice-permission-cancel {
  background: #f3f4f6;
  color: #6b7280;
}

[data-theme="dark"] .ai-voice-permission-cancel {
  background: #334155;
  color: #94a3b8;
}

.ai-voice-permission-cancel:hover {
  background: #e5e7eb;
}

.ai-voice-permission-allow {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.ai-voice-permission-allow:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Generate form - slim design */
.ai-form-group {
  margin-bottom: 1.25rem;
}

.ai-form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dark);
  letter-spacing: -0.01em;
}

.ai-form-group input,
.ai-form-group select,
.ai-form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--white);
  transition: all 0.2s;
}

.ai-form-group input:focus,
.ai-form-group select:focus,
.ai-form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.08);
}

/* Loading Spinner */
.ai-loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Dark Mode */
[data-theme="dark"] .ai-assistant-panel {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .ai-assistant-header {
  background: var(--bg-primary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .ai-assistant-content {
  background: var(--bg-primary);
}

[data-theme="dark"] .ai-assistant-tabs {
  background: var(--bg-primary);
}

[data-theme="dark"] .ai-command-btn {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .ai-input-area textarea,
[data-theme="dark"] .ai-chat-input,
[data-theme="dark"] .ai-form-group input,
[data-theme="dark"] .ai-form-group select,
[data-theme="dark"] .ai-form-group textarea {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .ai-result-area {
  background: var(--surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .ai-message-bubble {
  background: var(--surface);
  color: var(--text-primary);
}

[data-theme="dark"] .ai-message.user .ai-message-bubble {
  background: var(--primary-color);
  color: white;
}

[data-theme="dark"] .ai-tab-footer {
  background: var(--bg-primary);
  border-top-color: var(--border-color);
}

[data-theme="dark"] .ai-tab-footer-secondary {
  border-top-color: var(--border-color);
}

[data-theme="dark"] .ai-copy-btn {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .ai-copy-btn:hover {
  background: var(--primary-color);
  color: white;
}

/* AI Suggestions Dropdown */
.ai-input-wrapper {
  position: relative;
  width: 100%;
}

/* Tags Input for Keywords */
.ai-tags-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: white;
  min-height: 42px;
  cursor: text;
}

.ai-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ai-keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark, #5a67d8));
  color: white;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  animation: tagSlideIn 0.2s ease;
}

@keyframes tagSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ai-keyword-tag-remove {
  cursor: pointer;
  font-weight: bold;
  opacity: 0.8;
  transition: opacity 0.2s;
  font-size: 1rem;
  line-height: 1;
}

.ai-keyword-tag-remove:hover {
  opacity: 1;
}

.ai-tags-input input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.25rem;
  min-width: 150px;
  font-size: 0.9375rem;
}

.ai-tags-input input::placeholder {
  color: var(--text-secondary);
}

.ai-suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  margin-top: 4px;
}

.ai-suggestions-dropdown.visible {
  display: block;
}

.ai-suggestions-dropdown.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.ai-suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.ai-suggestion-item:last-child {
  border-bottom: none;
}

.ai-suggestion-item:hover {
  background: var(--primary-color-light, #f0f4ff);
}

.ai-suggestion-item i {
  margin-right: 0.5rem;
  color: var(--primary-color);
  font-size: 0.875rem;
}

[data-theme="dark"] .ai-suggestions-dropdown {
  background: var(--surface);
  border-color: var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ai-suggestion-item {
  color: var(--text-primary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .ai-suggestion-item:hover {
  background: var(--primary-color-dark, #1e3a8a);
}

/* ============================================
   FEEDBACK TAB STYLES
   ============================================ */

.ai-feedback-container {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  overflow-y: auto;
}

.ai-feedback-type-selector {
  display: flex;
  gap: 0.5rem;
}

.ai-feedback-type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  background: var(--card-bg, #fff);
  color: var(--text-color, #374151);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.875rem;
}

.ai-feedback-type-btn:hover {
  border-color: var(--primary-color, #059669);
  background: rgba(5, 150, 105, 0.05);
}

.ai-feedback-type-btn.active {
  border-color: var(--primary-color, #059669);
  background: rgba(5, 150, 105, 0.1);
  color: var(--primary-color, #059669);
}

.ai-feedback-type-btn[data-type="bug_report"]:hover,
.ai-feedback-type-btn[data-type="bug_report"].active {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.ai-feedback-type-btn i {
  font-size: 1.25rem;
}

.ai-feedback-form .ai-form-group label .required {
  color: #dc2626;
  margin-left: 2px;
}

.ai-feedback-form input,
.ai-feedback-form select,
.ai-feedback-form textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--input-bg, #fff);
  color: var(--text-color, #374151);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.ai-feedback-form input:focus,
.ai-feedback-form select:focus,
.ai-feedback-form textarea:focus {
  outline: none;
  border-color: var(--primary-color, #059669);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.ai-feedback-form textarea {
  resize: vertical;
  min-height: 100px;
}

.ai-submit-feedback-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Success Message */
.ai-feedback-success {
  text-align: center;
  padding: 2rem 1rem;
}

.ai-feedback-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, #059669, #10b981);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-feedback-success-icon i {
  font-size: 2rem;
  color: white;
}

.ai-feedback-success h3 {
  margin: 0 0 0.5rem;
  color: var(--text-color);
}

.ai-feedback-success p {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

.ai-btn-secondary {
  background: var(--surface, #f3f4f6) !important;
  color: var(--text-color, #374151) !important;
  border: 1px solid var(--border-color, #e5e7eb) !important;
}

.ai-btn-secondary:hover {
  background: var(--border-color, #e5e7eb) !important;
}

/* History Toggle */
.ai-feedback-history-toggle {
  text-align: center;
  border-top: 1px solid var(--border-color, #e5e7eb);
  padding-top: 1rem;
  margin-top: auto;
}

.ai-btn-text {
  background: none;
  border: none;
  color: var(--primary-color, #059669);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0.5rem;
}

.ai-btn-text:hover {
  text-decoration: underline;
}

/* History List */
.ai-feedback-history {
  border-top: 1px solid var(--border-color, #e5e7eb);
  padding-top: 1rem;
  max-height: 250px;
  overflow-y: auto;
}

.ai-feedback-history h4 {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.ai-feedback-history-item {
  background: var(--surface, #f9fafb);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.ai-feedback-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.ai-feedback-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
}

.ai-feedback-type-badge.feature_request {
  background: rgba(5, 150, 105, 0.15);
  color: #059669;
}

.ai-feedback-type-badge.bug_report {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
}

.ai-feedback-status {
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  text-transform: capitalize;
}

.ai-feedback-status.new { background: #dbeafe; color: #1d4ed8; }
.ai-feedback-status.under_review { background: #fef3c7; color: #d97706; }
.ai-feedback-status.planned { background: #e0e7ff; color: #4f46e5; }
.ai-feedback-status.in_progress { background: #d1fae5; color: #059669; }
.ai-feedback-status.completed { background: #d1fae5; color: #047857; }
.ai-feedback-status.wont_fix { background: #f3f4f6; color: #6b7280; }

.ai-feedback-history-title {
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.875rem;
}

.ai-feedback-history-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ai-feedback-admin-response {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.8125rem;
  color: var(--text-color);
}

/* Dark Mode Feedback Styles */
[data-theme="dark"] .ai-feedback-type-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .ai-feedback-type-btn:hover {
  background: #334155;
}

[data-theme="dark"] .ai-feedback-type-btn.active {
  background: rgba(5, 150, 105, 0.2);
}

[data-theme="dark"] .ai-feedback-type-btn[data-type="bug_report"].active {
  background: rgba(220, 38, 38, 0.2);
}

[data-theme="dark"] .ai-feedback-form input,
[data-theme="dark"] .ai-feedback-form select,
[data-theme="dark"] .ai-feedback-form textarea {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .ai-feedback-history-item {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .ai-btn-secondary {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .ai-btn-secondary:hover {
  background: #475569 !important;
}

/* ============================================
   SETUP TAB (Onboarding Integration)
   ============================================ */

.ai-setup-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 12px;
}

/* Progress Bar */
.ai-setup-progress {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color, #e9ecef);
}

.ai-setup-progress-bar {
  height: 6px;
  background: var(--border-color, #e9ecef);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.ai-setup-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color, #2e8b57), #3cb371);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.ai-setup-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary, #6c757d);
}

.ai-setup-phase-name {
  font-weight: 500;
  color: var(--text-primary, #495057);
}

/* Messages Area */
.ai-setup-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
  min-height: 200px;
}

.ai-setup-messages .ai-message {
  display: flex;
  gap: 10px;
  animation: messageSlideIn 0.3s ease;
}

.ai-setup-messages .ai-message-user {
  flex-direction: row-reverse;
}

.ai-setup-messages .ai-message-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--primary-color, #2e8b57);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9rem;
}

.ai-setup-messages .ai-message-user .ai-message-avatar {
  background: var(--text-secondary, #495057);
}

.ai-setup-messages .ai-message-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 0.9rem;
}

.ai-setup-messages .ai-message-assistant .ai-message-bubble {
  background: var(--card-bg, #f8f9fa);
  color: var(--text-primary, #212529);
  border-bottom-left-radius: 4px;
}

.ai-setup-messages .ai-message-user .ai-message-bubble {
  background: var(--primary-color, #2e8b57);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Navigation Link in Messages */
.ai-setup-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--primary-color, #2e8b57);
  color: white;
  border-radius: 6px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s;
}

.ai-setup-nav-link:hover {
  background: #1a5c38;
}

/* Feature Unlock Badge */
.ai-setup-unlock-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #ffc107, #ff9800);
  color: #212529;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Typing Indicator */
.ai-setup-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--card-bg, #f8f9fa);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.ai-setup-typing span {
  width: 6px;
  height: 6px;
  background: var(--text-secondary, #adb5bd);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.ai-setup-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-setup-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* Input Area */
.ai-setup-input-wrapper {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color, #e9ecef);
}

.ai-setup-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 10px;
  font-size: 0.9rem;
  resize: none;
  min-height: 40px;
  max-height: 80px;
  transition: border-color 0.2s;
  background: var(--input-bg, #fff);
  color: var(--text-primary, #212529);
}

.ai-setup-input:focus {
  outline: none;
  border-color: var(--primary-color, #2e8b57);
}

.ai-setup-send-btn {
  width: 40px;
  height: 40px;
  background: var(--primary-color, #2e8b57);
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.2s;
}

.ai-setup-send-btn:hover {
  background: #1a5c38;
}

/* Action Buttons */
.ai-setup-actions {
  display: flex;
  justify-content: space-between;
  padding-top: 8px;
}

.ai-setup-skip-btn,
.ai-setup-pause-btn {
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary, #6c757d);
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.ai-setup-skip-btn:hover,
.ai-setup-pause-btn:hover {
  background: var(--hover-bg, #f1f3f5);
  color: var(--text-primary, #495057);
}

/* Setup Complete Celebration */
.ai-setup-celebration {
  text-align: center;
  padding: 20px;
}

.ai-setup-celebration-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.ai-setup-celebration h3 {
  margin: 0 0 8px;
  color: var(--text-primary, #212529);
}

.ai-setup-celebration p {
  margin: 0;
  color: var(--text-secondary, #6c757d);
  font-size: 0.9rem;
}

/* Setup tab indicator when onboarding active */
#ai-tab-setup.has-activity {
  position: relative;
}

#ai-tab-setup.has-activity::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: #ffc107;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Responsive */
@media (max-width: 768px) {
  .ai-assistant-panel {
    width: 100%;
    height: 75vh;
  }

  .ai-command-grid {
    grid-template-columns: 1fr;
  }

  .ai-assistant-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }

  .ai-setup-messages .ai-message-bubble {
    max-width: 90%;
  }

  /* Voice button - larger touch target on mobile */
  .ai-voice-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  /* Quick mic button on mobile */
  .ai-quick-mic-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .ai-buttons-row {
    gap: 6px;
  }

  /* Input area on mobile */
  .ai-setup-footer {
    padding: 8px 12px;
  }

  .ai-setup-footer .ai-setup-input-container {
    gap: 6px;
  }
}

/* ============================================
   FEEDBACK FILE UPLOAD STYLES
   ============================================ */

.ai-form-group label .optional {
  color: var(--text-secondary, #94a3b8);
  font-weight: 400;
  font-size: 0.75rem;
}

.ai-feedback-upload-area {
  margin-top: 8px;
}

.ai-upload-dropzone {
  border: 2px dashed var(--border-color, #334155);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-input, #1e293b);
}

.ai-upload-dropzone:hover {
  border-color: var(--primary-color, #2e8b57);
  background: rgba(46, 139, 87, 0.05);
}

.ai-upload-dropzone.dragover {
  border-color: var(--primary-color, #2e8b57);
  background: rgba(46, 139, 87, 0.1);
  transform: scale(1.01);
}

.ai-upload-dropzone i {
  font-size: 2rem;
  color: var(--text-secondary, #94a3b8);
  display: block;
  margin-bottom: 8px;
}

.ai-upload-dropzone p {
  margin: 0 0 4px 0;
  color: var(--text-primary, #f8fafc);
  font-size: 0.875rem;
}

.ai-upload-dropzone small {
  color: var(--text-secondary, #94a3b8);
  font-size: 0.75rem;
}

.ai-upload-browse {
  color: var(--primary-color, #2e8b57);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}

.ai-upload-browse:hover {
  color: var(--secondary-color, #3cb371);
}

/* Upload Preview Grid */
.ai-upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ai-upload-preview:empty {
  display: none;
}

.ai-upload-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-input, #1e293b);
  border: 1px solid var(--border-color, #334155);
}

.ai-upload-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-upload-preview-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.ai-upload-preview-icon.video {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
}

.ai-upload-preview-icon.pdf {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white;
}

.ai-upload-preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 20px 6px 6px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ai-upload-preview-item:hover .ai-upload-preview-overlay {
  opacity: 1;
}

.ai-upload-filename {
  color: white;
  font-size: 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.ai-upload-remove {
  background: rgba(239, 68, 68, 0.9);
  border: none;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-left: 4px;
  transition: all 0.15s ease;
}

.ai-upload-remove:hover {
  background: #ef4444;
  transform: scale(1.1);
}

/* ==========================================
   Proactive Field Hints
   ========================================== */

.ai-field-hint {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #7dd3fc;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 8px 0;
  animation: ai-hint-appear 0.3s ease;
}

@keyframes ai-hint-appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-field-hint-content {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  color: #0369a1;
  font-size: 13px;
  line-height: 1.5;
}

.ai-field-hint-content i {
  font-size: 18px;
  color: #0ea5e9;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-field-hint-actions {
  display: flex;
  gap: 8px;
}

.ai-hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: white;
}

.ai-hint-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ai-hint-btn.secondary {
  background: #f3f4f6;
  color: #6b7280;
}

.ai-hint-btn.secondary:hover {
  background: #e5e7eb;
  box-shadow: none;
}

.ai-hint-btn i {
  font-size: 14px;
}

/* Dark theme */
[data-theme="dark"] .ai-field-hint {
  background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
  border-color: #3b82f6;
}

[data-theme="dark"] .ai-field-hint-content {
  color: #93c5fd;
}

[data-theme="dark"] .ai-field-hint-content i {
  color: #60a5fa;
}

[data-theme="dark"] .ai-hint-btn.secondary {
  background: #374151;
  color: #d1d5db;
}

[data-theme="dark"] .ai-hint-btn.secondary:hover {
  background: #4b5563;
}

/* ================================================
   AI ACTION BUTTONS (CRM View Links)
   ================================================ */

.ai-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin: 6px 4px 6px 0;
  background: linear-gradient(135deg, #2e8b57 0%, #228b22 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(46, 139, 87, 0.2);
}

.ai-action-btn:hover {
  background: linear-gradient(135deg, #228b22 0%, #1a6b1a 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(46, 139, 87, 0.3);
  color: white;
  text-decoration: none;
}

.ai-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(46, 139, 87, 0.2);
}

.ai-action-btn i {
  font-size: 1rem;
}

/* Multiple buttons container */
.ai-message-bubble .ai-action-btn + .ai-action-btn {
  margin-left: 4px;
}

/* Dark theme action buttons */
[data-theme="dark"] .ai-action-btn {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}

[data-theme="dark"] .ai-action-btn:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 4px 8px rgba(5, 150, 105, 0.4);
}

/* ================================================
   AI INTERACTIVE QUESTIONS
   ================================================ */

.ai-interactive-question {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}

.ai-question-prompt {
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 12px 0;
  font-size: 0.9rem;
}

.ai-question-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-question-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-size: 0.875rem;
  color: #475569;
}

.ai-question-option:hover {
  border-color: #2e8b57;
  background: #f0fdf4;
}

.ai-question-option.selected {
  border-color: #2e8b57;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #166534;
}

.ai-question-option.selected i {
  color: #2e8b57;
}

.ai-question-option i {
  font-size: 1.1rem;
  color: #94a3b8;
  flex-shrink: 0;
}

.ai-question-option span {
  flex: 1;
}

.ai-question-submit {
  margin-top: 12px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #2e8b57 0%, #228b22 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-question-submit:hover {
  background: linear-gradient(135deg, #228b22 0%, #1a6b1a 100%);
  transform: translateY(-1px);
}

.ai-question-submit:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

/* Answered state */
.ai-interactive-question.answered {
  opacity: 0.7;
  pointer-events: none;
}

.ai-interactive-question.answered::after {
  content: 'Answered';
  display: block;
  text-align: center;
  margin-top: 8px;
  font-size: 0.75rem;
  color: #2e8b57;
  font-weight: 500;
}

/* Dark theme questions */
[data-theme="dark"] .ai-interactive-question {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .ai-question-prompt {
  color: #e2e8f0;
}

[data-theme="dark"] .ai-question-option {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .ai-question-option:hover {
  border-color: #059669;
  background: #064e3b;
}

[data-theme="dark"] .ai-question-option.selected {
  border-color: #059669;
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
  color: #6ee7b7;
}

[data-theme="dark"] .ai-question-option i {
  color: #64748b;
}

[data-theme="dark"] .ai-question-option.selected i {
  color: #10b981;
}
