/* ─────────────────────────────────────────────────────────────────────────────
   rosetta-stone.css
   Shared styles for datasets.md, collections.md, releases.md
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.md-grid { max-width: 76rem; }

/* ── Filter bar ──────────────────────────────────────────────────────────────── */
.rs-filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0 0.5rem;
  flex-wrap: wrap;
}
.rs-search {
  flex: 2;
  min-width: 220px;
  padding: 0.6rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.45rem;
  font-size: 0.85rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
}
.rs-filter-select {
  flex: 1;
  min-width: 130px;
  padding: 0.6rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.45rem;
  font-size: 0.85rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
}
.rs-filter-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.rs-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.35rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  cursor: pointer;
  white-space: nowrap;
}
.rs-btn:hover { border-color: var(--md-accent-fg-color); color: var(--md-accent-fg-color); }
.rs-btn--clear { color: var(--md-default-fg-color--light); }
@media (max-width: 700px) {
  .rs-filters { flex-direction: column; align-items: stretch; }
  .rs-filter-actions { justify-content: flex-start; }
}

/* ── Count line ─────────────────────────────────────────────────────────────── */
.rs-count { margin: 0 0 0.75rem; color: var(--md-default-fg-color--light); font-size: 0.85rem; }

/* ── Guidance block ──────────────────────────────────────────────────────────── */
.rs-guidance {
  margin-bottom: 1rem;
  padding: 0.65rem 1rem;
  background: var(--md-code-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 5px;
}
.rs-guidance-intro {
  font-size: 0.82rem;
  color: var(--md-default-fg-color--light);
  margin: 0 0 0.5rem;
}
.rs-guidance-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
}
.rs-guidance-step {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--md-default-fg-color--light);
}
.rs-guidance-step strong { color: var(--md-default-fg-color); }
.rs-guidance-num {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--md-accent-fg-color);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Curation status legend — grid layout ────────────────────────────────────── */
.rs-legend-section {
  margin-bottom: 1rem;
}
.rs-legend-section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}
.rs-legend-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--md-default-fg-color--light);
  white-space: nowrap;
}
.rs-legend-section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--md-default-fg-color--lightest);
}
.rs-legend-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}
@media (max-width: 700px) {
  .rs-legend-grid { grid-template-columns: repeat(2, 1fr); }
}
.rs-legend-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 4px;
  background: var(--md-code-bg-color);
}
.rs-legend-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.67rem;
  padding: 1px 7px;
  border-radius: 3px;
  font-weight: 600;
  font-family: monospace;
  border: 1px solid;
  width: fit-content;
}
.rs-legend-desc {
  font-size: 0.69rem;
  color: var(--md-default-fg-color--light);
  line-height: 1.35;
}

/* ── Legend (legacy — kept for other pages) ──────────────────────────────────── */
.rs-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  font-size: 0.78rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 5px;
  background: var(--md-code-bg-color);
}
.rs-legend-title { font-weight: 600; font-size: 0.72rem; color: var(--md-default-fg-color--light); text-transform: uppercase; letter-spacing: 0.06em; }
.rs-legend-item { display: flex; align-items: center; gap: 0.35rem; color: var(--md-default-fg-color--light); }

/* ── Summary table ───────────────────────────────────────────────────────────── */
.rs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  table-layout: fixed;
}
.rs-table th,
.rs-table td {
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  padding: 0.4rem;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}
.rs-table th { font-weight: 700; background: var(--md-default-bg-color); }
.rs-table th.sortable { cursor: pointer; user-select: none; }
.rs-table th.sortable:hover { color: var(--md-accent-fg-color); }
.rs-sort-icon { display: inline-block; margin-left: 4px; opacity: 0.35; font-style: normal; font-size: 0.7rem; }
.rs-sort-icon.asc,
.rs-sort-icon.desc { opacity: 1; }

/* Dataset table column widths — version columns allow header wrap via <br> */
.rs-dataset-table th:nth-child(1), .rs-dataset-table td:nth-child(1) { width: 20%; }
.rs-dataset-table th:nth-child(2), .rs-dataset-table td:nth-child(2) { width: 23%; }
.rs-dataset-table th:nth-child(3), .rs-dataset-table td:nth-child(3) { width: 13%; }
.rs-dataset-table th:nth-child(4), .rs-dataset-table td:nth-child(4) { width: 10%; }
.rs-dataset-table th:nth-child(5), .rs-dataset-table td:nth-child(5) { width: 10%; }
.rs-dataset-table th:nth-child(6), .rs-dataset-table td:nth-child(6) { width: 15%; }
.rs-dataset-table th:nth-child(7), .rs-dataset-table td:nth-child(7) { width: 9%; white-space: nowrap; }
/* Allow sortable th to wrap on narrow columns */
.rs-dataset-table th.sortable { white-space: normal; }

/* Collection table column widths */
.rs-collection-table th:nth-child(1), .rs-collection-table td:nth-child(1) { width: 22%; }
.rs-collection-table th:nth-child(2), .rs-collection-table td:nth-child(2) { width: 10%; }
.rs-collection-table th:nth-child(3), .rs-collection-table td:nth-child(3) { width: 12%; }
.rs-collection-table th:nth-child(4), .rs-collection-table td:nth-child(4) { width: 12%; }
.rs-collection-table th:nth-child(5), .rs-collection-table td:nth-child(5) { width: 12%; }
.rs-collection-table th:nth-child(6), .rs-collection-table td:nth-child(6) { width: 10%; }
.rs-collection-table th:nth-child(7), .rs-collection-table td:nth-child(7) { width: 13%; }
.rs-collection-table th:nth-child(8), .rs-collection-table td:nth-child(8) { width: 9%;  white-space: nowrap; }

/* Release table column widths */
.rs-release-table th:nth-child(1), .rs-release-table td:nth-child(1) { width: 24%; }
.rs-release-table th:nth-child(2), .rs-release-table td:nth-child(2) { width: 14%; }
.rs-release-table th:nth-child(3), .rs-release-table td:nth-child(3) { width: 10%; }
.rs-release-table th:nth-child(4), .rs-release-table td:nth-child(4) { width: 13%; }
.rs-release-table th:nth-child(5), .rs-release-table td:nth-child(5) { width: 12%; }
.rs-release-table th:nth-child(6), .rs-release-table td:nth-child(6) { width: 14%; }

/* ── Toggle / expand buttons ─────────────────────────────────────────────────── */
.rs-toggle {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.35rem;
  padding: 0.22rem 0.45rem;
  background: var(--md-default-bg-color);
  cursor: pointer;
  font-size: 0.72rem;
}
.rs-toggle:hover { border-color: var(--md-accent-fg-color); }
.rs-detail-row { display: none; }

/* ── Detail panel ────────────────────────────────────────────────────────────── */
.rs-detail {
  padding: 1rem 1rem 1.5rem;
  border-left: 3px solid var(--md-accent-fg-color);
  background: var(--md-code-bg-color);
}
.rs-detail-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.2rem; line-height: 1.35; }
.rs-detail-id    { font-family: monospace; font-size: 0.78rem; color: var(--md-accent-fg-color); margin-bottom: 0.5rem; }
.rs-tag-row      { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 0.75rem; }
.rs-tag-pill     {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  font-size: 0.72rem;
  font-family: monospace;
  white-space: nowrap;
}

/* ── Meta strip ──────────────────────────────────────────────────────────────── */
.rs-meta-strip {
  display: flex;
  gap: 0;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.rs-meta-item {
  flex: 1;
  min-width: 100px;
  padding: 0.45rem 0.65rem;
  border-right: 1px solid var(--md-default-fg-color--lightest);
}
.rs-meta-item:last-child { border-right: none; }
.rs-meta-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
  display: block;
  margin-bottom: 2px;
}
.rs-meta-value { font-size: 0.8rem; font-weight: 500; }

/* ── Section ─────────────────────────────────────────────────────────────────── */
.rs-section        { margin-bottom: 1rem; }
.rs-section-header {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  margin-bottom: 0.6rem;
}
.rs-description { font-size: 0.82rem; line-height: 1.65; }

/* ── Release tabs ────────────────────────────────────────────────────────────── */
.rs-release-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  width: fit-content;
  flex-wrap: wrap;
}
.rs-rtab {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  color: var(--md-default-fg-color--light);
  background: transparent;
  border: none;
  border-right: 1px solid var(--md-default-fg-color--lightest);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.rs-rtab:last-child  { border-right: none; }
.rs-rtab:hover       { background: var(--md-default-bg-color); color: var(--md-default-fg-color); }
.rs-rtab--active     { background: var(--md-default-fg-color); color: var(--md-default-bg-color); }
.rs-panel-sections   { display: flex; flex-direction: column; gap: 0.6rem; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.rs-card {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 5px;
  overflow: hidden;
  background: var(--md-default-bg-color);
}
.rs-card--table { overflow-x: auto; }
.rs-card-header {
  padding: 0.4rem 0.75rem;
  background: var(--md-code-bg-color);
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rs-card-title        { font-size: 0.75rem; font-weight: 600; }
.rs-card-header-right { margin-left: auto; font-size: 0.72rem; color: var(--md-default-fg-color--light); }
.rs-card-body         { padding: 0.5rem 0.75rem; }

/* ── Field rows ──────────────────────────────────────────────────────────────── */
.rs-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  gap: 0.5rem;
}
.rs-field:last-child  { border-bottom: none; }
.rs-field-label       { font-size: 0.78rem; color: var(--md-default-fg-color--light); flex-shrink: 0; }
.rs-field-value       { font-size: 0.78rem; font-weight: 500; text-align: right; }

/* ── Utility classes ─────────────────────────────────────────────────────────── */
.rs-highlight  { color: var(--md-accent-fg-color); }
.rs-mono       { font-family: monospace; }
.rs-na         { color: var(--md-default-fg-color--light); font-style: italic; font-weight: 400; }

/* ── No-content states ───────────────────────────────────────────────────────── */
.rs-no-curation      { padding: 1.2rem; text-align: center; color: var(--md-default-fg-color--light); }
.rs-no-curation-icon { font-size: 1.4rem; display: block; margin-bottom: 0.35rem; }
.rs-no-curation p    { font-size: 0.8rem; }
.rs-no-buckets       { padding: 0.75rem; font-size: 0.8rem; color: var(--md-default-fg-color--light); }

/* ── Bucket rows ─────────────────────────────────────────────────────────────── */
.rs-bucket-body { padding: 0.25rem 0.75rem; }
.rs-env-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}
.rs-env-row:last-child { border-bottom: none; }
.rs-env-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.rs-env-name {
  font-size: 0.68rem;
  font-weight: 600;
  font-family: monospace;
  width: 34px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rs-env-path {
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--md-default-fg-color--light);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-copy-btn {
  font-size: 0.65rem;
  padding: 2px 7px;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 3px;
  cursor: pointer;
  background: var(--md-code-bg-color);
  flex-shrink: 0;
}
.rs-copy-btn:hover        { border-color: var(--md-accent-fg-color); }
.rs-copy-btn--copied      { background: #e8f5ee; color: #0d6b3f; border-color: #6fcf97; }

/* ── History table ───────────────────────────────────────────────────────────── */
.rs-table-hint { font-size: 0.7rem; color: var(--md-default-fg-color--light); margin-top: 0.35rem; }
.rs-latest-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 20px;
  background: #e8f5ee;
  color: #0d6b3f;
  border: 1px solid #6fcf97;
  font-weight: 500;
}

/* ── Mini table (inside detail panels) ──────────────────────────────────────── */
.rs-mini-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.rs-mini-table th,
.rs-mini-table td {
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  padding: 0.4rem;
  text-align: left;
  vertical-align: top;
}

/* ── Collection page: header card ───────────────────────────────────────────── */
.rs-collection-header {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 5px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--md-code-bg-color);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
}
.rs-collection-header-name  { font-size: 1rem; font-weight: 600; }
.rs-collection-header-meta  { font-size: 0.8rem; color: var(--md-default-fg-color--light); display: flex; gap: 1rem; flex-wrap: wrap; }
.rs-collection-note {
  font-size: 0.8rem;
  color: var(--md-default-fg-color--light);
  border-left: 3px solid var(--md-accent-fg-color);
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--md-code-bg-color);
}
.rs-status-counts { display: flex; gap: 0.6rem; flex-wrap: wrap; font-size: 0.75rem; }

/* ── Side drawer ─────────────────────────────────────────────────────────────── */
.rs-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 200;
}
.rs-drawer-overlay.rs-drawer-overlay--visible {
  display: block;
}

.rs-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 95vw;
  height: 100vh;
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  background: var(--md-default-bg-color);
  border-left: 1px solid var(--md-default-fg-color--lightest);
}
.rs-drawer--open {
  transform: translateX(0);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
}

.rs-drawer-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.rs-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.75rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  flex-shrink: 0;
  background: var(--md-code-bg-color);
}
.rs-drawer-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.15rem;
}
.rs-drawer-close {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.45rem;
  color: var(--md-default-fg-color--light);
  line-height: 1;
  margin-top: 0.1rem;
}
.rs-drawer-close:hover {
  color: var(--md-default-fg-color);
  border-color: var(--md-default-fg-color);
}

.rs-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Row highlight when its drawer is open */
.rs-dataset-row--active td {
  background: #e8f0fb;
}

/* ── Panel sections (used inside drawer) ─────────────────────────────────────── */
.rs-panel-sections {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.rs-release-section {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.rs-release-section-header {
  padding: 0.65rem 1rem;
  background: var(--md-code-bg-color);
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
}
.rs-release-version { font-family: monospace; font-size: 1rem; font-weight: 600; }
.rs-release-meta    { font-size: 0.78rem; color: var(--md-default-fg-color--light); display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.rs-release-section-body { padding: 0.75rem 1rem; overflow-x: auto; }
