/* Colors come from rose-pine.css (the theme file loaded before this one). */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--rp-base);
  color: var(--rp-text);
  font-family: Vazirmatn, "Vazir", "Segoe UI", Tahoma, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Header */

.topbar {
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.5rem;
  direction: ltr;
}

.branding {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  justify-self: start;
}

.brand-rose {
  color: var(--rp-rose);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.5rem;
  font-style: italic;
  color: var(--rp-text);
  line-height: 1.3;
}

.brand-subtitle {
  font-size: 0.9rem;
  font-style: normal;
  color: var(--rp-muted);
  line-height: 1.3;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--rp-text);
  justify-self: center;
  text-align: center;
  min-width: 0;
}

/* Metadata chips */

.metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--rp-surface);
  border: 1px solid var(--rp-muted);
  border-radius: 8px;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.chip-key {
  color: var(--rp-muted);
}

.chip-val {
  color: var(--rp-text);
}

/* Toolbar */

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.search-wrap {
  position: relative;
  flex: 1 1 320px;
}

.search-icon {
  position: absolute;
  inset-inline-start: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--rp-muted);
}

.search {
  width: 100%;
  background: var(--rp-surface);
  color: var(--rp-text);
  border: 1px solid var(--rp-highlight-med);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  padding-inline-start: 2.3rem;
  font-size: 1rem;
  font-family: inherit;
}

.search::placeholder {
  color: var(--rp-muted);
}

.search:focus {
  outline: none;
  border-color: var(--rp-iris);
  box-shadow: 0 0 0 3px var(--rp-highlight-med);
}

.count {
  color: var(--rp-muted);
  font-size: 0.9rem;
}

/* Table */

.table-wrap {
  overflow-x: auto;
  background: var(--rp-surface);
  border: 1px solid var(--rp-highlight-med);
  border-radius: 12px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--rp-overlay);
  color: var(--rp-love);
  text-align: right;
  border: 1px solid var(--rp-highlight-med);
  padding: 0.6rem 0.9rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

thead th:hover {
  background: var(--rp-highlight-low);
}

thead th .sort-arrow {
  margin-inline-start: 0.3rem;
}

thead th .sort-arrow-icon {
  display: inline-block;
  vertical-align: middle;
  color: var(--rp-foam);
}

tbody td {
  border: 1px solid var(--rp-highlight-med);
  padding: 0.5rem 0.9rem;
  vertical-align: top;
  white-space: nowrap;
}

tbody tr:nth-child(odd) {
  background: var(--rp-base);
}

tbody tr:nth-child(even) {
  background: var(--rp-surface);
}

tbody tr:hover {
  background: var(--rp-highlight-low);
}

tbody tr.empty-row td {
  text-align: center;
  color: var(--rp-muted);
  padding: 2rem 0.9rem;
}

/* Matched cells: the whole text turns bold gold with no background, so the
   zebra row coloring stays intact. */

mark {
  background: none;
  color: var(--rp-gold);
  font-weight: 600;
}

/* Empty cells are shown as a faint dash instead of blank space. */

td .empty-icon {
  display: inline-flex;
  vertical-align: middle;
  color: var(--rp-text);
  opacity: 0.2;
}

/* Footer */

.footer {
  text-align: center;
  color: var(--rp-muted);
  font-size: 0.8rem;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  padding: 1rem 1rem 2rem;
}

@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 0.5rem;
  }

  .branding {
    justify-self: center;
  }
}