/**
 * DaysAndDates.com - Command Palette & Search Styles
 * Linear / Raycast inspired modal interface
 */

.command-palette-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(3rem, 10vh, 7rem);
  padding-inline: 1rem;
}

.command-palette-modal[hidden] {
  display: none !important;
}

.command-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 15, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn 180ms ease;
}

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

.command-palette-container {
  position: relative;
  width: 100%;
  max-width: 640px;
  z-index: 2;
  animation: popIn 220ms var(--ease-spring);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.command-palette-box {
  background: var(--surface-base);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px var(--glass-highlight);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.command-search-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-base);
}

.command-search-icon {
  font-size: 1.2rem;
  color: var(--brand-primary);
  flex-shrink: 0;
}

.command-search-input {
  flex-grow: 1;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
}

.command-search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.command-search-clear {
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0;
  transition: color var(--transition-fast);
}

.command-search-clear:hover {
  color: var(--text-primary);
}

.command-esc-badge {
  background: var(--surface-muted);
  border: 1px solid var(--border-medium);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.command-results {
  max-height: 420px;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.command-group-header {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
}

.command-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.command-item:hover,
.command-item.is-selected {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.command-item-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.bg-primary-light { background: var(--brand-primary-light); }
.text-primary { color: var(--brand-primary); }

.bg-success-light { background: var(--brand-emerald-light); }
.text-success { color: var(--brand-emerald); }

.bg-purple-light { background: var(--brand-celestial-light); }
.text-purple { color: var(--brand-celestial); }

.bg-warning-light { background: var(--brand-accent-light); }
.text-warning { color: var(--brand-accent); }

.bg-danger-light { background: var(--brand-rose-light); }
.text-danger { color: var(--brand-rose); }

.bg-info-light { background: var(--brand-cyan-light); }
.text-info { color: var(--brand-cyan); }

.command-item-meta {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.command-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
}

.command-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.command-item-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.command-palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-tip kbd {
  background: var(--surface-base);
  border: 1px solid var(--border-medium);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.footer-brand {
  font-weight: 600;
  letter-spacing: var(--ls-wide);
}

/* ==========================================================================
   Mobile Screen Optimizations (Touch & Virtual Keyboard Friendly)
   ========================================================================== */
@media (max-width: 575.98px) {
  .command-palette-modal {
    padding-top: 0.75rem;
    padding-inline: 0.5rem;
    align-items: flex-start;
  }

  .command-palette-container {
    max-height: calc(100dvh - 1.5rem);
  }

  .command-palette-box {
    border-radius: var(--radius-lg, 16px);
    max-height: calc(100dvh - 1.5rem);
  }

  .command-search-bar {
    padding: 0.85rem 1rem;
    gap: 0.65rem;
  }

  .command-search-input {
    font-size: 16px !important;
  }

  .command-results {
    max-height: calc(100dvh - 160px);
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .command-item {
    padding: 0.6rem 0.75rem;
    gap: 0.65rem;
  }

  .command-item-icon {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }

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

