/* Command Palette Styles */
/* Global component for unified search across KOTA dashboards */

/* Modal Overlay */
.command-palette-modal {
  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-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

@media (prefers-color-scheme: dark) {
  .command-palette-backdrop {
    background: rgba(0, 0, 0, 0.8);
  }
}

/* Palette Content */
.command-palette-content {
  position: relative;
  width: 90%;
  max-width: 640px;
  max-height: 70vh;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  .command-palette-content {
    background: rgba(25, 25, 25, 0.95);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  }
}

/* Header */
.command-palette-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  .command-palette-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
}

.command-palette-header input {
  width: 100%;
  padding: 1rem;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  outline: none;
  color: #222;
}

.command-palette-header input::placeholder {
  color: #999;
}

@media (prefers-color-scheme: dark) {
  .command-palette-header input {
    color: #f5f5f5;
  }

  .command-palette-header input::placeholder {
    color: #666;
  }
}

/* Tabs */
.command-palette-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem 0.75rem 1rem;
}

.tab-btn {
  padding: 0.35rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #666;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  background: rgba(8, 145, 178, 0.1);
  color: #0891b2;
}

.tab-btn.active {
  background: #0891b2;
  color: white;
}

@media (prefers-color-scheme: dark) {
  .tab-btn {
    color: #999;
  }

  .tab-btn:hover {
    background: rgba(34, 211, 238, 0.15);
    color: #22d3ee;
  }

  .tab-btn.active {
    background: #22d3ee;
    color: #111;
  }
}

/* Results Container */
.command-palette-results {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.results-section {
  margin-bottom: 1.5rem;
}

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

.results-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  color: #999;
  margin: 0 0 0.75rem 0;
  padding: 0 0.5rem;
}

@media (prefers-color-scheme: dark) {
  .results-section h3 {
    color: #666;
  }
}

/* Quick Action Buttons */
#quick-actions-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.quick-action-btn:hover {
  background: rgba(8, 145, 178, 0.05);
  border-color: #0891b2;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.15);
}

@media (prefers-color-scheme: dark) {
  .quick-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .quick-action-btn:hover {
    background: rgba(34, 211, 238, 0.1);
    border-color: #22d3ee;
    box-shadow: 0 2px 8px rgba(34, 211, 238, 0.2);
  }
}

.action-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.action-content {
  flex: 1;
}

.action-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 0.15rem;
}

.action-description {
  font-size: 0.75rem;
  color: #666;
}

@media (prefers-color-scheme: dark) {
  .action-title {
    color: #f5f5f5;
  }

  .action-description {
    color: #999;
  }
}

/* Result Items */
.result-item {
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.75rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-radius: 4px;
  transition: all 0.15s ease;
  margin-bottom: 0.35rem;
}

.result-item:hover,
.result-item.selected {
  background: rgba(8, 145, 178, 0.1);
  border-left-color: #0891b2;
}

@media (prefers-color-scheme: dark) {
  .result-item:hover,
  .result-item.selected {
    background: rgba(34, 211, 238, 0.15);
    border-left-color: #22d3ee;
  }
}

.result-icon {
  display: flex;
  align-items: flex-start;
}

.result-content {
  flex: 1;
  min-width: 0;
}

.result-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: #222;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-description {
  font-size: 0.8rem;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .result-title {
    color: #f5f5f5;
  }

  .result-description {
    color: #999;
  }
}

.result-meta {
  display: flex;
  gap: 0.35rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* Source Badges */
.source-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1;
}

.source-memory {
  background: #e0f2fe;
  color: #0369a1;
}

.source-task {
  background: #d1fae5;
  color: #047857;
}

.source-webhook {
  background: #fef3c7;
  color: #b45309;
}

.source-calendar {
  background: #e0e7ff;
  color: #4338ca;
}

@media (prefers-color-scheme: dark) {
  .source-memory {
    background: #0c4a6e;
    color: #bae6fd;
  }

  .source-task {
    background: #065f46;
    color: #a7f3d0;
  }

  .source-webhook {
    background: #78350f;
    color: #fde68a;
  }

  .source-calendar {
    background: #3730a3;
    color: #c7d2fe;
  }
}

/* Metadata Badges */
.meta-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  background: rgba(8, 145, 178, 0.1);
  color: #0891b2;
}

@media (prefers-color-scheme: dark) {
  .meta-badge {
    background: rgba(34, 211, 238, 0.15);
    color: #22d3ee;
  }
}

/* Empty State */
.empty-message {
  text-align: center;
  padding: 2rem 1rem;
  color: #999;
  font-size: 0.9rem;
}

@media (prefers-color-scheme: dark) {
  .empty-message {
    color: #666;
  }
}

/* Loading State */
.loading-message {
  text-align: center;
  padding: 2rem 1rem;
  color: #0891b2;
  font-size: 0.9rem;
  animation: pulse 2s ease infinite;
}

@media (prefers-color-scheme: dark) {
  .loading-message {
    color: #22d3ee;
  }
}

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

/* Footer */
.command-palette-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  .command-palette-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
  }
}

.keyboard-hint {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: #666;
  align-items: center;
}

.keyboard-hint kbd {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
  font-family: monospace;
  font-size: 0.7rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  .keyboard-hint {
    color: #999;
  }

  .keyboard-hint kbd {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .command-palette-modal {
    padding-top: 0;
    align-items: stretch;
  }

  .command-palette-content {
    width: 100%;
    max-width: none;
    max-height: 100vh;
    border-radius: 0;
  }

  .command-palette-tabs {
    overflow-x: auto;
    white-space: nowrap;
  }

  #quick-actions-list {
    grid-template-columns: 1fr;
  }

  .result-item {
    flex-direction: column;
    gap: 0.5rem;
  }

  .result-meta {
    margin-top: 0.35rem;
  }
}

/* Scrollbar Styling */
.command-palette-results::-webkit-scrollbar {
  width: 8px;
}

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

.command-palette-results::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.command-palette-results::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  .command-palette-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
  }

  .command-palette-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
  }
}
