/* Index of Marks — canonical collection toolbar layout.
   Owns search/status flow and responsive toolbar geometry only.
   Floating surfaces are owned by ui-system.css and their component files. */

.collection-toolbar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 54px;
  padding: 7px var(--pad);
  border-bottom: 1px solid var(--iom-line);
  background: var(--bg);
  color: var(--fg);
  transition: none;
}

.collection-toolbar .search-wrap {
  min-width: 0;
  width: 100%;
}
.collection-toolbar .search-input,
.collection-toolbar .search-input:focus {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.collection-toolbar .collection-status {
  min-width: 0;
  min-height: var(--iom-control-size);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 0;
  border: 0;
  font-size: 13px;
  white-space: nowrap;
}
.collection-toolbar [data-result-count] {
  flex: none;
  font-variant-numeric: tabular-nums;
  opacity: .7;
}
.collection-toolbar .collection-mode {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.collection-toolbar .collection-mode > span:last-child { display: none; }
.collection-toolbar [data-sort-label] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.collection-shuffle { flex: 0 0 auto; }
.collection-shuffle[hidden] { display: none !important; }
.collection-shuffle svg {
  width: 18px;
  height: 18px;
  display: block;
}
.collection-toolbar .archive-filter-marker { margin-right: 0; }

@media (min-width: 761px) and (max-width: 1366px) {
  .collection-toolbar {
    grid-template-columns: minmax(170px, 236px) minmax(0, 1fr);
    min-height: 52px;
    gap: 14px;
    padding-block: 6px;
  }
  .collection-toolbar .collection-status { gap: 14px; font-size: 12px; }
  .collection-toolbar .collection-mode { gap: 9px; }
}

@media (max-width: 980px) {
  .collection-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
  }
  .collection-toolbar .collection-status {
    transition: opacity 140ms ease, max-width 180ms var(--ease), transform 180ms var(--ease);
  }
  .collection-toolbar.is-search-expanded .collection-status {
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(6px);
  }
}

@media (max-width: 760px) {
  .collection-toolbar { gap: 10px; }
  .collection-toolbar .search-input,
  .collection-toolbar .search-input:focus { font-size: 16px; }
  .collection-toolbar .collection-status { gap: 10px; font-size: 12px; }
  .site-actions {
    justify-content: flex-start;
    justify-self: start;
    overflow: hidden;
  }
}

@media (max-width: 430px) {
  .collection-toolbar {
    grid-template-columns: 1fr;
    gap: 7px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .collection-toolbar.is-search-expanded .collection-status {
    max-width: none;
    overflow: visible;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
  .collection-toolbar .collection-status {
    width: 100%;
    justify-content: space-between;
  }
  .collection-toolbar .collection-mode {
    order: 1;
    justify-content: flex-start;
  }
  .collection-toolbar .collection-shuffle { order: 1; }
  .collection-toolbar [data-sort-label] { order: 2; }
  .collection-toolbar [data-result-count] {
    order: 2;
    margin-left: auto;
    text-align: right;
  }
}

@media (prefers-reduced-motion: reduce) {
  .collection-toolbar .collection-status { transition-duration: .01ms; }
}