/* Sell Card: a grey page of white cards — the chosen gift card with Change, Balance with Quantity, quick amounts,
   Country, then Type (pictures) and Upload / Codes once chosen — with Settlement Amount and CONFIRM at the bottom. */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page.sell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--sell-bg);
}
.page.sell .page-header {
  background: var(--sell-bg);
  border-bottom-color: transparent;
}
.sl-content {
  max-width: 560px;
  margin: 0 auto;
  /* Room for the Settlement / CONFIRM bar. */
  padding: 8px 16px calc(132px + env(safe-area-inset-bottom, 0px));
  font-family: 'Outfit', sans-serif;
  color: var(--sell-ink);
}
.sl-body {
  display: flex;
  flex-direction: column;
}

/* The chosen gift card */
.sl-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 16px;
  border-radius: 18px;
  background: var(--sell-surface);
  box-shadow: 0 4px 18px var(--sell-shadow);
}
.sl-logo {
  width: 52px;
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 14px;
  color: var(--sell-ink);
  background: var(--sell-bg);
}
.sl-logo.is-small {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}
.sl-card-name {
  flex: 1;
  min-width: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sl-change {
  flex: none;
  padding: 9px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--sell-accent-ink);
  background: var(--sell-accent);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.sl-change:hover {
  filter: brightness(0.97);
}
.sl-change:active {
  transform: scale(0.97);
}

/* Section labels */
.sl-label {
  display: block;
  padding: 26px 2px 10px;
  font-size: 15px;
  font-weight: 400;
  color: var(--sell-muted);
}
.sl-label-row {
  display: flex;
  justify-content: space-between;
  padding-right: 34px;
}
.sl-optional {
  font-size: 13px;
}

/* Balance with Quantity */
.sl-balance {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  padding: 0 12px 0 18px;
  border-radius: 18px;
  border: 1.5px solid transparent;
  background: var(--sell-surface);
  box-shadow: 0 4px 18px var(--sell-shadow);
  transition: border-color 0.15s ease;
}
.sl-balance:focus-within {
  border-color: var(--sell-selected-line);
}
.sl-balance-icon {
  display: flex;
  font-size: 22px;
  color: var(--sell-muted);
}
.sl-balance-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 17px; /* 16px or more: iPhones don't zoom in on the field */
  font-variant-numeric: tabular-nums;
  color: var(--sell-ink);
}
.sl-balance-input::placeholder {
  color: var(--sell-muted);
}
.sl-divider {
  width: 1.5px;
  height: 26px;
  border-radius: 1px;
  background: var(--sell-line);
}
.sl-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sl-step {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 18px;
  color: var(--sell-ink);
  background: var(--sell-chip);
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.sl-step.is-plus {
  background: var(--sell-line);
}
.sl-step:active:not(:disabled) {
  transform: scale(0.92);
}
.sl-step:disabled {
  opacity: 0.4;
  cursor: default;
}
.sl-count {
  min-width: 22px;
  text-align: center;
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.sl-note {
  padding: 8px 4px 0;
  font-size: 13px;
  color: var(--sell-error);
}

/* Quick amounts */
.sl-quick {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sl-quick::-webkit-scrollbar {
  display: none;
}
.sl-chip {
  flex: none;
  min-width: 56px;
  height: 38px;
  padding: 0 13px;
  border-radius: 19px;
  border: 1.5px solid transparent;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--sell-label);
  background: var(--sell-surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sl-chip.is-selected {
  border-color: var(--sell-selected-line);
  background: var(--sell-selected);
  font-weight: 600;
}

/* Country and Type tiles */
.sl-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: 2px solid transparent;
  color: var(--sell-label);
  background: var(--sell-surface);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.sl-tile:active {
  transform: scale(0.98);
}
.sl-tile.is-selected {
  border-color: var(--sell-selected-line);
  background: var(--sell-selected);
  color: var(--sell-ink);
}
.sl-countries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}
.sl-country {
  gap: 8px;
  height: 92px;
  font-size: 17px;
}
.sl-country .flag {
  border-radius: 3px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12);
}
.sl-flag-blank {
  font-size: 12px;
  font-weight: 700;
  color: var(--sell-muted);
}
/* Type tiles: the same size and grid as the Country tiles, with a small picture in place of the flag. */
.sl-types {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}
.sl-type {
  gap: 6px;
  height: 92px;
  font-size: 17px;
  color: var(--sell-muted);
}
.sl-type.is-selected {
  font-weight: 700;
}
.sl-art {
  display: block;
  width: 42px;
  height: 32px;
}

/* Sections that appear after a choice (Type after Country, Upload / Codes after Type). */
.sl-reveal:not([hidden]) {
  animation: sl-reveal 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sl-reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sl-reveal:not([hidden]) {
    animation: none;
  }
}

/* Codes (Ecode) */
.sl-codes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sl-code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px 0 12px;
  border-radius: 16px;
  border: 1.5px solid transparent;
  background: var(--sell-surface);
  transition: border-color 0.15s ease;
}
.sl-code-box:focus-within {
  border-color: var(--sell-selected-line);
}
.sl-code-number {
  width: 26px;
  height: 26px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sell-muted);
  background: var(--sell-chip);
}
.sl-code-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.5px;
  color: var(--sell-ink);
}
.sl-code-input::placeholder {
  color: var(--sell-muted);
  letter-spacing: 0;
}

/* Upload */
.sl-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px;
}
.sl-photo {
  position: relative;
  aspect-ratio: 1;
  border-radius: 18px;
  overflow: hidden;
  background: var(--sell-surface);
}
.sl-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sl-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: visible;
  border: 2px dashed var(--sell-dash);
  font-size: 34px;
  color: var(--sell-ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.sl-add:hover {
  border-color: var(--sell-selected-line);
}
.sl-add small {
  font-size: 12px;
  color: var(--sell-muted);
}
.sl-photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 15px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.sl-hint {
  padding: 10px 2px 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--sell-muted);
}
.sl-error {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--sell-error);
  background: color-mix(in srgb, var(--sell-error) 9%, transparent);
}

/* Settlement Amount and CONFIRM, fixed to the bottom of the screen */
.sl-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)) 22px;
  border-radius: 22px 22px 0 0;
  background: var(--sell-surface);
  box-shadow: 0 -6px 24px var(--sell-shadow);
}
.sl-settle {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sl-settle-label {
  font-size: 15px;
  color: var(--sell-muted);
}
.sl-settle-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
}
.sl-settle-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--sell-ink);
  white-space: nowrap;
}
.sl-settle-value.is-empty {
  font-size: 20px;
}
.sl-settle-note {
  font-size: 13px;
  color: var(--sell-muted);
  white-space: nowrap;
}
.sl-confirm {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 22px 0 26px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--sell-confirm-ink);
  background: var(--sell-confirm);
  box-shadow: 0 6px 16px var(--sell-shadow);
  transition: transform 0.12s ease, background 0.2s ease, opacity 0.2s ease;
}
.sl-confirm .icon {
  font-size: 18px;
}
.sl-confirm:active:not(:disabled) {
  transform: scale(0.97);
}
.sl-confirm:disabled {
  cursor: default;
  color: rgba(255, 255, 255, 0.75);
  background: linear-gradient(115deg, var(--sell-disabled) 0 55%, color-mix(in srgb, var(--sell-disabled) 82%, #fff) 55% 100%);
  box-shadow: none;
}
.sl-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: sl-spin 0.7s linear infinite;
}
@keyframes sl-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Trading paused */
.sl-closed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
  color: var(--sell-muted);
}
.sl-closed-icon {
  font-size: 36px;
}
.sl-closed strong {
  font-size: 18px;
  color: var(--sell-ink);
}

/* Card picker (Change) */
.sl-card-list {
  display: flex;
  flex-direction: column;
  max-height: min(60vh, 520px);
  overflow-y: auto;
}
.sl-card-option {
  min-height: 60px;
  padding: 8px 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: var(--sell-ink);
  border-bottom: 1px solid var(--sell-divider);
}
.sl-card-option:hover,
.sl-card-option:focus-visible {
  background: var(--sell-bg);
  outline: none;
}
.sl-card-section { /* "Chime & crypto": sold on their own pages, listed after the gift cards */
  padding: 18px 4px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--sell-muted);
}
.sl-card-option-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sl-card-option-text strong {
  font-size: 15px;
  font-weight: 600;
}
.sl-card-option-text small {
  font-size: 12px;
  color: var(--sell-muted);
}
.sl-card-option.is-selected strong {
  font-weight: 700;
}
.sl-card-option .icon {
  font-size: 16px;
  color: var(--sell-ink);
}

@media (min-width: 600px) {
  .sl-bar {
    bottom: 16px;
    border-radius: 22px;
  }
}
