/* ============================================================
   OEM BROWSER — styles for comp-oem-browser.jsx
   Layout: 3-column (tree / canvas / parts list) + bottom cart bar
   Inspired by ktmsklep.pl & crosscentrum.pl OEM catalogues
   ============================================================ */

.oem-page { display: flex; flex-direction: column; min-height: calc(100vh - 140px); padding-bottom: 80px; }

/* --- DEMO BAR (standalone page only) --- */
.oem-demo-bar {
  padding: 7px 14px; border-bottom: 1px solid var(--line-1); background: var(--surf-1);
  display: flex; align-items: center; gap: 10px; overflow: hidden;
}
.oem-demo-bar-title {
  font-size: 10px; color: var(--text-3); text-transform: uppercase; font-weight: 700; letter-spacing: .06em;
  display: flex; align-items: center; gap: 5px; flex-shrink: 0; white-space: nowrap;
  max-width: 50%; overflow: hidden; text-overflow: ellipsis;
}
.oem-demo-vehicles {
  display: flex; gap: 5px; align-items: center; flex: 1; min-width: 0;
  overflow-x: auto; padding-bottom: 1px;
  scrollbar-width: thin;
}
.oem-demo-vehicles::-webkit-scrollbar { height: 3px; }
.oem-demo-vbtn {
  padding: 4px 8px; font-size: 10px; font-weight: 600;
  background: var(--surf-0); border: 1px solid var(--line-1); border-radius: var(--radius-1); cursor: pointer;
  color: var(--text-2); white-space: nowrap; flex-shrink: 0;
}
.oem-demo-vbtn:hover { background: var(--surf-2); color: var(--text-1); }
.oem-demo-vbtn.is-active { background: #111; color: #fff; border-color: #111; }

/* --- MAIN CONTAINER --- */
.oem-browser {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  background: var(--surf-0); border: 1px solid var(--line-1); border-radius: var(--radius-1);
  margin: 0; overflow: hidden;
}
.oem-browser.is-compact { margin: 0; border: none; border-radius: 0; }

/* --- HEADER (vehicle + search) --- */
.oem-header {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--line-1); background: var(--surf-0); flex-wrap: nowrap; overflow: hidden;
}
.oem-vehicle { display: flex; align-items: center; gap: 9px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
.oem-vehicle-info { min-width: 0; overflow: hidden; }
.oem-vehicle-badge {
  width: 34px; height: 34px; border-radius: var(--radius-1); background: #111; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; font-family: 'Playfair Display', Georgia, serif; flex-shrink: 0;
}
.oem-vehicle-badge[data-brand="ktm"] { background: #ff6600; }
.oem-vehicle-badge[data-brand="yamaha"] { background: #0052a5; }
.oem-vehicle-badge[data-brand="honda"] { background: #cc0000; }
.oem-vehicle-badge[data-brand="husqvarna"] { background: #273a60; }
.oem-vehicle-title {
  font-size: 13px; font-weight: 700; color: var(--text-1);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  white-space: nowrap;
}
.oem-vehicle-lock {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); background: var(--surf-1); border: 1px solid var(--line-1);
  padding: 2px 5px; border-radius: var(--radius-1);
}
.oem-vehicle-sub { font-size: 10px; color: var(--text-3); font-family: var(--font-mono); margin-top: 2px; }
.oem-header-search {
  flex: 0 1 320px; display: flex; align-items: center; gap: 6px;
  padding: 5px 9px; background: var(--surf-1); border: 1px solid var(--line-1); border-radius: var(--radius-1);
  margin-left: auto; min-width: 140px;
}
.oem-header-search input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 12px; color: var(--text-1);
}
.oem-header-search-clear {
  width: 16px; height: 16px; border: none; background: var(--surf-2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-3);
}

/* --- BODY (3 columns) --- */
.oem-body {
  display: grid; grid-template-columns: 240px 1fr 340px; flex: 1; min-height: 0;
}

/* ========== SIDEBAR (left) ========== */
.oem-sidebar {
  border-right: 1px solid var(--line-1); background: var(--surf-1);
  display: flex; flex-direction: column; overflow: hidden; position: relative;
}
.oem-sidebar-title {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-3); padding: 12px 14px 6px; display: flex; align-items: center; gap: 6px;
}
.oem-sidebar-title-chip {
  font-size: 9px; color: var(--text-1); background: var(--surf-2); padding: 1px 5px; border-radius: var(--radius-1);
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
.oem-sidebar-divider { height: 1px; background: var(--line-1); margin: 6px 10px; }

.oem-group-list { display: flex; flex-direction: column; padding: 0 6px; }
.oem-group-btn {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  border: none; background: transparent; border-radius: var(--radius-1); cursor: pointer;
  text-align: left; color: var(--text-2); font-size: 12px; font-weight: 600;
  border-left: 2px solid transparent;
}
.oem-group-btn:hover { background: var(--surf-2); color: var(--text-1); }
.oem-group-btn.is-active { background: var(--surf-0); color: var(--text-1); border-left-color: #ff6600; font-weight: 700; }
.oem-group-label { flex: 1; }
.oem-group-count {
  font-size: 10px; color: var(--text-3); background: var(--surf-2); padding: 1px 6px; border-radius: var(--radius-2);
  font-weight: 700;
}

.oem-schema-list {
  list-style: none; padding: 0 6px; margin: 0; overflow-y: auto; flex: 1;
}
.oem-schema-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: var(--radius-1); cursor: pointer; font-size: 12px; color: var(--text-2);
  border-left: 2px solid transparent;
}
.oem-schema-item:hover { background: var(--surf-2); color: var(--text-1); }
.oem-schema-item.is-active { background: var(--surf-0); color: var(--text-1); border-left-color: #ff6600; font-weight: 600; }
.oem-schema-item.is-ghost { opacity: 0.55; cursor: not-allowed; }
.oem-schema-item.is-ghost:hover { background: transparent; }
.oem-schema-code {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--text-3); flex: 0 0 28px;
}
.oem-schema-item.is-active .oem-schema-code { color: #ff6600; }
.oem-schema-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oem-schema-count, .oem-schema-ghost {
  font-size: 9px; color: var(--text-3); font-family: var(--font-mono);
}
.oem-schema-ghost { color: #c0b8a8; font-style: italic; }

/* --- HOVER PEEK (czarny tooltip z preview SVG) --- */
.oem-hover-peek {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: #0a0a0a; color: #fff; width: 340px; border-radius: var(--radius-1);
  box-shadow: 0 14px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.05);
  z-index: 80; padding: 12px 12px 10px; pointer-events: none;
  animation: oem-peek-in 0.15s ease;
}
@keyframes oem-peek-in {
  from { opacity: 0; transform: translateY(-50%) translateX(-4px); }
  to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}
.oem-hover-peek::before {
  content: ''; position: absolute; left: -5px; top: 50%; transform: translateY(-50%) rotate(45deg);
  width: 10px; height: 10px; background: #0a0a0a;
}
.oem-hover-peek-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: 12px; font-weight: 700;
}
.oem-hover-peek-code {
  font-family: var(--font-mono); font-size: 10px; color: #ff6600;
  background: rgba(255,102,0,0.12); padding: 2px 6px; border-radius: var(--radius-1);
}
.oem-hover-peek-svg {
  background: #f2ede3; border-radius: var(--radius-1); aspect-ratio: 640 / 400; overflow: hidden;
  padding: 8px;
}
.oem-hover-peek-foot {
  font-size: 10px; color: rgba(255,255,255,0.55); margin-top: 8px;
}

/* ========== CANVAS (center) ========== */
.oem-canvas { display: flex; flex-direction: column; overflow: hidden; background: var(--surf-0); }
.oem-canvas-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-bottom: 1px solid var(--line-1);
}
.oem-canvas-title {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-1);
  min-width: 0;
}
.oem-canvas-title > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oem-canvas-code {
  font-family: var(--font-mono); font-size: 11px; color: #fff;
  background: #ff6600; padding: 2px 7px; border-radius: var(--radius-1); font-weight: 800;
}
.oem-canvas-tools {
  display: flex; align-items: center; gap: 4px; margin-left: auto;
  background: var(--surf-1); border: 1px solid var(--line-1); border-radius: var(--radius-1); padding: 2px;
}
.oem-zoom-btn {
  width: 24px; height: 24px; border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: var(--radius-1); color: var(--text-2);
}
.oem-zoom-btn:hover { background: var(--surf-2); color: var(--text-1); }
.oem-zoom-value { font-size: 10px; font-family: var(--font-mono); color: var(--text-2); min-width: 36px; text-align: center; }
.oem-zoom-divider { width: 1px; height: 16px; background: var(--line-1); margin: 0 2px; }

.oem-canvas-wrap {
  flex: 1; min-height: 0; position: relative; overflow: auto;
  background:
    linear-gradient(#f2ede3, #f2ede3),
    repeating-linear-gradient(0deg, transparent 0 19px, rgba(0,0,0,0.03) 19px 20px),
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(0,0,0,0.03) 19px 20px);
  background-blend-mode: multiply;
  padding: 20px;
}
html[data-theme="dark"] .oem-canvas-wrap { background: #1c1915; }
.oem-canvas-inner {
  width: 100%; height: 100%; min-height: 400px; transform-origin: top center; transition: transform 0.2s ease;
}

/* hotspot floating tooltip */
.oem-hotspot-tooltip {
  position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 10px;
  background: #0a0a0a; color: #fff; padding: 8px 12px; border-radius: var(--radius-1);
  box-shadow: 0 6px 24px rgba(0,0,0,0.3); pointer-events: none; z-index: 10;
  max-width: 320px;
}
.oem-hotspot-tooltip-num {
  width: 24px; height: 24px; border-radius: 50%; background: #ff6600; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 11px;
}
.oem-hotspot-tooltip-name { font-size: 12px; font-weight: 700; }
.oem-hotspot-tooltip-meta { font-size: 10px; color: rgba(255,255,255,0.65); display: flex; gap: 5px; align-items: center; margin-top: 2px; }
.oem-hotspot-tooltip-code { font-family: var(--font-mono); color: #ff9f66; }

.oem-canvas-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 14px; border-top: 1px solid var(--line-1); background: var(--surf-1);
  font-size: 10px; color: var(--text-3);
}
.oem-canvas-footer-hint { display: flex; align-items: center; gap: 5px; }
.oem-canvas-footer-src { font-family: var(--font-mono); }

/* ========== LIST (right) ========== */
.oem-list {
  border-left: 1px solid var(--line-1); background: var(--surf-0);
  display: flex; flex-direction: column; overflow: hidden;
}
.oem-list-head {
  padding: 10px 14px; border-bottom: 1px solid var(--line-1);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3);
}
.oem-list-head-count {
  background: var(--surf-2); padding: 2px 7px; border-radius: var(--radius-1);
  color: var(--text-1); font-family: var(--font-mono); letter-spacing: 0;
}
.oem-list-body { overflow-y: auto; flex: 1; }
.oem-list-empty {
  padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}

.oem-list-row {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line-1); cursor: pointer;
  align-items: start;
}
.oem-list-row:hover { background: var(--surf-1); }
.oem-list-row.is-hl { background: #fff6eb; border-left: 2px solid #ff6600; padding-left: 10px; }
html[data-theme="dark"] .oem-list-row.is-hl { background: rgba(255,102,0,0.08); }
.oem-list-row.is-incart { background: #f0f7ef; }
html[data-theme="dark"] .oem-list-row.is-incart { background: rgba(70,130,50,0.08); }
.oem-list-num {
  width: 24px; height: 24px; border-radius: 50%; background: #1a1a1a; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800;
  flex-shrink: 0;
}
.oem-list-num.is-hl { background: #ff6600; }
.oem-list-info { min-width: 0; }
.oem-list-name {
  font-size: 12px; font-weight: 600; color: var(--text-1); margin-bottom: 3px;
  line-height: 1.3;
}
.oem-list-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.oem-list-code { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); font-weight: 600; }
.oem-list-brand { font-size: 9px !important; padding: 1px 5px !important; }
.oem-list-stock-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 6px; border-radius: var(--radius-1);
}
.oem-list-stock-tag.is-ok { background: #e8f4e4; color: #3a7a20; }
.oem-list-stock-tag.is-low { background: #fff3dc; color: #a8620a; }
.oem-list-stock-tag.is-out { background: #fde9e9; color: #b83030; }
html[data-theme="dark"] .oem-list-stock-tag.is-ok { background: rgba(70,130,50,0.18); color: #8fcf6e; }
html[data-theme="dark"] .oem-list-stock-tag.is-low { background: rgba(180,110,20,0.18); color: #f0b060; }
html[data-theme="dark"] .oem-list-stock-tag.is-out { background: rgba(180,50,50,0.18); color: #f07878; }

.oem-list-tail { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.oem-list-price {
  font-family: var(--font-mono); font-size: 12px; font-weight: 800; color: var(--text-1);
  white-space: nowrap;
}
.oem-list-add {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 9px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border: 1px solid #1a1a1a; background: #1a1a1a; color: #fff;
  border-radius: var(--radius-1); cursor: pointer; white-space: nowrap;
}
.oem-list-add:hover { background: #ff6600; border-color: #ff6600; }
.oem-list-add.is-added { background: #3a7a20; border-color: #3a7a20; }

/* Stepper (po dodaniu do koszyka) — zielony, pokazuje ilość */
.oem-list-stepper {
  display: inline-flex; align-items: stretch;
  border: 1px solid #3a7a20; border-radius: var(--radius-1); overflow: hidden;
  background: #3a7a20;
  height: 22px;
}
.oem-list-stepper-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: #3a7a20; color: #fff;
  border: none; cursor: pointer; padding: 0;
  font-size: 14px; font-weight: 700; line-height: 1;
}
.oem-list-stepper-btn:hover { background: #2d5e18; }
.oem-list-stepper-qty {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; padding: 0 6px;
  background: #fff; color: #3a7a20;
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  border-left: 1px solid #3a7a20; border-right: 1px solid #3a7a20;
}

/* --- STICKY CART BAR --- */
.oem-cart-bar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: #0a0a0a; color: #fff; padding: 10px 16px; border-radius: var(--radius-1);
  box-shadow: 0 14px 40px rgba(0,0,0,0.45); z-index: 60;
  max-width: calc(100vw - 40px); flex-wrap: wrap;
}
.oem-cart-bar-info { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.oem-cart-bar-sep { opacity: 0.3; }
.oem-cart-bar-total { font-family: var(--font-mono); font-weight: 800; color: #ff9f66; }
.oem-cart-bar-preview { display: flex; gap: 4px; flex-wrap: wrap; max-width: 420px; }
.oem-cart-bar-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; padding: 3px 7px; background: rgba(255,255,255,0.1); border-radius: var(--radius-1); cursor: pointer;
}
.oem-cart-bar-chip:hover { background: rgba(255,102,0,0.25); }
.oem-cart-bar-actions { display: flex; gap: 6px; margin-left: auto; }

/* --- FLASH --- */

/* === RESPONSIVE === */
@media (max-width: 1280px) {
  .oem-body { grid-template-columns: 220px 1fr 300px; }
}
@media (max-width: 1100px) {
  .oem-body { grid-template-columns: 190px 1fr; grid-template-rows: 1fr auto; }
  .oem-list {
    grid-column: 1 / -1; border-left: none; border-top: 1px solid var(--line-1); max-height: 280px;
  }
}
@media (max-width: 720px) {
  .oem-body { grid-template-columns: 1fr; }
  .oem-sidebar { display: none; }
}
