/* ============================================================
   PartCy theme — automotive-professional token layer.
   Loaded after novadark.css: overrides NovaDark tokens and adds
   the project components (buttons, chips, badges, search panel,
   filters, product cards, accordion). Both themes supported via
   [data-theme] toggled by novadark.js.
   ============================================================ */

/* ── Dark (default) ─────────────────────────────────────────── */
:root,
[data-theme="dark"] {
  /* Graphite surfaces — never pure black */
  --bg-0: #0A0D12;
  --bg-1: #0E131B;
  --bg-2: #141B26;
  --bg-3: #1B2432;
  --bg-4: #232E3F;

  --text-primary: #E6EBF2;
  --text-secondary: #A9B4C4;
  --text-muted: #8494A9;
  --text-accent: #FFFFFF;

  --border-subtle: rgba(148, 163, 184, 0.09);
  --border-default: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.24);
  --border-hover: rgba(148, 163, 184, 0.34);

  /* Action red */
  --accent-primary: #DC2626;
  --accent-primary-rgb: 220, 38, 38;
  --accent-primary-glow: rgba(220, 38, 38, 0.16);
  --accent-primary-hover: #B91C1C;

  /* Steel blue secondary */
  --accent-secondary: #334155;
  --accent-secondary-hover: #1E293B;

  --accent-success: #34D399;
  --accent-success-bg: rgba(52, 211, 153, 0.12);
  --accent-warning: #FBBF24;
  --accent-warning-bg: rgba(251, 191, 36, 0.12);
  --accent-info: #7DA2C9;
  --accent-info-bg: rgba(125, 162, 201, 0.14);

  --font-sans: 'Nunito Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Rubik', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  --shadow-pop: 0 16px 40px rgba(2, 6, 12, 0.45);
}

/* ── Light ──────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-0: #FFFFFF;
  --bg-1: #F8FAFC;
  --bg-2: #F1F5F9;
  --bg-3: #E2E8F0;
  --bg-4: #CBD5E1;

  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #526075;
  --text-accent: #0B1220;

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-default: rgba(15, 23, 42, 0.14);
  --border-strong: rgba(15, 23, 42, 0.22);
  --border-hover: rgba(15, 23, 42, 0.32);

  --accent-primary: #DC2626;
  --accent-primary-rgb: 220, 38, 38;
  --accent-primary-glow: rgba(220, 38, 38, 0.10);
  --accent-primary-hover: #B91C1C;

  --accent-secondary: #334155;
  --accent-secondary-hover: #1E293B;

  --accent-success: #047857;
  --accent-success-bg: rgba(4, 120, 87, 0.10);
  --accent-warning: #B45309;
  --accent-warning-bg: rgba(180, 83, 9, 0.10);
  --accent-info: #33557D;
  --accent-info-bg: rgba(51, 85, 125, 0.10);

  --shadow-pop: 0 16px 40px rgba(15, 23, 42, 0.12);
}

/* ── Typography ─────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
}
h1, h2, h3, h4, h5, h6, .font-display {
  font-family: var(--font-display);
}

/* ── Buttons (NovaDark ships no .nd-btn--* variants) ────────── */
.nd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.1;
  padding: 0.55rem 1.25rem;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease,
    border-color 0.18s ease, opacity 0.18s ease;
}
.nd-btn--primary {
  background: var(--accent-primary);
  color: #FFFFFF;
}
.nd-btn--primary:hover {
  background: var(--accent-primary-hover);
  color: #FFFFFF;
}
.nd-btn--secondary {
  background: var(--accent-secondary);
  color: #F1F5F9;
}
.nd-btn--secondary:hover {
  background: var(--accent-secondary-hover);
  color: #FFFFFF;
}
.nd-btn--ghost {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-secondary);
}
.nd-btn--ghost:hover {
  border-color: var(--border-hover);
  color: var(--text-accent);
}
.nd-btn--sm {
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  border-radius: 8px;
}
.nd-btn--lg {
  min-height: 52px;
  padding: 0.7rem 1.75rem;
  font-size: 1rem;
}
.nd-btn--pill {
  border-radius: 999px;
}

/* ── OEM article number chip (mono, everywhere) ─────────────── */
.article-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-3);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.article-chip--lg {
  font-size: 0.88rem;
  padding: 4px 12px;
}

/* ── Condition badges ───────────────────────────────────────── */
.condition-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.condition-badge--new {
  color: var(--accent-success);
  background: var(--accent-success-bg);
}
.condition-badge--used {
  color: var(--accent-warning);
  background: var(--accent-warning-bg);
}
.condition-badge--refurb {
  color: var(--accent-info);
  background: var(--accent-info-bg);
}

/* ── Form fields ────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea,
select {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-primary);
}
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}
.form-card input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]),
.form-card textarea,
.form-card select {
  width: 100%;
}
.form-card {
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2rem;
}

/* ── Search panel (top of catalog) ──────────────────────────── */
.search-panel {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 1.25rem;
}
.search-panel__form {
  display: flex;
  gap: 0.6rem;
}
.search-panel__input-wrap {
  position: relative;
  flex: 1;
}
.search-panel__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-panel input[type="search"] {
  width: 100%;
  min-height: 52px;
  padding-left: 44px;
  font-size: 1.05rem;
  background: var(--bg-1);
}
.search-panel__hint {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
@media (max-width: 639px) {
  .search-panel__form {
    flex-direction: column;
  }
}

/* ── Search island dropdown host ────────────────────────────── */
#search-island {
  position: relative;
  display: block;
}

/* ── Category chips ─────────────────────────────────────────── */
.chip-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--bg-2);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}
.chip:hover {
  border-color: var(--border-hover);
  color: var(--text-accent);
}
.chip.is-active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #FFFFFF;
}

/* ── Catalog layout ─────────────────────────────────────────── */
.catalog-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}
@media (min-width: 1024px) {
  .catalog-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .catalog-filters {
    position: sticky;
    top: 5rem;
  }
}

/* ── Filter sidebar ─────────────────────────────────────────── */
.filters-panel {
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
}
.filters-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  min-height: 44px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: color 0.18s ease;
}
.filters-summary::-webkit-details-marker {
  display: none;
}
.filters-summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}
details[open] > .filters-summary::after {
  transform: rotate(-135deg);
}
.filters-body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 0.25rem 1.1rem 1.1rem;
}
.filters-group {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.filters-legend {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.filters-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 30px;
}
.filters-option input[type="radio"] {
  appearance: none;
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-1);
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-content: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.filters-option input[type="radio"]:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}
.filters-option input[type="radio"]:checked::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.filters-option:hover span {
  color: var(--text-accent);
}
.filters-body input[type="number"] {
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  font-size: 0.85rem;
  background: var(--bg-1);
}
@media (max-width: 1023px) {
  .filters-summary {
    border-bottom: 1px solid var(--border-subtle);
  }
}

/* ── Product card ───────────────────────────────────────────── */
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.product-card:hover {
  border-color: var(--border-hover);
}
.product-card__image {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  color: var(--text-muted);
}
.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.75rem;
  transition: opacity 0.2s ease;
}
.product-card:hover .product-card__image img {
  opacity: 0.92;
}
.product-card__placeholder {
  opacity: 0.5;
}
.product-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
}
.product-card__title a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color 0.18s ease;
}
.product-card__title a:hover {
  color: var(--accent-primary);
}
.product-card__price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-accent);
}

/* ── Trust strip ────────────────────────────────────────────── */
.trust-card {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
}
.trust-card__icon {
  flex-shrink: 0;
  display: grid;
  place-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
}

/* ── FAQ accordion ──────────────────────────────────────────── */
.accordion {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-2);
  overflow: hidden;
}
.accordion + .accordion {
  margin-top: 0.6rem;
}
.accordion__summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.2rem;
  min-height: 44px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: color 0.18s ease;
  user-select: none;
}
.accordion__summary::-webkit-details-marker {
  display: none;
}
.accordion__summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}
details[open] > .accordion__summary::after {
  transform: rotate(-135deg);
}
.accordion__body {
  padding: 0 1.2rem 1.1rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ── CTA band ───────────────────────────────────────────────── */
.cta-band {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

/* ── Spec table (product detail) ────────────────────────────── */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.spec-table th,
.spec-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}
.spec-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-family: var(--font-display);
  width: 45%;
}
.spec-table td {
  color: var(--text-primary);
}

/* ── Interaction hygiene ────────────────────────────────────── */
a,
button,
summary,
label,
select,
[role="option"] {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
