/**
 * AI COMMAND BAR STYLES
 * Spotlight/Raycast-style command interface
 * Smooth animations, keyboard-first design
 */

/* ═══════════════════════════════════════════════════════════════════════ */
/* OVERLAY & MODAL CONTAINER */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ai-cmd-overlay[style*="display: flex"] {
  opacity: 1;
}

.ai-cmd-modal {
  width: 100%;
  max-width: 640px;
  background: var(--app-field-bg, #1a1a1a);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
              0 0 1px rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.ai-cmd-modal.ai-cmd-modal-enter {
  transform: scale(1);
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* HEADER & INPUT */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-cmd-header {
  position: relative;
  padding: 20px;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-cmd-input {
  flex: 1;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary, #ffffff);
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  font-family: inherit;
}

.ai-cmd-input::placeholder {
  color: var(--text-muted, rgba(255, 255, 255, 0.4));
}

/* Processing indicator */
.ai-cmd-processing {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--blue, #3366ff);
  font-size: 12px;
}

.ai-cmd-processing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue, #3366ff);
  animation: aiCmdPulse 1.5s ease-in-out infinite;
}

@keyframes aiCmdPulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* RESULTS LIST */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-cmd-results {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.ai-cmd-results::-webkit-scrollbar {
  width: 8px;
}

.ai-cmd-results::-webkit-scrollbar-track {
  background: transparent;
}

.ai-cmd-results::-webkit-scrollbar-thumb {
  background: var(--text-muted, rgba(255, 255, 255, 0.2));
  border-radius: 4px;
}

.ai-cmd-results::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted, rgba(255, 255, 255, 0.3));
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* CATEGORY HEADERS */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-cmd-category {
  padding: 12px 20px 8px 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
  margin-top: 4px;
}

.ai-cmd-category:first-child {
  margin-top: 0;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* RESULT ITEM */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-cmd-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  border-left: 3px solid transparent;
}

.ai-cmd-result:hover {
  background-color: var(--hover-bg, rgba(255, 255, 255, 0.08));
}

.ai-cmd-result.selected {
  background-color: var(--selected-bg, rgba(51, 102, 255, 0.15));
  border-left-color: var(--blue, #3366ff);
}

.ai-cmd-result:active {
  background-color: var(--active-bg, rgba(51, 102, 255, 0.25));
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* RESULT ICON */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-cmd-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

.ai-cmd-result.selected .ai-cmd-icon {
  color: var(--blue, #3366ff);
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* RESULT TEXT & LABELS */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-cmd-result-text {
  flex: 1;
  min-width: 0;
}

.ai-cmd-result-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #ffffff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-cmd-result-subtitle {
  font-size: 12px;
  color: var(--text-muted, rgba(255, 255, 255, 0.45));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.ai-cmd-result-meta {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted, rgba(255, 255, 255, 0.4));
  font-family: 'Monaco', 'Courier New', monospace;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* SIDEBAR BUTTON & HINT */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-cmd-trigger {
  background: transparent;
  border: none;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 18px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ai-cmd-trigger:hover {
  background-color: var(--hover-bg, rgba(255, 255, 255, 0.08));
  color: var(--text-primary, #ffffff);
}

.ai-cmd-trigger:active {
  background-color: var(--active-bg, rgba(255, 255, 255, 0.12));
}

.ai-cmd-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 12px 12px 0 12px;
  font-size: 12px;
  color: var(--text-muted, rgba(255, 255, 255, 0.5));
  background: var(--hover-bg, rgba(255, 255, 255, 0.05));
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.ai-cmd-hint:hover {
  color: var(--text-primary, #ffffff);
  background: var(--hover-bg, rgba(255, 255, 255, 0.08));
  border-color: var(--border-color, rgba(255, 255, 255, 0.12));
}

.ai-cmd-hint .icon {
  flex-shrink: 0;
}

.ai-cmd-hint kbd {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 10px;
  padding: 2px 4px;
  background: var(--text-muted, rgba(255, 255, 255, 0.1));
  border-radius: 3px;
  margin-left: auto;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* AI ANSWER MODAL */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-answer-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 20px;
  animation: aiAnswerFadeIn 0.3s ease;
}

@keyframes aiAnswerFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.ai-answer-content {
  background: var(--app-field-bg, #1a1a1a);
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  position: relative;
  animation: aiAnswerScale 0.3s ease;
}

@keyframes aiAnswerScale {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.ai-answer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-secondary, rgba(255, 255, 255, 0.5));
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.ai-answer-close:hover {
  color: var(--text-primary, #ffffff);
}

.ai-answer-content h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #ffffff);
}

.ai-answer-content p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* MOBILE RESPONSIVE */
/* ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .ai-cmd-overlay {
    padding-top: auto;
    padding-bottom: 0;
    align-items: flex-end;
  }

  .ai-cmd-modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 80vh;
  }

  .ai-cmd-result {
    padding: 12px 16px;
  }

  .ai-cmd-header {
    padding: 16px;
  }

  .ai-cmd-category {
    padding: 10px 16px 6px 16px;
  }

  .ai-answer-modal {
    padding: 16px;
  }

  .ai-answer-content {
    max-width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* ACCESSIBILITY */
/* ═══════════════════════════════════════════════════════════════════════ */

.ai-cmd-input:focus {
  outline: none;
}

.ai-cmd-result:focus-visible {
  outline: 2px solid var(--blue, #3366ff);
  outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
  .ai-cmd-modal,
  .ai-cmd-processing-dot,
  .ai-answer-modal,
  .ai-answer-content {
    animation: none !important;
    transition: none !important;
  }
}
