/**
 * Collections Module Views layout helpers (provider-scoped).
 */

.pokehub-collection-view-wrap.me5rine-lab-module-view--wide {
  max-width: none;
  width: 100%;
}

.pokehub-collection-go-strings-view,
.pokehub-collection-trade-list-mount,
.pokehub-collection-settings-view {
  width: 100%;
  max-width: none;
  min-width: 0;
}

/*
 * GO Strings Module View — compact phrase layout.
 * Use container queries (content width), not viewport: the Module Views
 * sidebar shrinks the usable area well below the viewport width.
 * Nested group grids stay single-column so half-width cards remain readable.
 */
.pokehub-collection-go-strings-view {
  container-type: inline-size;
  container-name: pokehub-go-strings;
}

.pokehub-collection-go-strings-view .pokehub-pogo-search-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--me5rine-lab-spacing-md, 15px) var(--me5rine-lab-spacing-lg, 20px);
  align-items: start;
}

.pokehub-collection-go-strings-view .pokehub-pogo-search-family-groups {
  grid-template-columns: 1fr;
}

.pokehub-collection-go-strings-view .pokehub-pogo-search-family-groups .pokehub-pogo-search-group:nth-child(2n) {
  border-left: 0;
  padding-left: 0;
}

@container pokehub-go-strings (min-width: 640px) {
  .pokehub-collection-go-strings-view .pokehub-pogo-search-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.pokehub-collection-trade-list-view__layout {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.pokehub-collection-trade-list-view__preview {
  min-width: 0;
}

.pokehub-collection-trade-list-view__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Share uses Me5rine LAB context-panel drawer; do not float a second card UI. */
.pokehub-collection-share-dialog.me5rine-lab-context-panel {
  inset: auto;
  max-width: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.pokehub-collection-share-dialog.me5rine-lab-context-panel[hidden] {
  display: none !important;
}

.pokehub-collection-settings-view__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/*
 * Settings switches — layout must work outside the create drawer.
 * Theme `13-collections-front.css` is the primary source; this is a plugin safety net
 * so Module Views Settings / create drawer do not regress if the theme part is stale.
 */
.pokehub-collection-settings-view .pokehub-collections-setting-switch,
.pokehub-collections-drawer .pokehub-collections-setting-switch,
.pokehub-collections-setting-switch {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  width: 100%;
  box-sizing: border-box;
  margin: 0.42rem 0;
  cursor: pointer;
  position: relative;
}

.pokehub-collections-drawer-body fieldset label.pokehub-collections-setting-switch {
  display: flex;
  align-items: center;
  gap: 0.72rem;
}

.pokehub-collection-settings-view .pokehub-collections-setting-switch-wrap:first-of-type .pokehub-collections-setting-switch,
.pokehub-collections-drawer .pokehub-collections-setting-switch-wrap:first-of-type .pokehub-collections-setting-switch {
  margin-top: 0.35rem;
}

.pokehub-collection-settings-view .pokehub-collections-setting-switch-desc,
.pokehub-collections-drawer .pokehub-collections-setting-switch-desc {
  margin: 0.15rem 0 0.35rem;
  padding-left: calc(2.55rem + 0.72rem);
}

.pokehub-collections-drawer .pokehub-collections-setting-switch-track {
  flex: 0 0 auto;
}

.pokehub-collections-drawer .pokehub-collections-setting-switch-text {
  flex: 1 1 auto;
  min-width: 0;
}

.pokehub-collection-settings-view > .me5rine-lab-form-block.pokehub-collections-settings-menu-block {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  min-width: 0;
}

.pokehub-collection-settings-view > .me5rine-lab-form-block.pokehub-collections-settings-menu-block:not(:last-child) {
  margin-bottom: var(--me5rine-lab-spacing-md, 1rem);
  padding-bottom: var(--me5rine-lab-spacing-md, 1rem);
  border-bottom: 1px solid color-mix(in srgb, var(--me5rine-lab-text-muted, #58606e) 62%, transparent);
}

.pokehub-collection-settings-view > .me5rine-lab-form-block.pokehub-collections-settings-menu-block legend {
  margin-bottom: var(--me5rine-lab-spacing-xs, 0.35rem);
}

/*
 * Context-panel Collections content: keep business colors, force the global
 * toggle-tile layout (same as “Show types in grid”) for status filters.
 */
.me5rine-lab-context-panel .pokehub-collection-status-filters-tiles-row,
.me5rine-lab-context-panel .pokehub-collection-display-filters-tiles-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  grid-template-columns: unset !important;
}

.me5rine-lab-context-panel .me5rine-lab-toggle-tile.pokehub-collection-status-filter-chip {
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  max-width: 100%;
  min-height: 2.85rem;
  padding: 0.55rem 0.85rem;
  gap: 0.55rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: 0.75rem;
}

.me5rine-lab-context-panel .me5rine-lab-toggle-tile.pokehub-collection-display-filter-chip {
  border-width: 1px;
}

.me5rine-lab-context-panel .pokehub-collection-generation-jump-links {
  margin-top: 0;
}

.me5rine-lab-context-panel .pokehub-share-panel .me5rine-lab-form-input,
.me5rine-lab-context-panel .pokehub-share-panel .me5rine-lab-form-button {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.me5rine-lab-context-panel .pokehub-share-panel .me5rine-lab-form-button {
  margin-top: 0.5rem;
}

@media (max-width: 960px) {
  .pokehub-collection-trade-list-view__layout {
    grid-template-columns: 1fr;
  }
}
