/* ── Search bar (Spotlight-style) ── */
.search-bar-wrapper {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 16px;
  flex-shrink: 0;
}

.search-bar-form {
  position: relative;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

[data-theme="dark"] .search-bar {
  background: rgba(26, 26, 26, 0.80);
}

.search-bar.focused {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus), 0 0 0 1px var(--ring);
}

.search-bar-icon {
  padding-left: 16px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.search-bar-icon svg {
  width: 18px;
  height: 18px;
  color: var(--fg-faint);
  opacity: 0.7;
}

.search-bar-icon .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--fg-muted);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.search-bar input {
  flex: 1;
  padding: 16px 12px;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--fg);
  outline: none;
  font-family: var(--font);
}

.search-bar input.command-mode {
  font-family: var(--font-mono);
}

.search-bar input::placeholder {
  color: var(--fg-faint);
  opacity: 0.5;
}

/* Keyboard shortcut hint */
.search-bar-kbd {
  padding-right: 16px;
  display: flex;
  align-items: center;
}

.search-bar-kbd kbd {
  display: inline-flex;
  height: 24px;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--secondary);
  opacity: 0.5;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-faint);
  font-family: var(--font);
}

/* Go button (appears when text is entered) */
.search-bar-go {
  margin-right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  border: none;
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font);
  flex-shrink: 0;
}

.search-bar-go:hover { opacity: 0.9; }
.search-bar-go:active { transform: scale(0.97); }
.search-bar-go:disabled { opacity: 0.5; cursor: not-allowed; }

.search-bar-go svg {
  width: 14px;
  height: 14px;
}

/* Hint text below */
.search-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}

.search-hint p {
  font-size: 11px;
  color: var(--fg-faint);
  opacity: 0.4;
  letter-spacing: 0.3px;
}

.search-hint .mono {
  font-family: var(--font-mono);
}

/* ── Command dropdown (autocomplete for / commands) ── */
.command-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 40;
  animation: slideDown 0.15s ease-out;
  display: none;
}

[data-theme="dark"] .command-dropdown {
  background: rgba(26, 26, 26, 0.95);
}

.command-dropdown.open {
  display: block;
}

.command-dropdown-list {
  padding: 6px;
}

.command-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition-fast);
}

.command-option:hover,
.command-option.selected {
  background: var(--secondary);
}

[data-theme="dark"] .command-option:hover,
[data-theme="dark"] .command-option.selected {
  background: var(--bg-card-hover);
}

.command-option-icon {
  width: 16px;
  height: 16px;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.command-option-info {
  flex: 1;
  min-width: 0;
}

.command-option-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}

.command-option-desc {
  font-size: 12px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-option-auth {
  font-size: 10px;
  color: var(--fg-faint);
  background: var(--secondary);
  opacity: 0.6;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.command-dropdown-footer {
  border-top: 1px solid var(--border-light);
  padding: 8px 12px;
  background: var(--secondary);
  opacity: 0.2;
}

.command-dropdown-footer p {
  font-size: 10px;
  color: var(--fg-faint);
  opacity: 0.5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.command-dropdown-footer kbd {
  font-size: 9px;
  background: var(--secondary);
  opacity: 0.6;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font);
}

/* ── Confirm card (listing preview) ── */
.confirm-card {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 16px;
}

.confirm-card-inner {
  padding: 16px 20px;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  animation: fadeInUp 0.3s ease-out;
}

.confirm-card-inner h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--fg);
}

.listing-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.listing-field {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.listing-field .label { color: var(--fg-muted); }
.listing-field .value { font-weight: 500; color: var(--fg); }

/* Editable listing fields */
.listing-field-editable {
  flex-direction: column;
  gap: 6px;
}

.listing-field-editable .label {
  font-size: 12px;
  font-weight: 500;
}

.listing-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--secondary);
  color: var(--fg);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition-fast);
}

.listing-input:focus {
  border-color: var(--border-focus);
}

/* Spell suggestion banner */
.listing-suggestion {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--fg-muted);
  padding: 4px 0;
}

.suggestion-accept {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}

.suggestion-accept:hover {
  opacity: 0.8;
}

/* Type button group */
.listing-field-type {
  flex-direction: column;
  gap: 6px;
}

.listing-field-type .label {
  font-size: 12px;
  font-weight: 500;
}

.listing-type-group {
  display: flex;
  gap: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.listing-type-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: var(--secondary);
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition-fast);
}

.listing-type-btn:not(:last-child) {
  border-right: 1px solid var(--border-light);
}

.listing-type-btn:hover {
  background: var(--bg-card-hover);
  color: var(--fg);
}

.listing-type-btn.active {
  background: var(--primary);
  color: var(--primary-fg);
}

/* Price row with currency selector */
.listing-price-row {
  display: flex;
  gap: 8px;
}

.listing-price-input {
  flex: 1;
}

.listing-currency-select {
  width: 80px;
  padding: 10px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--secondary);
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.listing-currency-select:focus {
  border-color: var(--border-focus);
}

/* Remove number input spinners */
.listing-price-input::-webkit-outer-spin-button,
.listing-price-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.listing-price-input[type=number] {
  -moz-appearance: textfield;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Search results list ── */
.search-results {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 16px;
  animation: fadeInUp 0.4s ease-out;
}

.search-results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.search-results-header p {
  font-size: 14px;
  color: var(--fg-muted);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-2xl);
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: rgba(255, 255, 255, 0.50);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background var(--transition-fast);
  animation: fadeInUp 0.4s ease-out backwards;
}

[data-theme="dark"] .result-item {
  border-color: rgba(255, 255, 255, 0.04);
  background: rgba(26, 26, 26, 0.50);
}

.result-item:hover {
  background: rgba(248, 248, 248, 0.50);
}

[data-theme="dark"] .result-item:hover {
  background: rgba(38, 38, 38, 0.50);
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.result-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.result-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

.result-badge.type {
  background: var(--secondary);
  color: var(--secondary-fg);
}

.result-badge.category {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--fg-muted);
}

.result-description {
  font-size: 12px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-seller {
  font-size: 12px;
  color: var(--fg-faint);
  opacity: 0.6;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Favorite button */
.favorite-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.favorite-btn:hover {
  color: var(--fg);
  background: var(--secondary);
}

.favorite-btn.active {
  color: #ef4444;
}

.favorite-btn.active:hover {
  color: #dc2626;
}

.favorite-btn svg {
  width: 16px;
  height: 16px;
}

/* Help command view */
.help-command-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-command-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: rgba(255, 255, 255, 0.50);
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .help-command-item {
  border-color: rgba(255, 255, 255, 0.04);
  background: rgba(26, 26, 26, 0.50);
}

.help-command-item code {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  background: var(--secondary);
  opacity: 0.5;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.help-command-item p {
  font-size: 14px;
  color: var(--fg-muted);
  flex: 1;
}

.help-command-item .auth-label {
  font-size: 10px;
  color: var(--fg-faint);
  background: var(--secondary);
  opacity: 0.6;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 16px;
  text-align: center;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: var(--secondary);
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 24px;
  height: 24px;
  color: var(--fg-muted);
}

.empty-state p {
  font-size: 14px;
  color: var(--fg-muted);
}

/* ── Item detail view ── */
.item-detail {
  padding: 24px;
  border-radius: var(--radius-2xl);
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: rgba(255, 255, 255, 0.50);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeInUp 0.4s ease-out;
}

[data-theme="dark"] .item-detail {
  border-color: rgba(255, 255, 255, 0.04);
  background: rgba(26, 26, 26, 0.50);
}

.item-detail-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
}

.item-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.item-detail-desc {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.item-detail-seller {
  font-size: 13px;
  color: var(--fg-faint);
  margin-bottom: 20px;
}

.item-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.item-detail-actions .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.item-detail-actions .favorite-btn {
  width: 40px;
  height: 40px;
}

.item-detail-actions .favorite-btn svg {
  width: 18px;
  height: 18px;
}

.item-detail-own {
  font-size: 13px;
  color: var(--fg-muted);
  font-style: italic;
}

/* ── Photo upload ── */
.listing-photo-upload {
  margin-top: 4px;
}

.photo-upload-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px dashed rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-xl);
  cursor: pointer;
  font-size: 13px;
  color: var(--fg-muted);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

[data-theme="dark"] .photo-upload-label {
  border-color: rgba(255, 255, 255, 0.08);
}

.photo-upload-label:hover {
  border-color: var(--border-focus);
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .photo-upload-label:hover {
  background: rgba(255, 255, 255, 0.02);
}

.photo-upload-label svg {
  color: var(--fg-faint);
  flex-shrink: 0;
}

.photo-preview {
  position: relative;
  display: inline-block;
}

.photo-preview img {
  max-width: 100%;
  max-height: 160px;
  border-radius: var(--radius-xl);
  object-fit: cover;
}

.photo-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-remove-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Item detail image */
.item-detail-image {
  margin-bottom: 16px;
}

.item-detail-image img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-xl);
}

@media (max-width: 640px) {
  .search-bar input { font-size: 16px; } /* prevent iOS zoom */
  .search-bar-kbd { display: none; }
  .msg-label { display: none; }
}
