/*
 * "Slab" theme for the eBay hub and everything under it (/admin/ebay*) -
 * scoped entirely under body.ebay-body so nothing here leaks elsewhere, same
 * pattern as gridiron.css (body.gridiron-body) and war_room.css
 * (body.war-room-body). Loaded automatically by stylesheet_link_tag :app
 * (Propshaft includes every file under app/assets/stylesheets), so no <link>
 * wiring beyond the Google Fonts import in the view's content_for(:head).
 *
 * This section is about graded trading cards, not football (gridiron.css) or
 * a tactical draft console (war_room.css), so it borrows neither of those
 * themes' colors or type. The palette is an invented "house" grading-label
 * identity, not a copy of any real grading company's trademarked colors -
 * antique gold label foil with dark ink text (oxblood-on-light read poorly
 * for the client, so oxblood was demoted to a hover-only accent rather than
 * a filled label background) and felt-green (the display-case felt cards
 * get shown on at card shows, currently unused but reserved) on a warm
 * near-black "holder" shell with card faces close to white (a true cream
 * read poorly against label text at this contrast level, so this leans much
 * closer to white than a literal aged-cardboard tone).
 * Each nav tile is shaped like a card in a graded holder (2.5:3.5 aspect
 * ratio) sitting in a binder pocket, not a generic dashboard card.
 *
 * Bootstrap's stylesheet double-loads on every page (stylesheet_link_tag :app
 * globs vendor/bootstrap.min.css a second time after application.css) and
 * carries !important on its utility classes, so any override needs matching
 * !important plus a two-class-deep selector - same pattern documented in
 * gridiron.css/war_room.css.
 */

/* Bootstrap's .container caps out at a fixed per-breakpoint max-width
   (1140px at lg, 1320px at xxl, etc.) rather than scaling with the
   viewport - too cramped for wide tables like the Collection listing (now
   with a Tags column). Widened to a fluid 80% on desktop-sized screens
   only; narrower screens keep Bootstrap's normal responsive behavior,
   where a fixed width would just make things worse. Applies to every
   eBay-section page (all share body.ebay-body), not just Collection. */
@media (min-width: 992px) {
  body.ebay-body .container {
    max-width: 80% !important;
  }
}

body.ebay-body {
  --eb-shell: #1C1712;
  --eb-stock: #FCFBF6;
  --eb-oxblood: #7A2331;
  --eb-felt: #1E4638;
  --eb-foil: #C9A758;
  --eb-ink: #2B2620;

  background: var(--eb-shell);
  color: var(--eb-stock);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

/* The site-wide footer (league links, player news ticker) is rendered by
   the shared application layout on every admin page - not specific to this
   section, so it's hidden here with CSS rather than touched at the layout
   level, which would affect every other admin page too. */
body.ebay-body footer {
  display: none;
}

body.ebay-body h1 {
  font-family: "Abril Fatface", Georgia, serif;
  font-weight: 400;
  font-size: 2rem;
  margin: 0;
  color: var(--eb-stock);
}

/*
 * Shared masthead (shared/_ebay_masthead), sitting above every page's own
 * heading. The background is a faceted, hard-edged angled pattern rather
 * than a soft gradient wash - it's a direct nod to a modern parallel card's
 * refractor/prizm foil (Prizm/Optic/Chrome), the one genuinely "shiny
 * modern card" visual this hobby actually has, not a decorative effect
 * invented for this UI. Kept low-opacity and slim (52px) so it reads as
 * texture, not a hero banner - "minimal screen real estate" was the brief.
 */
.ebay-masthead {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 1rem;
  margin-bottom: 1.5rem;
  border-radius: 10px;
  border: 1px solid rgba(252, 251, 246, 0.12);
  background:
    repeating-linear-gradient(
      115deg,
      rgba(201, 167, 88, 0.16) 0px, rgba(201, 167, 88, 0.16) 18px,
      rgba(122, 35, 49, 0.14) 18px, rgba(122, 35, 49, 0.14) 34px,
      rgba(30, 70, 56, 0.14) 34px, rgba(30, 70, 56, 0.14) 52px,
      transparent 52px, transparent 70px
    ),
    var(--eb-shell);
}

.ebay-masthead-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--eb-stock);
  text-decoration: none;
}

.ebay-masthead-icon {
  width: 18px;
  height: 24px;
  color: var(--eb-foil);
  flex-shrink: 0;
}

.ebay-masthead-word {
  font-family: "Abril Fatface", Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.ebay-masthead-brand:hover .ebay-masthead-word {
  color: var(--eb-foil);
}

.ebay-hub-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.ebay-hub-back {
  color: var(--eb-stock);
  opacity: 0.7;
  text-decoration: none;
  font-size: 0.9rem;
}

.ebay-hub-back:hover {
  opacity: 1;
  color: var(--eb-foil);
}

.ebay-binder-page {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.ebay-slab {
  display: flex;
  flex-direction: column;
  flex: 0 1 220px;
  max-width: 100%;
  aspect-ratio: 2.5 / 3.5;
  border-radius: 10px;
  overflow: hidden;
  background: var(--eb-stock);
  text-decoration: none;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ebay-slab:hover {
  border-color: var(--eb-oxblood);
  box-shadow: 0 0 0 1px var(--eb-oxblood), 0 10px 24px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .ebay-slab {
    transition: none;
  }
}

.ebay-slab-label {
  background: var(--eb-foil);
  padding: 0.6rem 0.9rem;
  border-bottom: 3px solid var(--eb-shell);
}

.ebay-slab-label-title {
  font-family: "Abril Fatface", Georgia, serif;
  font-size: 1.1rem;
  color: var(--eb-ink);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ebay-slab-window {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.9rem;
  color: var(--eb-ink);
}

.ebay-slab-desc {
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.ebay-slab-stat {
  display: inline-block;
  align-self: flex-start;
  margin-top: auto;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--eb-oxblood);
  border: 1px solid var(--eb-oxblood);
  border-radius: 3px;
  padding: 0.15rem 0.5rem;
}

/*
 * Reskins the shared sortable/searchable data table (shared/_data_table +
 * data_table_controller.js, already used as-is by Players/Leagues) rather
 * than forking it - only the surface colors change here, all sorting/search/
 * pagination behavior is untouched. Safe to add plain overrides (no
 * !important/extra specificity needed) since gridiron.css's rules are all
 * scoped to body.gridiron-body, which never applies on these admin pages.
 */
body.ebay-body .card {
  background: var(--eb-stock);
  color: var(--eb-ink);
  border: none;
}

body.ebay-body .form-control {
  background: var(--eb-stock);
  border: 1px solid rgba(0, 0, 0, 0.25);
  color: var(--eb-ink);
}

body.ebay-body .form-control:focus {
  background: var(--eb-stock);
  color: var(--eb-ink);
  border-color: var(--eb-foil);
  box-shadow: 0 0 0 0.2rem rgba(201, 167, 88, 0.35);
}

/*
 * NOT a blanket .text-muted override: it's used both directly on the dark
 * shell (e.g. the data table's row count) and nested inside cream .card/
 * .list-group-item surfaces on the Deal Alerts pages - a single color can't
 * serve both without going illegible in one of the two contexts. Bootstrap's
 * default muted gray already reads acceptably against both (~4.2:1 against
 * the shell, comfortably more against cream), so it's left alone; only the
 * row count gets its own lighter treatment since it's the one place muted
 * text sits directly on the darkest part of the shell with nothing else
 * behind it.
 */
body.ebay-body .data-table-row-count {
  color: rgba(252, 251, 246, 0.65);
}

body.ebay-body .nav-tabs {
  --bs-nav-link-color: var(--eb-stock);
  --bs-nav-link-hover-color: var(--eb-foil);
  --bs-nav-tabs-border-color: rgba(252, 251, 246, 0.25);
  --bs-nav-tabs-link-active-color: var(--eb-ink);
  --bs-nav-tabs-link-active-bg: var(--eb-stock);
  --bs-nav-tabs-link-active-border-color: rgba(252, 251, 246, 0.25) rgba(252, 251, 246, 0.25) var(--eb-stock);
}

body.ebay-body .btn-primary {
  --bs-btn-bg: var(--eb-oxblood);
  --bs-btn-border-color: var(--eb-oxblood);
  --bs-btn-hover-bg: #611b27;
  --bs-btn-hover-border-color: #611b27;
  --bs-btn-active-bg: #611b27;
  --bs-btn-active-border-color: #611b27;
}

/* Opt-in lighter button (see Add Card's submit button) - oxblood-on-near-
   black above reads fine for a button sitting on a lighter card body, but
   has too little contrast for one sitting directly on this theme's own
   near-black page background. */
body.ebay-body .ebay-btn-light {
  --bs-btn-bg: var(--eb-stock);
  --bs-btn-border-color: var(--eb-stock);
  --bs-btn-color: var(--eb-ink);
  --bs-btn-hover-bg: var(--eb-foil);
  --bs-btn-hover-border-color: var(--eb-foil);
  --bs-btn-hover-color: var(--eb-ink);
}

body.ebay-body .form-select {
  background-color: var(--eb-stock);
  border: 1px solid rgba(0, 0, 0, 0.25);
  color: var(--eb-ink);
}

body.ebay-body .form-select:focus {
  background-color: var(--eb-stock);
  color: var(--eb-ink);
  border-color: var(--eb-foil);
  box-shadow: 0 0 0 0.2rem rgba(201, 167, 88, 0.35);
}

/* Summary stats row above the collection/sold tables - reuses the same
   cert-label texture (Special Elite, oxblood) as .ebay-slab-stat elsewhere,
   just laid out as a row of labeled figures instead of a single small chip. */
.ebay-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.ebay-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ebay-stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(252, 251, 246, 0.6);
}

.ebay-stat-value {
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 1.05rem;
  color: var(--eb-foil);
}

/* Per-row tag chip picker on the eBay CSV import review page
   (admin/ebay_csv_imports/preview, see tag_picker_controller.js). Custom
   classes only, no Bootstrap .btn/.form-control mixed in - deliberately, so
   there's no Bootstrap !important to fight per the note at the top of this
   file. The table sits inside .table-responsive (overflow-x only), so the
   popover can safely position: absolute without being clipped vertically;
   it can still clip horizontally for a row near the right edge of a narrow
   viewport, which is an accepted tradeoff rather than a full repositioning
   library for what's an internal admin tool. */
.ebay-tag-cell {
  position: relative;
  min-width: 150px;
}

.ebay-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.ebay-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--eb-felt);
  color: var(--eb-stock);
  border: 1px solid var(--eb-foil);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  white-space: nowrap;
}

.ebay-tag-chip-remove {
  background: none;
  border: none;
  color: var(--eb-stock);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  font-size: 0.85rem;
}

.ebay-tag-add-btn {
  background: none;
  border: 1px dashed var(--eb-foil);
  color: var(--eb-foil);
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  cursor: pointer;
}

.ebay-tag-add-btn:hover {
  background: var(--eb-oxblood);
  color: var(--eb-stock);
  border-color: var(--eb-oxblood);
}

.ebay-tag-popover {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  width: 210px;
  background: var(--eb-ink);
  border: 1px solid var(--eb-foil);
  border-radius: 6px;
  padding: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.ebay-tag-search {
  width: 100%;
  background: var(--eb-shell);
  color: var(--eb-stock);
  border: 1px solid var(--eb-foil);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.ebay-tag-options {
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ebay-tag-option {
  background: none;
  border: none;
  color: var(--eb-stock);
  text-align: left;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}

.ebay-tag-option:hover {
  background: var(--eb-oxblood);
}

.ebay-tag-option-create {
  color: var(--eb-foil);
  font-style: italic;
}

/* Marks where the CSV import review table (admin/ebay_csv_imports/preview)
   crosses into dates already covered by the tracked collection - see
   EbayPurchaseHistoryImportService.last_tracked_purchase_date. table-striped
   assigns nth-child backgrounds with !important, so this needs the same
   !important override the top-of-file note describes. */
tr.ebay-cutoff-divider td {
  background: var(--eb-felt) !important;
  color: var(--eb-foil);
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.75rem;
  text-align: center;
  padding: 0.4rem;
}
