/* Build page (konfiguracija.html): the head and the workbench row of parts on
   one tinted band, the slot list, and the side column with the total, the
   compatibility checks, where to buy and the shops that have every part. Loaded after
   css/style.css and css/parts.css; everything is under .page-build. */

/* ---------- head and workbench ---------- */
/* The breadcrumbs, the head and the row of parts are one band: the row is a
   child of the head (see buildpage.js), so the band style.css paints behind the
   head carries on behind it. The head gives up its bottom padding to the row,
   and the row sits under the title's row (the head's 12px gap is part of its top). */
.page-build .page-head:has(.bench) { padding-bottom: 0; }
.page-build .bench { flex: 1 0 100%; min-width: 0; padding: 14px 0 34px; }
.bench-count { display: grid; justify-items: end; gap: 2px; }
.bench-count b { font: 750 34px/1 var(--font-display); letter-spacing: -.02em; }
.bench-count span { font-size: 13px; color: var(--ink-2); }
.page-build .page-head .btn-lg { flex: none; }

.rig { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.rig-slot { min-width: 0; }
.rig-cell {
  display: grid; justify-items: center; align-content: start; gap: 3px; height: 100%; padding: 12px 6px 10px;
  border: 1.5px solid transparent; border-radius: var(--r-l); background: var(--surface);
  color: var(--ink); text-align: center; text-decoration: none; transition: border-color .15s;
}
a.rig-cell:hover { border-color: var(--accent); color: var(--ink); }
.rig-pic { position: relative; display: grid; place-items: center; width: 100%; height: 68px; margin-bottom: 4px; }
.rig-pic .art svg { width: 64px; height: 64px; }
.rig-n { position: absolute; right: 2px; top: 0; font: 700 12px/1 var(--font-body); color: var(--ink-2); }
.rig-name { max-width: 100%; font-size: 12.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.rig-price { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.rig-note { font-size: 12.5px; line-height: 1.25; color: var(--ink-3); }
/* an empty slot is a dashed outline with its drawing faded */
.rig-slot.vacant .rig-cell { border: 1.5px dashed var(--line-2); background: transparent; }
.rig-slot.vacant .art { opacity: .35; filter: grayscale(1); }
.rig-slot.vacant a.rig-cell:hover { border-style: solid; border-color: var(--accent); }
.rig-slot.vacant a.rig-cell .rig-note { color: var(--accent); font-weight: 600; }
.rig-slot.just-added .rig-cell { border-color: var(--accent); border-width: 2px; padding: 11.5px 5.5px 9.5px; }

/* ---------- layout ---------- */
.build { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.build > * { min-width: 0; }
.build-main { display: grid; gap: 16px; }
.build-main .note { font-size: 13px; color: var(--ink-3); }
.side { position: sticky; top: 88px; display: grid; gap: 16px; }

/* ---------- shared link ---------- */
.shared {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px;
  padding: 16px 18px; margin-bottom: 24px; border-radius: var(--r-l); background: var(--accent-soft);
}
.shared-text { flex: 1 1 320px; min-width: 0; font-size: 14px; color: var(--ink-2); }
.shared-text b { display: block; margin-bottom: 2px; font-size: 15px; font-weight: 650; color: var(--ink); }
.shared-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.shared .btn:not(.btn-primary) { background: var(--surface); }

/* ---------- slots ---------- */
.slots { overflow: hidden; }
.slot-group { padding: 14px 20px 8px; border-top: 1px solid var(--line); background: var(--surface-2); }
.slot-group h3 { font: 600 13px/1.3 var(--font-body); letter-spacing: 0; color: var(--ink-2); }
.slot {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; gap: 4px 16px; align-items: center;
  padding: 16px 20px; border-top: 1px solid var(--line); scroll-margin-block: 96px 88px;
}
.slots > li:first-child { border-top: 0; }
.slot .thumb { width: 48px; height: 48px; }
.slot-main { min-width: 0; }
.slot-label { font: 500 13px/1.3 var(--font-body); color: var(--ink-3); }
.slot-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px;
  font-weight: 600; font-size: 15px; line-height: 1.35; color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
}
a.slot-name:hover { color: var(--accent); }
.slot-specs { margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.slot-main .bstatus { margin-top: 4px; font-size: 13px; font-weight: 550; }
.slot-main .pay-cond { max-width: 52ch; }
.slot-main .pay-cond .pc-long { -webkit-line-clamp: 1; }
.slot-empty { margin-top: 3px; font-size: 14px; color: var(--ink-3); }
.slot.vacant .thumb { background: transparent; border: 1.5px dashed var(--line-2); }
.slot.vacant .thumb > .art { opacity: .4; filter: grayscale(1); }
.slot-price { display: grid; justify-items: end; gap: 2px; text-align: right; white-space: nowrap; }
.slot-price .price-tag { font-size: 20px; }
.slot-price small { font-size: 12.5px; color: var(--ink-3); }
.slot-price .shop-at { gap: 6px; }
.slot-price .list-was { margin-top: 0; }
/* the link to the offer in the shop (offerLink in ui.js, size "text") */
.offer-link {
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px; font: 600 13px/1 var(--font-body);
  color: var(--accent); text-decoration: none; white-space: nowrap;
}
.offer-link:hover { color: var(--accent-2); text-decoration: underline; }
.slot-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.slot.vacant .slot-actions .btn { min-width: 104px; }
/* the box clips its children, so the focus ring is drawn inside them */
.qty button:focus-visible { outline-offset: -2px; }
.qty button[aria-disabled="true"] { color: var(--line-2); cursor: default; }
.qty button[aria-disabled="true"]:hover { background: var(--surface); color: var(--line-2); }
.slot-more { padding: 6px 20px 12px 84px; }
.slot-more .btn { padding-left: 8px; color: var(--accent); }

/* The one animation: a cobalt wash on the slot just filled, fading over about
   three seconds. With reduced motion it stays as a plain tint. */
@keyframes just-added { from { background-color: var(--accent-soft); } to { background-color: transparent; } }
.slot.just-added { animation: just-added 3.2s ease-out 1.2s both; }
.slot.just-added .slot-label::after { content: " · upravo dodano"; color: var(--accent); font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .slot.just-added { background-color: var(--accent-soft); }
}

/* ---------- total ---------- */
.total { padding: 26px; }
.total-label { font: 500 13px/1.3 var(--font-body); color: var(--ink-3); }
.total-price { margin-top: 10px; font: 750 52px/1 var(--font-display); letter-spacing: -.035em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-sub { margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.total-sub + .total-sub { margin-top: 4px; }
.cost { margin-top: 20px; }
.cost-bar { display: flex; height: 12px; gap: 2px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.cost-bar i { display: block; min-width: 3px; }
.cost-key { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.cost-key li { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cost-key i { flex: none; width: 9px; height: 9px; border-radius: 2px; }
.cost-key b { margin-left: auto; padding-left: 4px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.tone-0 { background: var(--ill-dark); }
.tone-1 { background: var(--accent); }
.tone-2 { background: var(--ill-mid); }
.tone-3 { background: var(--ill-light); }
.total-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.total-actions .btn { flex: 1 1 140px; }

/* ---------- side panels ---------- */
.panel { padding: 20px 22px; }
.panel h2 { font-size: 18px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.panel-text, .panel-empty { margin: 4px 0 8px; font-size: 13.5px; color: var(--ink-2); }
.panel-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.checks-sum { font-size: 13px; font-weight: 600; white-space: nowrap; }
.checks-sum.ok { color: var(--good); }
.checks-sum.bad { color: var(--bad); }
.checks-sum.unknown { color: var(--warn); }

.check { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; }
.check-dot { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--good); }
.check.bad .check-dot { background: var(--bad); }
.check.unknown .check-dot { background: var(--warn); }
.check b { display: block; font-size: 14px; font-weight: 600; }
.check-text { display: block; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
/* a failed check is the one thing to look at */
.check.bad { margin: 0 -10px; padding: 11px 10px; border-top-color: transparent; border-radius: var(--r-m); background: var(--bad-soft); }
.check.bad + .check { border-top-color: transparent; }

.shop-sum > li { padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; }
.shop-sum > li:first-child { border-top: 0; }
.ss-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ss-name { display: inline-flex; align-items: center; gap: 9px; min-width: 0; font-weight: 550; }
.ss-row .t { font-weight: 700; }
.shop-sum .best .t { font: 700 17px/1 var(--font-display); color: var(--good); }
.ss-bar { height: 6px; margin-top: 7px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ss-bar i { display: block; height: 100%; min-width: 2px; border-radius: 3px; background: var(--ill-mid); }
.shop-sum .best .ss-bar i { background: var(--good); }
.shop-sum summary small { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }

/* a shop opens to its parts: the row, the bar and the note are the summary */
.ss-more summary { position: relative; display: block; padding-right: 26px; border-radius: var(--r-s); cursor: pointer; list-style: none; }
.ss-more summary::-webkit-details-marker { display: none; }
.ss-more summary::after {
  content: ""; position: absolute; right: 6px; top: 5px; width: 8px; height: 8px;
  border: solid var(--ink-2); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s, top .15s;
}
.ss-more[open] summary::after { top: 10px; transform: rotate(-135deg); }
.ss-more summary:hover .ss-name { color: var(--accent); }
.ss-more summary:hover::after { border-color: var(--accent); }
.ss-more .buy-lines { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--line); }

/* where to buy: shops, each with its parts as lines */
.buy-shop { padding: 14px 0; border-top: 1px solid var(--line); }
.buy-shop:first-child { padding-top: 8px; border-top: 0; }
.buy-shop:last-child { padding-bottom: 0; }
.buy-shop h3 { font: 550 14px/1.3 var(--font-body); letter-spacing: 0; }
.buy-lines { display: grid; gap: 10px; margin-top: 10px; }
.buy-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; }
.buy-line .offer-link { min-height: 22px; }
.bl-what { display: grid; gap: 1px; min-width: 0; }
.bl-slot { font-size: 13px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.bl-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 12.5px; line-height: 1.4; color: var(--ink-3); overflow-wrap: anywhere;
}
/* the price and the link on one row, the list price under them */
.bl-buy { display: grid; grid-template-columns: auto auto; justify-content: end; align-items: center; column-gap: 12px; white-space: nowrap; }
.bl-buy b { font-size: 14px; font-weight: 700; }
.bl-buy .list-was { grid-column: 1 / -1; justify-self: end; margin-top: 0; }
.buy-line.missing .bl-slot { color: var(--ink-3); font-weight: 500; }

/* ---------- breakpoints ---------- */
@media (max-width: 1020px) {
  .build { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .rig { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .page-build .bench { padding: 8px 0 26px; }
  .bench-count { justify-items: start; }
  .rig { gap: 6px; }
  .rig-cell { padding: 8px 2px; }
  .rig-pic { height: 52px; }
  .rig-pic .art svg { width: 50px; height: 50px; }
  .rig-name, .rig-price, .rig-note { font-size: 11.5px; }
  .rig-slot.just-added .rig-cell { padding: 7.5px 1.5px; }
  /* name and specs get the full width; the price and the buttons sit under them */
  .slot { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "ico main main" "ico price acts"; gap: 8px 12px; padding: 14px 16px; }
  .slot .thumb { grid-area: ico; width: 40px; height: 40px; align-self: start; }
  .slot-main { grid-area: main; }
  .slot-name { -webkit-line-clamp: 3; }
  .slot-price { grid-area: price; justify-items: start; text-align: left; }
  .slot-price .price-tag { font-size: 20px; }
  .slot-actions { grid-area: acts; align-self: start; }
  .slot.vacant .slot-actions .btn { min-width: 0; }
  .slot-more { padding: 4px 16px 12px 68px; }
  .slot-group { padding-inline: 16px; }
  .total { padding: 22px 20px; }
  .total-price { font-size: 44px; }
  .panel { padding: 18px 20px; }
  .icon-btn { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .rig-cell, .ss-more summary::after { transition: none; }
}

/* ---------- share panel (sharepanel.js) ---------- */
/* Rows divided by hairlines, each one button: a bare icon, the title and one
   line under it. The row's hover wash reaches into the panel's padding so the
   text stays aligned with the heading. */
.share-list { margin: 6px -10px 0; }
.share-list > li + li { border-top: 1px solid var(--line); }
.share-btn {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; width: 100%;
  padding: 11px 10px; border: 0; border-radius: var(--r-m); background: transparent; text-align: left; cursor: pointer;
  transition: background-color .15s;
}
.share-btn .ico { margin-top: 1px; color: var(--ink-2); }
.share-what { display: grid; gap: 1px; min-width: 0; }
.share-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.share-text { font-size: 13px; line-height: 1.4; color: var(--ink-2); overflow-wrap: anywhere; }
.share-btn:hover { background: var(--surface-2); }
.share-btn:hover .share-title, .share-btn:hover .ico { color: var(--accent); }
.share-btn:focus-visible { outline-offset: -2px; }
.share-btn[aria-busy="true"] { cursor: progress; }
.share-btn[aria-busy="true"] .share-title { color: var(--ink-2); }
.share-manual { margin-top: 10px; }
.share-manual .share-field { width: 100%; margin: 0; }
.share-manual textarea { font-size: 13px; resize: vertical; }
@media (prefers-reduced-motion: reduce) {
  .share-btn { transition: none; }
}

/* ---------- saving (buildpage.js) ---------- */
/* "Spremi" opens the name field in place of the button: the label above, the
   field and its two buttons on one row, which wraps on a phone. The line
   after a save is plain small text, in --bad when it failed. */
.save-form { margin-top: 16px; }
.save-form label { display: block; margin-bottom: 6px; font-weight: 600; }
.save-row { display: flex; flex-wrap: wrap; gap: 8px; }
.save-row input { flex: 1 1 100%; min-width: 0; }
.save-row .btn { flex: 1 1 auto; }
.save-line { margin-top: 12px; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.save-line.save-error { color: var(--bad); }
.shared .save-line { margin-top: 6px; }
