/* Layout */
.login-container {
  max-width: 400px;
  margin-top: 10vh;
}
.error-text {
  color: var(--pico-del-color);
}

/* Nav active link */
nav a.active {
  font-weight: bold;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Match count badge */
.match-count {
  color: var(--pico-muted-color);
  font-weight: normal;
}

/* Filter bar */
.filter-bar {
  margin-bottom: 1rem;
}
.filter-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.filter-row select,
.filter-row input[type="search"] {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

/* Match card */
.match-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  margin-bottom: 0.5rem;
  transition: opacity 0.3s ease;
}
.match-card.favorited {
  border-left: 3px solid #f0ad4e;
}
.match-card.htmx-swapping {
  opacity: 0;
}

.match-checkbox {
  display: flex;
  align-items: center;
  padding-top: 0.25rem;
}
.match-checkbox input {
  margin: 0;
}

/* Drag handle: hidden unless the list is in manual-sort mode. */
.drag-handle {
  display: none;
  align-self: center;
  padding: 0.25rem 0.4rem;
  color: var(--pico-muted-color);
  font-size: 1rem;
  user-select: none;
  cursor: grab;
}
#match-list.sortable-active .drag-handle {
  display: inline-block;
}
.drag-handle:active {
  cursor: grabbing;
}
.match-card-ghost {
  opacity: 0.4;
  background: var(--pico-muted-border-color);
}

.match-photo {
  flex: 0 0 120px;
  height: 90px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--pico-muted-border-color);
}
.match-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--pico-muted-color);
  font-size: 0.8rem;
}

.match-content {
  flex: 1;
  min-width: 0;
}
.match-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.match-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.match-price {
  font-weight: 700;
  white-space: nowrap;
  color: var(--pico-primary);
}

.match-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  margin-bottom: 0.35rem;
}

/* Enrichment chips */
.match-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}
.chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 12px;
  background: var(--pico-secondary-background);
  color: var(--pico-secondary-inverse);
}
.chip-overridden {
  border-bottom: 1px dashed var(--pico-primary);
}

/* LLM score */
.match-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}
.score-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
}
.score-badge.interesting {
  background: #d4edda;
  color: #155724;
}
.score-badge.not-interesting {
  background: #f8d7da;
  color: #721c24;
}
.score-reason {
  color: var(--pico-muted-color);
  font-size: 0.8rem;
}

/* Action buttons */
.match-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}
.btn-icon {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  line-height: 1;
  color: var(--pico-muted-color);
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover {
  background: var(--pico-muted-border-color);
}
.btn-fav.active,
.btn-fav:hover {
  color: #f0ad4e;
}
.btn-dismiss:hover {
  color: var(--pico-del-color);
}
.btn-restore:hover {
  color: var(--pico-ins-color);
}

/* Notes block */
.match-notes,
.match-edit-fields {
  margin-top: 0.4rem;
  font-size: 0.85rem;
}
.match-notes > summary,
.match-edit-fields > summary {
  cursor: pointer;
  color: var(--pico-muted-color);
  padding: 0.15rem 0;
  font-size: 0.8rem;
  list-style: none;
}
.match-notes > summary::-webkit-details-marker,
.match-edit-fields > summary::-webkit-details-marker {
  display: none;
}
.match-card.has-notes .match-notes > summary {
  color: var(--pico-primary);
  font-weight: 600;
}
.match-notes textarea {
  width: 100%;
  margin: 0.35rem 0 0.25rem 0;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 3.5rem;
}
.btn-save-note,
.btn-save-enrichment {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  border: 1px solid var(--pico-muted-border-color);
  background: var(--pico-background-color);
  border-radius: 4px;
  cursor: pointer;
}
.btn-save-note:hover,
.btn-save-enrichment:hover {
  background: var(--pico-muted-border-color);
}

/* Enrichment edit form (lazy-loaded into <details>) */
.enrichment-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--pico-card-sectioning-background-color, var(--pico-muted-border-color));
  border-radius: 6px;
}
.enrichment-form .btn-save-enrichment {
  grid-column: 1 / -1;
  justify-self: start;
}
.enrichment-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.8rem;
}
.enrichment-field-label {
  color: var(--pico-muted-color);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.enrichment-override-tag {
  display: inline-block;
  padding: 0 0.35rem;
  font-size: 0.65rem;
  border-radius: 8px;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
  text-transform: uppercase;
}
.enrichment-field input[type="text"],
.enrichment-field input[type="number"],
.enrichment-field select {
  margin-bottom: 0;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
}
.enrichment-field-help {
  color: var(--pico-muted-color);
  font-size: 0.7rem;
}
.edit-loading,
.edit-empty {
  color: var(--pico-muted-color);
  font-size: 0.8rem;
  padding: 0.5rem 0;
}

/* Bulk action bar */
.bulk-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: var(--pico-card-background-color);
  border-top: 1px solid var(--pico-muted-border-color);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
}
.btn-bulk {
  padding: 0.4rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--pico-muted-border-color);
  background: var(--pico-background-color);
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-bulk:hover {
  background: var(--pico-muted-border-color);
}

/* Toast notifications */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-size: 0.9rem;
  transition: opacity 0.3s;
}
.toast.fade-out {
  opacity: 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--pico-muted-color);
}

/* Config page */
.config-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.config-layout textarea {
  min-height: 500px;
  font-family: monospace;
  font-size: 0.85rem;
  resize: vertical;
}
.config-section {
  margin-bottom: 1rem;
}
.config-section h4 {
  margin-bottom: 0.5rem;
}
.config-section details {
  margin-bottom: 0.5rem;
}

/* Stats cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  padding: 1rem;
}
.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

/* Responsive */
@media (max-width: 768px) {
  .match-card {
    flex-wrap: wrap;
  }
  .match-photo {
    flex: 0 0 80px;
    height: 60px;
  }
  .match-actions {
    flex-direction: row;
    width: 100%;
    justify-content: flex-end;
  }
  .config-layout {
    grid-template-columns: 1fr;
  }
  .filter-row {
    flex-direction: column;
  }
}
