/**
 * Command Search Modal Styles
 * Search-specific styling only - Base modal styles inherited from main.css
 *
 * Architecture (Sessie 33):
 * - Uses generic .modal and .modal-content from main.css
 * - Only search-specific components styled here
 *
 * Design (Sessie 29):
 * - Muted categories (gray) + saturated commands (green) = clear hierarchy
 * - Light mode: +20% saturation vs dark mode
 */

/* ========================================
   MODAL CONTAINER OVERRIDES
   ======================================== */

/* Override max-height for search modal */
.command-search-modal {
  max-height: 600px; /* Fallback for old browsers */
  max-height: min(600px, 70dvh); /* Dynamic viewport height */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Clips children to border-radius */
}

/* ========================================
   HEADER
   ======================================== */

.command-search-modal-header {
  display: flex;
  align-items: center;
  justify-content: center; /* Center the h2 since close button is absolute */
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-terminal);
}

[data-theme="light"] .command-search-modal-header {
  background: var(--color-bg-modal);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.command-search-modal-header h2 {
  font-family: var(--font-family-primary);
  font-size: 1.25rem;
  color: var(--color-success);
  margin: 0;
  font-weight: bold;
}

/* ========================================
   SEARCH INPUT
   ======================================== */

.command-search-input-container {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-terminal);
  flex-shrink: 0; /* Prevent compression */
}

[data-theme="light"] .command-search-input-container {
  background: var(--color-bg-modal);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#command-search-input {
  width: 100%;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-button);
  padding: var(--spacing-md);
  color: var(--color-text);
  font-family: var(--font-family-primary);
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#command-search-input:focus {
  outline: none;
  border-color: var(--color-success);
  box-shadow: 0 0 0 2px rgba(0, 255, 0, 0.2);
}

#command-search-input::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.6;
}

/* ========================================
   BODY OVERRIDES
   ======================================== */

.command-search-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-bg-terminal);
}

[data-theme="light"] .command-search-modal-body {
  background: var(--color-bg-modal);
}

/* Custom scrollbar inherited from main.css .modal-body - no override needed (Sessie 37) */

/* ========================================
   COMMAND LIST
   ======================================== */

.command-category {
  margin-bottom: var(--spacing-lg);
}

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

/* Category Header - Muted gray (Sessie 29 hierarchy) */
.command-category-header {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-sm);
  padding-left: var(--spacing-sm);
  font-family: var(--font-family-primary);
}

/* Command Items - Saturated green (primary content) */
.command-item {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-left: 2px solid transparent;
  border-radius: var(--border-radius-button);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family-primary);
}

.command-item:hover,
.command-item.selected {
  background: rgba(0, 255, 0, 0.1);
  border-left-color: var(--color-success);
}

[data-theme="light"] .command-item:hover,
[data-theme="light"] .command-item.selected {
  background: rgba(9, 105, 218, 0.08); /* GitHub blue tint in light mode */
}

.command-item:active {
  transform: translateX(2px);
}

.command-item-name {
  color: var(--color-success);
  font-weight: bold;
  font-size: 1rem;
  white-space: nowrap;
}

.command-item-description {
  color: var(--color-text);
  font-size: 0.875rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty State */
.command-search-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--color-text-secondary);
  font-family: var(--font-family-primary);
}

.command-search-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.3;
}

.command-search-empty-text {
  font-size: 1rem;
}

/* ========================================
   TIP STYLING (in body)
   ======================================== */

.command-search-tip {
  font-family: var(--font-family-primary);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-md) 0;
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(0, 255, 0, 0.05);
  border-left: 2px solid var(--color-success);
  border-radius: var(--border-radius-button);
}

[data-theme="light"] .command-search-tip {
  background: rgba(9, 105, 218, 0.05);
  border-left-color: var(--color-info);
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .command-search-modal {
    max-width: none;
    max-height: none;
    height: 100vh; /* Fallback */
    height: 100dvh; /* iOS Safari dynamic viewport */
    border-radius: 0;
    box-shadow: none;
  }

  .command-search-modal-header h2 {
    font-size: 1.125rem;
  }

  #command-search-input {
    font-size: 16px; /* Prevent iOS zoom on focus */
  }

  .command-item {
    padding: var(--spacing-lg);
    min-height: 44px; /* WCAG AAA touch target */
  }

  .command-item-name {
    font-size: 1rem;
  }

  .command-item-description {
    font-size: 0.875rem;
  }
}
