/* ============================================================================
   COMMAND PALETTE STYLES
   ============================================================================ */

/* Container & Backdrop */
.command-palette {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.command-palette.hidden {
  display: none;
}

.command-palette-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Content Container */
.command-palette-content {
  position: relative;
  /* width: 90%;
  max-width: 640px; */
  background: var(--kt-card-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: slideDown 0.2s ease-out;
}

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

/* Header */
.command-palette-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--kt-border-color, #e5e7eb);
}

.command-palette-header i {
  color: var(--kt-text-muted, #6b7280);
  flex-shrink: 0;
}

.command-palette-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--kt-text-base, #1f2937);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.command-palette-input::placeholder {
  color: var(--kt-text-muted, #9ca3af);
}

.command-palette-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--kt-text-muted, #6b7280);
  background: var(--kt-bg-secondary, #f3f4f6);
  border-radius: 4px;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Suggestions Container */
.command-palette-suggestions {
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--kt-scrollbar-thumb, #d1d5db) transparent;
}

.command-palette-suggestions::-webkit-scrollbar {
  width: 8px;
}

.command-palette-suggestions::-webkit-scrollbar-track {
  background: transparent;
}

.command-palette-suggestions::-webkit-scrollbar-thumb {
  background-color: var(--kt-scrollbar-thumb, #d1d5db);
  border-radius: 4px;
}

.command-palette-suggestions::-webkit-scrollbar-thumb:hover {
  background-color: var(--kt-scrollbar-thumb-hover, #9ca3af);
}

/* Suggestions List */
.command-suggestions-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

/* Category Headers */
.command-category {
  padding: 8px 20px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kt-text-muted, #6b7280);
  margin-top: 8px;
}

.command-category:first-child {
  margin-top: 0;
}

/* Command Suggestions */
.command-suggestion {
  padding: 10px 20px;
  cursor: pointer;
  transition: background-color 0.1s ease;
  border-left: 3px solid transparent;
}

.command-suggestion:hover {
  background-color: var(--kt-bg-hover, #f9fafb);
}

.command-suggestion.selected {
  background-color: var(--kt-bg-selected, #eff6ff);
  border-left-color: var(--kt-primary, #3b82f6);
}

.command-suggestion-main {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.command-suggestion-cmd {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--kt-text-base, #1f2937);
}

.command-params {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 12px;
  color: var(--kt-text-muted, #6b7280);
  font-style: italic;
}

.command-suggestion-desc {
  font-size: 13px;
  color: var(--kt-text-secondary, #4b5563);
  line-height: 1.4;
}

.command-suggestion.selected .command-suggestion-cmd {
  color: var(--kt-primary, #3b82f6);
}

/* Empty State */
.command-suggestion-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  color: var(--kt-text-muted, #6b7280);
}

.command-suggestion-empty i {
  font-size: 20px;
}

/* Footer */
.command-palette-footer {
  display: none; /* Hidden by default, shown as popup via /help command */
  padding: 12px 20px;
  border-top: 1px solid var(--kt-border-color, #e5e7eb);
  background: var(--kt-bg-secondary, #f9fafb);
}

.command-palette-footer kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--kt-text-base, #374151);
  background: var(--kt-card-bg, #ffffff);
  border: 1px solid var(--kt-border-color, #d1d5db);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Dark Mode Support */
[data-kt-theme-mode="dark"] .command-palette-content {
  --kt-card-bg: #1f2937;
  --kt-border-color: #374151;
  --kt-text-base: #f9fafb;
  --kt-text-secondary: #d1d5db;
  --kt-text-muted: #9ca3af;
  --kt-bg-secondary: #111827;
  --kt-bg-hover: #374151;
  --kt-bg-selected: #1e3a8a;
  --kt-primary: #60a5fa;
  --kt-scrollbar-thumb: #4b5563;
  --kt-scrollbar-thumb-hover: #6b7280;
}

[data-kt-theme-mode="dark"] .command-palette-backdrop {
  background-color: rgba(0, 0, 0, 0.7);
}

/* Responsive */
@media (max-width: 640px) {
  .command-palette {
    padding-top: 10vh;
  }

  .command-palette-content {
    width: 95%;
    max-width: none;
  }

  .command-palette-header {
    padding: 12px 16px;
  }

  .command-palette-input {
    font-size: 14px;
  }

  .command-suggestion {
    padding: 8px 16px;
  }

  .command-palette-footer {
    padding: 10px 16px;
  }
}

/* Animation for quick actions */
.command-suggestion[data-quick-action="true"] {
  animation: quickActionPulse 0.3s ease-out;
}

@keyframes quickActionPulse {
  0% {
    background-color: var(--kt-primary, #3b82f6);
    transform: scale(1.02);
  }
  100% {
    background-color: transparent;
    transform: scale(1);
  }
}

/* Loading indicator */
.command-palette-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--kt-text-muted, #6b7280);
}

.command-palette-loading::after {
  content: '';
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid var(--kt-border-color, #e5e7eb);
  border-top-color: var(--kt-primary, #3b82f6);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Help Popup Modal */
.command-help-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.command-help-modal.visible {
  display: flex;
}

.command-help-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

.command-help-content {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  background: var(--kt-card-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: slideDown 0.2s ease-out;
  display: flex;
  flex-direction: column;
}

.command-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--kt-border-color, #e5e7eb);
  background: var(--kt-bg-secondary, #f9fafb);
}

.command-help-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--kt-text-base, #1f2937);
}

.command-help-title i {
  font-size: 24px;
  color: var(--kt-primary, #3b82f6);
}

.command-help-close {
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--kt-text-muted, #6b7280);
  border-radius: 6px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.command-help-close:hover {
  background: var(--kt-bg-hover, #f3f4f6);
  color: var(--kt-text-base, #1f2937);
}

.command-help-close i {
  font-size: 20px;
}

.command-help-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.command-help-section {
  margin-bottom: 32px;
}

.command-help-section:last-child {
  margin-bottom: 0;
}

.command-help-section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kt-text-muted, #6b7280);
  margin-bottom: 16px;
}

.command-help-list {
  display: grid;
  gap: 12px;
}

.command-help-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--kt-bg-secondary, #f9fafb);
  border-radius: 8px;
  border: 1px solid var(--kt-border-color, #e5e7eb);
}

.command-help-item-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--kt-card-bg, #ffffff);
  border-radius: 6px;
  color: var(--kt-primary, #3b82f6);
  font-size: 18px;
}

.command-help-item-content {
  flex: 1;
}

.command-help-item-cmd {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--kt-text-base, #1f2937);
  margin-bottom: 4px;
}

.command-help-item-desc {
  font-size: 13px;
  color: var(--kt-text-secondary, #6b7280);
  line-height: 1.4;
}

.command-help-shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px;
  background: var(--kt-bg-secondary, #f9fafb);
  border-radius: 8px;
}

.command-help-shortcut {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.command-help-shortcut kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--kt-text-base, #374151);
  background: var(--kt-card-bg, #ffffff);
  border: 1px solid var(--kt-border-color, #d1d5db);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.command-help-shortcut span {
  color: var(--kt-text-secondary, #6b7280);
}

/* Dark mode for help modal */
[data-kt-theme-mode="dark"] .command-help-content {
  --kt-card-bg: #1f2937;
  --kt-border-color: #374151;
  --kt-text-base: #f9fafb;
  --kt-text-secondary: #d1d5db;
  --kt-text-muted: #9ca3af;
  --kt-bg-secondary: #111827;
  --kt-bg-hover: #374151;
  --kt-primary: #60a5fa;
}

[data-kt-theme-mode="dark"] .command-help-backdrop {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Responsive help modal */
@media (max-width: 640px) {
  .command-help-content {
    width: 95%;
    max-height: 90vh;
  }

  .command-help-header {
    padding: 16px 20px;
  }

  .command-help-title {
    font-size: 16px;
  }

  .command-help-body {
    padding: 20px;
  }

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