/* Stickernomics - Physical Panini Sticker Album Stylesheet */

:root {
  --bg-main: #faf6f0;
  --bg-card: #ffffff;
  --bg-card-hover: #fffcf7;
  --bg-input: #fffcf7;
  --border-color: #e5dec9;
  --border-dark: #d6cebf;
  --border-focus: #2563eb;

  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;

  --accent-blue: #2563eb;
  --accent-red: #dc2626;
  --accent-amber: #d97706;
  --accent-indigo: #2563eb;

  --status-fair: #15803d;
  --status-fair-bg: #dcfce7;
  --status-fair-border: #86efac;

  --status-you: #1e40af;
  --status-you-bg: #dbeafe;
  --status-you-border: #93c5fd;

  --status-partner: #92400e;
  --status-partner-bg: #fef3c7;
  --status-partner-border: #fde68a;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-card: none;
  --shadow-glow: none;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  background-image: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 16px;
}

.header-branding {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-red);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: none;
}

.app-header h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
}

.app-header .subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Toggle Switch */
.switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-secondary);
}

.switch-label input {
  display: none;
}

.switch-slider {
  position: relative;
  width: 38px;
  height: 22px;
  background-color: #d1d5db;
  border-radius: 20px;
  transition: 0.3s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

.switch-label input:checked+.switch-slider {
  background-color: var(--accent-blue);
}

.switch-label input:checked+.switch-slider::before {
  transform: translateX(16px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: none;
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  background: #e2dacd;
  color: var(--text-primary);
  border: 1px solid var(--border-dark);
}

.btn-secondary:hover {
  background: var(--border-dark);
}

.btn-outline {
  background: #ffffff;
  color: var(--text-secondary);
  border: 1px solid #d1d5db;
}

.btn-outline:hover {
  color: var(--text-primary);
  background: #f3f4f6;
  border-color: #9ca3af;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: #e5dec9;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: none;
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  background: #faf6f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-title-group h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  background: #faf6f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Sample buttons */
.sample-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sample-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Input Area */
textarea#tradeInput {
  width: 100%;
  height: 180px;
  background: var(--bg-input);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 14px 16px;
  resize: vertical;
  transition: border-color 0.2s;
}

textarea#tradeInput:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: none;
}

/* Badges & Sticker Chips */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-muted {
  background: #e5dec9;
  color: var(--text-secondary);
}

/* Dashboard Score Cards */
.fairness-dashboard {
  background: var(--bg-card);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 20px;
  padding: 24px;
  align-items: center;
}

@media (max-width: 880px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.score-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Solid 3-4px top border in a bold primary color (red, blue, amber) — no shadow */
.score-receive {
  border-top: 4px solid var(--accent-blue);
}

.score-give {
  border-top: 4px solid var(--accent-amber);
}

.score-center {
  border-top: 4px solid var(--accent-red);
  background: #faf6f0;
}

.score-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.score-value-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 6px;
}

.score-num {
  font-size: 34px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -1px;
}

.score-receive .score-num {
  color: var(--accent-blue);
}

.score-give .score-num {
  color: var(--accent-amber);
}

.score-center .score-num {
  color: var(--accent-red);
}

.score-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.score-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Status Badge - Pale tint background with dark text in same hue family, pill-shaped, no glow */
.fairness-status-wrapper {
  margin: 8px 0 10px;
}

.status-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 6px 18px;
  border-radius: 9999px;
  text-transform: uppercase;
  box-shadow: none;
  transition: none;
}

.status-fair {
  background: var(--status-fair-bg);
  color: var(--status-fair);
  border: 1px solid var(--status-fair-border);
  box-shadow: none;
}

.status-favors-you {
  background: var(--status-you-bg);
  color: var(--status-you);
  border: 1px solid var(--status-you-border);
  box-shadow: none;
}

.status-favors-partner {
  background: var(--status-partner-bg);
  color: var(--status-partner);
  border: 1px solid var(--status-partner-border);
  box-shadow: none;
}

.ratio-metrics {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.ratio-item {
  font-size: 12px;
  color: var(--text-secondary);
}

.ratio-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  margin-left: 4px;
}

/* Balance Meter Bar */
.balance-meter-container {
  width: 100%;
  max-width: 280px;
}

.balance-meter-bar {
  position: relative;
  height: 8px;
  background: #e5dec9;
  border-radius: 4px;
  overflow: visible;
  margin-bottom: 6px;
}

.fair-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #86efac;
  border-radius: 4px;
}

.balance-pointer {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border: 3px solid var(--accent-blue);
  border-radius: 50%;
  transform: translateX(-50%);
  transition: left 0.4s ease;
  box-shadow: none;
}

.balance-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.fair-label {
  color: var(--status-fair);
  font-weight: 600;
}

/* Two Columns Trade Sides */
.trade-columns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 820px) {
  .trade-columns-grid {
    grid-template-columns: 1fr;
  }
}

.trade-column {
  background: var(--bg-card);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: none;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.column-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.column-icon {
  font-size: 20px;
}

.column-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.column-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
}

.column-actions {
  display: flex;
  gap: 6px;
}

/* Collection Cards */
.collections-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.collection-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.collection-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-dark);
}

.collection-card.excluded {
  opacity: 0.5;
  filter: grayscale(80%);
  background: #f3eee7;
}

.collection-card-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.collection-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

/* Custom Checkbox */
.custom-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.collection-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.collection-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-tags {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* Physical Sticker Chips: solid saturated background, high-contrast text, 8px rounded corners, no gradient */
.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 700;
  line-height: 1.2;
}

.tag-category {
  background: var(--accent-blue);
  color: #ffffff;
}

.tag-specials {
  background: var(--accent-amber);
  color: #ffffff;
}

.tag-era {
  background: #475569;
  color: #ffffff;
}

.collection-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.collection-values {
  text-align: right;
}

.col-points {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.col-count {
  font-size: 11px;
  color: var(--text-muted);
}

.chevron-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.chevron-btn.expanded {
  transform: rotate(180deg);
}

/* Sticker Items Inside Collection */
.collection-stickers {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border-color);
  background: #faf6f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sticker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  font-size: 12px;
  transition: background-color 0.15s;
}

.sticker-item:hover {
  background: #fffcf7;
}

.sticker-item.excluded {
  opacity: 0.45;
  text-decoration: line-through;
  background: #f3eee7;
}

.sticker-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sticker-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 13px;
}

/* Physical Sticker Badges: solid saturated colors, high-contrast text, 8px rounded corners, no gradient */
.sticker-special-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--accent-red);
  color: #ffffff;
  font-weight: 700;
  text-transform: capitalize;
}

.sticker-ls-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  background: #059669;
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 700;
}

.sticker-ebay-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  background: #7c3aed;
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: background-color 0.15s ease;
}

.sticker-ebay-badge:hover {
  background: #6d28d9;
}

.tag-ebay {
  background: #7c3aed;
  color: #ffffff;
}

.sticker-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
}

/* Recommendations Card */
.recommendations-card {
  border-left: 4px solid var(--accent-blue);
}

.rec-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1e40af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.recommendations-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #faf6f0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  gap: 12px;
  flex-wrap: wrap;
}

.rec-text {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  min-width: 260px;
}

/* Partner Message Card */
.msg-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1e40af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

pre.partner-msg-content {
  background: var(--bg-input);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
}

/* Loading Card Overlay & Spinner */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(250, 246, 240, 0.9);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.loading-card {
  background: #ffffff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: 36px 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.glow-spinner-wrapper {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
}

.glow-spinner-ring {
  box-sizing: border-box;
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: rotateRing 1s linear infinite;
  box-shadow: none;
}

.glow-spinner-inner {
  box-sizing: border-box;
  position: absolute;
  top: 10px;
  left: 10px;
  width: 52px;
  height: 52px;
  border: 3px solid transparent;
  border-top-color: var(--accent-red);
  border-radius: 50%;
  animation: rotateRing 0.7s linear infinite reverse;
  box-shadow: none;
}

@keyframes rotateRing {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.loading-card h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.loading-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Alert Details & Stacktrace */
.alert-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-content details {
  margin-top: 6px;
  font-size: 12px;
}

.alert-content summary {
  cursor: pointer;
  color: #dc2626;
  font-weight: 600;
}

.alert-content pre {
  margin-top: 6px;
  background: #ffffff;
  padding: 10px;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
  color: #991b1b;
}

.alert-error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  margin-bottom: 24px;
  color: #991b1b;
  font-size: 14px;
}

.alert-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #991b1b;
  font-size: 18px;
  cursor: pointer;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #15803d;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}