/* The YouTube Party page's shared pieces (thumbnail, text input, the room's
   error) and the host's search bar with its results. The page's shape and
   the player are in party-layout.css; the side column in party-side.css. */

.party-error .button {
  min-height: auto;
  margin-left: auto;
  padding: 0 var(--space-2);
}

.party-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--size-thumb);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-small);
  background: var(--color-surface);
  color: var(--color-muted);
  object-fit: cover;
}

.party-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--size-control);
  padding: 0 var(--space-3);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-raised);
  color: var(--color-fg);
  font-size: var(--text-sm);
  transition: border-color var(--duration-fast);
}

.party-input:hover {
  border-color: var(--color-muted);
}

.party-input[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.party-input::placeholder {
  color: var(--color-muted);
}

/* Search: one row, the results toggle at its end */

.search-panel {
  display: grid;
  gap: var(--space-2);
}

.search-panel__form {
  display: flex;
  gap: var(--space-2);
}

.search-panel__toggle .icon {
  transition: transform var(--duration-fast) var(--ease-out);
}

.search-panel__toggle[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

/* Results take height from the player only while open, and at most a
   couple of rows of cards; the rest scrolls here. */
.search-panel__results {
  max-height: var(--size-party-results);
  overflow-y: auto;
}

.search-panel__results[hidden] {
  display: none;
}

.search-panel .skeleton {
  padding: 0;
}

.search-panel__empty {
  font-size: var(--text-sm);
}

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--size-result-card), 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--space-2);
  padding: var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-raised);
}

.search-result__title {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: var(--line-height-tight);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.search-result__meta {
  overflow: hidden;
  color: var(--color-muted);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result__actions {
  display: flex;
  grid-column: 1 / -1;
  gap: var(--space-2);
}

.search-result__button {
  flex: 1 1 auto;
  min-height: var(--size-control-small);
  padding: 0 var(--space-2);
}

@media (max-width: 640px) {
  /* The icon carries the button; the word stays its name. */
  .search-panel__submit {
    width: var(--size-control);
    padding: 0;
  }

  .search-panel__submit-label {
    position: absolute;
    width: var(--border-width);
    height: var(--border-width);
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
