/**
 * Coins archive page (/coin/) — search, dual CTAs, pagination.
 * Critical layout lives here so missing Tailwind purge cannot collapse the page.
 */

body.post-type-archive-coin {
  overflow-x: hidden;
}

#coins-market {
  display: block;
  width: calc(100% - 24px);
  max-width: 1296px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  #coins-market {
    width: calc(100% - 48px);
  }
}

/* Toolbar: title + search — never let search steal 100% width in a row */
.coins-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.25rem;
  width: 100%;
}

.coins-toolbar__title {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.coins-search {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.coins-search__icon {
  pointer-events: none;
  position: absolute;
  top: 50%;
  right: 0.875rem;
  width: 1.25rem;
  height: 1.25rem;
  transform: translateY(-50%);
  color: #9ca3af;
}

.coins-search__input {
  display: block;
  width: 100%;
  height: 3rem;
  box-sizing: border-box;
  border: 1px solid #e8f5ee;
  border-radius: 0.75rem;
  background: #fff;
  padding: 0 2.75rem 0 1rem;
  font-size: 0.875rem;
  color: #1f2937;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.coins-search__input::placeholder {
  color: #9ca3af;
}

.coins-search__input:focus {
  border-color: rgba(87, 189, 132, 0.4);
  box-shadow: 0 0 0 2px rgba(87, 189, 132, 0.15);
}

@media (min-width: 768px) {
  .coins-toolbar {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
  }

  .coins-search {
    flex: 0 0 340px;
    width: 340px;
    max-width: 340px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.coins-search input[type='search']::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.market-row--coins {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.85fr) minmax(0, 1.35fr);
}

.market-trade-actions {
  display: flex;
  width: 100%;
  max-width: 11.5rem;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 0.35rem;
}

.market-trade-actions[data-market-skel-trade] > div {
  flex: 1 1 0;
  min-width: 0;
}

.market-row--coins .market-btn-buy,
.market-row--coins .market-btn-sell {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.4rem;
  font-size: 0.75rem;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.market-row--coins .market-btn-buy:hover,
.market-row--coins .market-btn-sell:hover {
  opacity: 0.92;
}

.market-logo-fallback {
  border-radius: 9999px;
  background: #e8f5ee;
}

.coins-pagination {
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  row-gap: 0.5rem;
}

.coins-pagination:not(.hidden) {
  display: flex;
}

.coins-page-btn {
  display: inline-flex;
  min-width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(87, 189, 132, 0.22);
  background: #fff;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.coins-page-btn:hover:not(:disabled):not(.is-active) {
  border-color: rgba(87, 189, 132, 0.45);
  color: #15803d;
}

.coins-page-btn.is-active {
  background: #57bd84;
  border-color: #57bd84;
  color: #fff;
  cursor: default;
}

.coins-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.coins-page-ellipsis {
  display: inline-flex;
  min-width: 1.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .market-row--coins .market-btn-buy,
  .market-row--coins .market-btn-sell {
    height: 2.5rem;
    padding: 0 0.6rem;
    font-size: 0.875rem;
  }

  .market-trade-actions {
    max-width: 13.5rem;
    gap: 0.5rem;
  }
}

@media (max-width: 639px) {
  .market-row--coins {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    grid-template-areas:
      'identity price'
      'change actions';
    row-gap: 0.5rem;
  }

  .market-row--coins > :nth-child(1) {
    grid-area: identity;
  }

  .market-row--coins > :nth-child(2) {
    grid-area: price;
  }

  .market-row--coins > :nth-child(3) {
    grid-area: change;
    justify-self: start;
  }

  .market-row--coins > :nth-child(4) {
    grid-area: actions;
  }

  .market-trade-actions {
    max-width: none;
  }

  .coins-page-btn {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.55rem;
    font-size: 0.8125rem;
  }
}
