/* BuyCoded — components.css : buttons, cards, forms, pills, alerts, chips */

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 160ms var(--ease),
    background 160ms var(--ease),
    border-color 160ms var(--ease),
    box-shadow 200ms var(--ease),
    color 160ms var(--ease);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(0); }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.btn-sm { min-height: 36px; padding: var(--s-2) var(--s-4); font-size: var(--fs-xs); }
.btn-lg { min-height: 52px; padding: var(--s-4) var(--s-6); font-size: var(--fs-base); }
.btn-block { width: 100%; }

/* Primary — accent blue */
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--sh-blue);
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(79,142,255,.45);
}
.btn-primary:active { transform: translateY(0); box-shadow: var(--sh-blue); }

/* Dark / "Outline on dark surface" — uses elevated dark surface */
.btn-dark {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-dark:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--sh-md);
}

/* Secondary — same as btn-dark on this theme */
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--accent);
}

/* Ghost — transparent with hover tint */
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* Outline-light — kept for hero CTA row, transparent w/ white border */
.btn-outline-light {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,.20);
}
.btn-outline-light:hover { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.40); }

.btn-danger {
  background: var(--danger);
  color: var(--bg);
  font-weight: 700;
}
.btn-danger:hover { background: #fca5a5; color: var(--bg); transform: translateY(-1px); box-shadow: var(--sh-md); }

.btn-link {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 0;
  font-weight: 600;
  cursor: pointer;
  min-height: 0;
}
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* === Pills / Badges (dark-theme contrast) === */
.pill {
  display: inline-block;
  padding: 3px 10px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: var(--s-2);
  line-height: 1.5;
  border: 1px solid rgba(79,142,255,.20);
}
.pill-orange     { background: var(--accent-soft); color: var(--accent); border-color: rgba(79,142,255,.20); } /* legacy alias */
.pill-blue       { background: var(--accent-soft); color: var(--accent); border-color: rgba(79,142,255,.20); }
.pill-navy       { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.pill-success,
.pill-paid       { background: rgba(52,211,153,.12); color: #6ee7b7; border-color: rgba(52,211,153,.25); }
.pill-warning,
.pill-pending    { background: rgba(251,191,36,.14); color: #fcd34d; border-color: rgba(251,191,36,.30); }
.pill-info       { background: var(--accent-soft); color: var(--accent); border-color: rgba(79,142,255,.20); }
.pill-refunded   { background: rgba(167,139,250,.12); color: #c4b5fd; border-color: rgba(167,139,250,.25); }
.pill-failed,
.pill-expired,
.pill-danger     { background: rgba(248,113,113,.12); color: #fca5a5; border-color: rgba(248,113,113,.25); }
.pill-featured   { background: rgba(251,191,36,.14); color: #fcd34d; border-color: rgba(251,191,36,.30); }
.pill-verified   { background: rgba(52,211,153,.12); color: #6ee7b7; border-color: rgba(52,211,153,.25); }

/* === Inputs === */
.field { display: grid; gap: 6px; margin-bottom: var(--s-4); }
.field > span { font-weight: 600; font-size: var(--fs-sm); color: var(--text-soft); }
.field small { color: var(--text-muted); font-size: var(--fs-xs); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font: inherit;
  font-size: var(--fs-base);
  background: var(--surface);
  color: var(--navy-900);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
  min-height: 44px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(79,142,255,.18);
  outline: none;
}
input.is-error, select.is-error, textarea.is-error,
.field.is-error input,
.field.is-error textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}
textarea { resize: vertical; min-height: 120px; }
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%), linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 13px) calc(50% - 2px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
input[type="checkbox"], input[type="radio"] {
  min-height: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--blue-500);
  cursor: pointer;
}

/* Chrome autofill override — keep text light on dark surfaces */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  caret-color: var(--text);
}

/* === Alerts / flash (dark-theme contrast) === */
.alert {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
  font-weight: 500;
  border-left: 4px solid transparent;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
  color: var(--text);
}
.alert-ok,
.alert-success { background: rgba(52,211,153,.10);  border-left-color: var(--success); color: #6ee7b7; }
.alert-err,
.alert-danger  { background: rgba(248,113,113,.10); border-left-color: var(--danger);  color: #fca5a5; }
.alert-warning { background: rgba(251,191,36,.12);  border-left-color: var(--warning); color: #fcd34d; }
.alert-info    { background: var(--accent-soft);    border-left-color: var(--accent);  color: var(--text); }

.flash {
  padding: var(--s-3) var(--s-4);
  font-weight: 600;
  text-align: center;
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-subtle);
}
.flash-ok  { background: rgba(52,211,153,.12);  color: #6ee7b7; border-color: rgba(52,211,153,.30); }
.flash-err { background: rgba(248,113,113,.12); color: #fca5a5; border-color: rgba(248,113,113,.30); }

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--sh-sm);
}
.card-soft {
  background: var(--surface-2);
}
.card-lift {
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), border-color 200ms var(--ease);
}
.card-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-md);
  border-color: var(--blue-100);
}

/* === Chips === */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); }
.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
  text-decoration: none;
  min-height: 36px;
}
.chip:hover { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-600); }
.chip.is-active { background: var(--blue-500); border-color: var(--blue-500); color: #fff; }
.chip.is-active:hover { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.chips-lg .chip { padding: var(--s-3) var(--s-5); font-size: var(--fs-base); }

/* === Links === */
.link-arrow {
  color: var(--blue-600);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.link-arrow:hover { color: var(--blue-500); }

/* === Check list (used on legal/about) === */
.check-list { list-style: none; padding-left: 0; }
.check-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: var(--s-3);
}
.check-list li::before {
  content: "\2713";
  position: absolute;
  left: 0; top: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--blue-500);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* === Section helpers === */
.section-alt { background: var(--surface-2); }
.section-head { text-align: center; margin-bottom: var(--s-8); }
.section-head h2 { margin-top: var(--s-2); }
.section-head p  { color: var(--text-muted); max-width: 640px; margin: var(--s-2) auto 0; }
.section-cta { text-align: center; margin-top: var(--s-8); }

/* === Empty states === */
.empty-state {
  text-align: center;
  padding: var(--s-8) var(--s-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
}
.empty-state.inline { padding: var(--s-5); min-height: 140px; }
.empty-state h2 { margin-bottom: var(--s-2); }
.empty-state p { color: var(--text-soft); margin: 0; }

/* === Breadcrumb === */
.breadcrumb {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  padding-top: var(--s-5);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--blue-600); }
.breadcrumb [aria-current="page"] { color: var(--navy-900); font-weight: 600; }

/* === Product card (marketplace catalog) === */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), border-color 200ms var(--ease);
  box-shadow: var(--sh-sm);
  text-decoration: none;
  color: inherit;
  position: relative;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-md);
  border-color: var(--blue-100);
  color: inherit;
}
.product-card-media {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--blue-50);
}
.product-card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms var(--ease);
}
.product-card:hover .product-card-media img { transform: scale(1.03); }
.product-card-featured-pill {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  background: var(--featured);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-full);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.product-card-body { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); flex: 1; }
.product-card-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--blue-600);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.product-card-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--navy-900);
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-desc {
  color: var(--text-soft);
  font-size: var(--fs-sm);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-meta {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.product-card-meta .stars { color: var(--star); }
.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-4) var(--s-4);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}
.product-card-price { font-size: var(--fs-lg); font-weight: 700; color: var(--navy-900); }
.product-card-cta {
  color: var(--blue-600);
  font-weight: 600;
  font-size: var(--fs-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Product grid: 1 → 4 cols responsive */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-5);
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr; gap: var(--s-4); }
}

/* === Tag chips (small) === */
.tag-chip {
  display: inline-block;
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-full);
  margin-right: 4px;
}

/* === Star rating === */
.stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  color: var(--star);
  font-size: var(--fs-sm);
}

/* === Table (generic) === */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--sh-sm);
}
table.data-table thead th {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
table.data-table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}
table.data-table tbody tr:nth-child(even) { background: var(--surface-2); }
table.data-table tbody tr:hover { background: var(--blue-50); }
table.data-table .t-num { text-align: right; font-variant-numeric: tabular-nums; }
