/**
 * Spotlight Search - Command Palette
 * Keyboard-triggered search overlay with fuzzy filtering
 * Design: Glassmorphism matching 1.wien component patterns
 */

/* ============================================
   SPOTLIGHT TRIGGER BUTTON (optional)
   ============================================ */
.spotlight-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 0.5rem);
  color: var(--text-secondary, #E8ECFF);
  font-size: var(--text-sm, 0.875rem);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.spotlight-trigger:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--text-primary, #fff);
}

.spotlight-trigger:focus-visible {
  outline: 2px solid var(--color-cyan, #00D4FF);
  outline-offset: 2px;
}

.spotlight-trigger svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.spotlight-trigger-text {
  font-weight: var(--weight-medium, 500);
}

.spotlight-trigger-kbd {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm, 0.25rem);
  font-size: var(--text-xs, 0.75rem);
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-tertiary, #C5C9D6);
  margin-left: var(--space-1, 0.25rem);
}

/* ============================================
   SPOTLIGHT OVERLAY
   ============================================ */
.spotlight-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 500);
  background: rgba(10, 14, 39, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh var(--space-4, 1rem) var(--space-4, 1rem);

  /* Hidden state */
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0s 0.2s;
}

.spotlight-overlay.active {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

/* ============================================
   SPOTLIGHT MODAL
   ============================================ */
.spotlight-modal {
  width: 100%;
  max-width: 620px;
  max-height: 70vh;
  background: rgba(20, 25, 50, 0.95);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl, 1.5rem);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 212, 255, 0.1),
    0 0 80px rgba(0, 212, 255, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;

  /* Animation */
  transform: scale(0.95) translateY(-20px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spotlight-overlay.active .spotlight-modal {
  transform: scale(1) translateY(0);
}

/* ============================================
   SEARCH HEADER
   ============================================ */
.spotlight-header {
  padding: var(--space-4, 1rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.spotlight-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg, 1rem);
  transition: all 0.2s ease;
}

.spotlight-input-wrapper:focus-within {
  border-color: var(--color-cyan, #00D4FF);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.spotlight-search-icon {
  width: 20px;
  height: 20px;
  fill: var(--text-tertiary, #C5C9D6);
  flex-shrink: 0;
  transition: fill 0.2s ease;
}

.spotlight-input-wrapper:focus-within .spotlight-search-icon {
  fill: var(--color-cyan, #00D4FF);
}

.spotlight-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary, #fff);
  font-size: var(--text-lg, 1.125rem);
  font-weight: var(--weight-medium, 500);
  font-family: inherit;
  min-width: 0;
}

.spotlight-input::placeholder {
  color: var(--text-tertiary, #C5C9D6);
}

/* Prevent iOS zoom on focus */
@supports (-webkit-touch-callout: none) {
  .spotlight-input {
    font-size: 16px;
  }
}

.spotlight-kbd {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm, 0.25rem);
  font-size: var(--text-xs, 0.75rem);
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-tertiary, #C5C9D6);
  flex-shrink: 0;
}

/* ============================================
   SEARCH RESULTS
   ============================================ */
.spotlight-results {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2, 0.5rem) 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.3) transparent;
}

.spotlight-results::-webkit-scrollbar {
  width: 6px;
}

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

.spotlight-results::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.3);
  border-radius: 3px;
}

/* ============================================
   RESULT SECTIONS
   ============================================ */
.spotlight-section {
  padding: 0 var(--space-4, 1rem);
  margin-bottom: var(--space-3, 0.75rem);
}

.spotlight-section:last-child {
  margin-bottom: var(--space-2, 0.5rem);
}

.spotlight-section.hidden {
  display: none;
}

.spotlight-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2, 0.5rem) 0;
  margin-bottom: var(--space-1, 0.25rem);
}

.spotlight-section-title {
  font-size: var(--text-xs, 0.75rem);
  font-weight: var(--weight-bold, 700);
  color: var(--color-cyan, #00D4FF);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.spotlight-section-count {
  font-size: var(--text-xs, 0.75rem);
  color: var(--text-tertiary, #C5C9D6);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: var(--radius-full, 9999px);
}

.spotlight-clear-recent {
  font-size: var(--text-xs, 0.75rem);
  color: var(--text-tertiary, #C5C9D6);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-1, 0.25rem) var(--space-2, 0.5rem);
  border-radius: var(--radius-sm, 0.25rem);
  transition: all 0.2s ease;
  font-family: inherit;
}

.spotlight-clear-recent:hover {
  color: var(--color-cyan, #00D4FF);
  background: rgba(0, 212, 255, 0.1);
}

/* ============================================
   RESULT ITEMS
   ============================================ */
.spotlight-section-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spotlight-item {
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  padding: var(--space-3, 0.75rem);
  margin: 0 calc(var(--space-2, 0.5rem) * -1);
  border-radius: var(--radius-md, 0.5rem);
  color: var(--text-secondary, #E8ECFF);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 2px solid transparent;
}

.spotlight-item:hover,
.spotlight-item.focused {
  background: rgba(0, 212, 255, 0.1);
  color: var(--text-primary, #fff);
}

.spotlight-item.focused {
  border-color: var(--color-cyan, #00D4FF);
  background: rgba(0, 212, 255, 0.15);
}

/* Item Icon/Number */
.spotlight-item-icon,
.spotlight-item-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  background: var(--gradient-primary, linear-gradient(135deg, #00D4FF 0%, #7B3FF2 100%));
  border-radius: var(--radius-md, 0.5rem);
  flex-shrink: 0;
}

.spotlight-item-icon svg {
  width: 18px;
  height: 18px;
  fill: var(--color-white, #fff);
}

.spotlight-item-num {
  color: var(--color-white, #fff);
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-bold, 700);
}

/* City items - different gradient */
.spotlight-item[data-type="city"] .spotlight-item-num {
  background: linear-gradient(135deg, #7B3FF2 0%, #00D4FF 100%);
}

/* Industry items - different gradient */
.spotlight-item[data-type="industry"] .spotlight-item-icon {
  background: linear-gradient(135deg, #FF6B6B 0%, #FFE66D 100%);
}

/* Item Content */
.spotlight-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spotlight-item-title {
  font-size: var(--text-base, 1rem);
  font-weight: var(--weight-medium, 500);
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Highlight matched text */
.spotlight-item-title mark {
  background: rgba(0, 212, 255, 0.3);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

.spotlight-item-desc {
  font-size: var(--text-sm, 0.875rem);
  color: var(--text-tertiary, #C5C9D6);
}

/* Arrow indicator */
.spotlight-item-arrow {
  width: 16px;
  height: 16px;
  fill: var(--text-tertiary, #C5C9D6);
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.15s ease;
}

.spotlight-item:hover .spotlight-item-arrow,
.spotlight-item.focused .spotlight-item-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   NO RESULTS
   ============================================ */
.spotlight-no-results {
  text-align: center;
  padding: var(--space-8, 3rem) var(--space-4, 1rem);
  color: var(--text-tertiary, #C5C9D6);
}

.spotlight-no-results.hidden {
  display: none;
}

.spotlight-no-results p {
  margin: 0;
  font-size: var(--text-base, 1rem);
}

/* ============================================
   FOOTER HINTS
   ============================================ */
.spotlight-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5, 1.5rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.spotlight-hint {
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  font-size: var(--text-xs, 0.75rem);
  color: var(--text-tertiary, #C5C9D6);
}

.spotlight-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm, 0.25rem);
  font-size: 11px;
  font-family: var(--font-mono, ui-monospace, monospace);
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 767px) {
  .spotlight-overlay {
    padding: 8vh var(--space-3, 0.75rem) var(--space-3, 0.75rem);
  }

  .spotlight-modal {
    max-height: 85vh;
    border-radius: var(--radius-lg, 1rem);
  }

  .spotlight-trigger-text,
  .spotlight-trigger-kbd {
    display: none;
  }

  .spotlight-footer {
    display: none;
  }

  .spotlight-input {
    font-size: 16px; /* Prevent iOS zoom */
  }

  .spotlight-header {
    padding: var(--space-3, 0.75rem);
  }

  .spotlight-input-wrapper {
    padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
  }

  .spotlight-item {
    padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
  }

  .spotlight-item-icon,
  .spotlight-item-num {
    min-width: 32px;
    height: 32px;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .spotlight-overlay,
  .spotlight-modal,
  .spotlight-item,
  .spotlight-item-arrow {
    transition: none;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .spotlight-overlay,
  .spotlight-trigger {
    display: none !important;
  }
}
