/* =====================================================================
   LISTING DETAIL v2
   Calmer, denser detail page: breadcrumbs, plain title, a key-specs grid,
   a sticky contact column on desktop and a sticky price + contact bar on
   mobile. Scoped under .detail-v2 so it out-ranks the older inline <style>
   in listing_detail.html without !important.
   ===================================================================== */

/* ---- Breadcrumbs ---- */
.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  max-width: 1200px; margin: 0 auto 16px;
  font-size: 13px; color: var(--muted);
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent, #0ea5e9); text-decoration: underline; }
.breadcrumbs .bc-sep { opacity: .85; }
.breadcrumbs > :last-child { color: var(--text); font-weight: 600; }

/* ---- Cards / sections ---- */
.detail-v2 .info-section {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: none;
  animation: none;
  transition: none;
  margin-bottom: 16px;
}
.detail-v2 .info-section:hover { transform: none; box-shadow: none; }
.detail-v2 .info-section h2,
.detail-v2 .info-section h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.detail-v2 .info-section h2::before,
.detail-v2 .info-section h3::before { display: none; }

/* ---- Title ---- */
.detail-v2 .detail-title {
  margin: 0 0 6px; font-size: 30px; line-height: 1.15; font-weight: 800;
  letter-spacing: -.02em; color: var(--text);
}
.detail-v2 .detail-subtitle { color: var(--muted); font-size: 16px; }

/* ---- Key specs grid ---- */
.key-specs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  margin: 4px 0 22px;
  border-top: 1px solid var(--border); border-left: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.key-spec {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.key-spec .ks-label { font-size: 12px; color: var(--muted); }
.key-spec .ks-value { font-size: 15px; font-weight: 700; color: var(--text); }

/* ---- Price block ---- */
.detail-v2 .price-highlight {
  font-size: 36px; font-weight: 800; letter-spacing: -.02em;
  background: none; -webkit-text-fill-color: currentColor; color: var(--text);
}

/* ---- Sticky contact column (desktop) ---- */
.detail-v2 { align-items: start; }
.detail-v2 > div:nth-child(2) {
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ---- Mobile sticky price + contact bar ---- */
.mobile-contact-bar { display: none; }

@media (max-width: 900px) {
  .detail-v2 > div:nth-child(2) { position: static; max-height: none; overflow: visible; }

  /* The global quick-search bar would fill the whole first screen on phones */
  form.searchbar { display: none; }

  .detail-v2 .detail-title { font-size: 24px; }
  .key-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .mobile-contact-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--card-bg); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.18);
  }
  .mcb-price { font-size: 20px; font-weight: 800; color: var(--text); }
  .mcb-price span { font-size: 12px; font-weight: 600; color: var(--muted); }
  .mcb-btn {
    padding: 12px 18px; border-radius: 10px; white-space: nowrap;
    background: var(--accent-strong, #0369a1); color: #fff; font-weight: 700; text-decoration: none;
  }
  body { padding-bottom: 76px; }
  html { scroll-padding-bottom: 80px; }
}

/* ---- No photos: don't reserve a full 4:3 hero for an empty placeholder ---- */
.detail-v2 .gallery-main:not(:has(img)) { aspect-ratio: 16 / 6; }

/* ---- Galeria: licznik, przycisk powiększenia, fokus (v4.5) ---- */
.detail-v2 .gallery-counter {
    position: absolute; left: 12px; bottom: 12px; z-index: 3;
    padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
    background: rgba(0, 0, 0, .6); color: #fff; pointer-events: none;
}
.detail-v2 .gallery-expand {
    position: absolute; right: 12px; bottom: 12px; z-index: 3;
    width: 40px; height: 40px; border: 0; border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .6); color: #fff; transition: background-color .15s ease;
}
.detail-v2 .gallery-expand:hover { background: rgba(0, 0, 0, .8); }
.detail-v2 .gallery-main:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.detail-v2 .thumbs { scroll-behavior: smooth; }
@media (max-width: 640px) {
    .detail-v2 .gallery-expand { width: 44px; height: 44px; }
}

/* ---- Prawa kolumna: cena i sprzedawca (v4.5) ---- */
.detail-v2 .pc-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.detail-v2 .price-card .price-highlight {
  font-size: 38px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; color: var(--text);
  background: none; -webkit-text-fill-color: currentColor; margin-bottom: 10px;
}
.detail-v2 .pc-chip { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--hover); color: var(--muted); }
.detail-v2 .pb { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-v2 .pb-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.detail-v2 .pb-label { font-size: 14px; font-weight: 800; }
.detail-v2 .pb-diff { font-size: 12px; font-weight: 600; color: var(--muted); }
.detail-v2 .pb-bar { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #16a34a 0%, #65a30d 25%, #ca8a04 50%, #ea580c 75%, #dc2626 100%); }
.detail-v2 .pb-dot { position: absolute; top: 50%; width: 16px; height: 16px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; border: 3px solid; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.detail-v2 .pb-note { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--muted); }

.detail-v2 .sc-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; text-decoration: none; color: inherit; }
.detail-v2 .sc-avatar { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 12px; object-fit: cover; border: 1px solid var(--border); background: var(--hover); }
.detail-v2 .sc-avatar-initial { display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #fff; background: var(--accent-strong); border-color: var(--accent); }
.detail-v2 .sc-id { display: flex; flex-direction: column; min-width: 0; }
.detail-v2 .sc-name { font-size: 17px; font-weight: 800; color: var(--text); line-height: 1.25; overflow-wrap: anywhere; }
.detail-v2 .sc-head:hover .sc-name { color: var(--accent); }
.detail-v2 .sc-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.detail-v2 .sc-desc { margin: 0 0 12px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.detail-v2 .sc-links { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.detail-v2 .sc-links a { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }
.detail-v2 .sc-links a:hover { text-decoration: underline; }
.detail-v2 .sc-contact { display: flex; flex-direction: column; gap: 10px; }
.detail-v2 .sc-contact form { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.detail-v2 .sc-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 18px;
  border-radius: 10px; font-size: 15px; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer;
  border: 1px solid var(--border); background: var(--card-bg); color: var(--text); transition: background-color .15s ease, border-color .15s ease;
}
.detail-v2 .sc-btn:hover { transform: none; box-shadow: none; border-color: var(--accent); color: var(--accent); }
.detail-v2 .sc-btn-primary { background: var(--accent-strong); border-color: var(--accent); color: #fff; }
.detail-v2 .sc-btn-primary:hover { background: #075985; border-color: #0284c7; color: #fff; }
.detail-v2 .sc-email { font-size: 14px; font-weight: 600; color: var(--accent); text-align: center; word-break: break-all; text-decoration: none; }
.detail-v2 .sc-email:hover { text-decoration: underline; }
.detail-v2 .sc-robot { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500; }
.detail-v2 .sc-robot:hover { border-color: var(--accent); }
.detail-v2 .sc-robot input { width: 18px; height: 18px; accent-color: var(--accent); }
.detail-v2 .sc-own { padding: 12px; border-radius: 10px; background: var(--hover); color: var(--muted); font-weight: 500; text-align: center; }
.detail-v2 .sc-captcha { overflow-x: auto; }

/* ---- Poprawki: czcionka formularzy, przycisk profilu (v4.5b) ---- */
.detail-v2 button, .detail-v2 input, .detail-v2 select, .detail-v2 textarea { font-family: inherit; }
.detail-v2 .pc-chip { border: 1px solid var(--border); background: transparent; }
.detail-v2 .sc-links { margin: 12px 0 0; padding-bottom: 0; border-bottom: 0; }
.detail-v2 .sc-desc { margin-bottom: 16px; }
.detail-v2 .sc-btn-profile {
  min-height: 56px; margin-bottom: 0; font-size: 16px; gap: 10px;
  border: 1px solid var(--accent); background: rgba(14, 165, 233, .1); color: var(--accent);
}
.detail-v2 .sc-btn-profile span { flex: 1; text-align: left; }
.detail-v2 .sc-btn-profile:hover { background: var(--accent-strong); color: #fff; border-color: var(--accent); }
.detail-v2 .sc-btn-arrow { flex: 0 0 auto; }
.detail-v2 .sc-contact { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.detail-v2 .pc-chip { padding: 0; border: 0; background: none; font-size: 14px; font-weight: 600; color: var(--muted); }
.detail-v2 .pc-sale { margin-top: 2px; }
.detail-v2 .sc-links { margin: 0 0 12px; }
/* Wszystkie przyciski w karcie sprzedawcy mają ten sam rozmiar */
.detail-v2 .sc-btn,
.detail-v2 .sc-btn-profile { min-height: 52px; height: 52px; padding: 0 18px; font-size: 15px; font-weight: 700; line-height: 1; gap: 10px; border-radius: 10px; }
.detail-v2 .sc-btn svg { width: 18px; height: 18px; }
/* Jednakowy odstęp (10 px) między wszystkimi przyciskami w karcie sprzedawcy */
.detail-v2 .sc-contact { margin-top: 10px; padding-top: 0; border-top: 0; }
.detail-v2 .sc-btn-profile { margin-bottom: 0; }
/* Wyrównanie: niewidoczna reCAPTCHA nie tworzy własnego odstępu, a przyciski dziedziczą tło karty */
.detail-v2 .sc-captcha { display: contents; }
.detail-v2 .sc-btn { background: transparent; }
.detail-v2 .sc-btn-primary { background: var(--accent); }
.detail-v2 .sc-btn-primary:hover { background: #0284c7; }
.detail-v2 .sc-btn-profile { background: rgba(14, 165, 233, .1); }
.detail-v2 .sc-btn-profile:hover { background: var(--accent); }

/* ---- Klasy zastępujące dawne inline-style w listing_detail.html (UI_GUIDELINES §9 pkt 4) ---- */
.detail-v2 .dv-gap { margin-top: 24px; }
.detail-v2 .dv-mt8 { margin-top: 8px; }
.detail-v2 .dv-mt16 { margin-top: 16px; }
.detail-v2 .dv-mb20 { margin-bottom: 20px; }
.detail-v2 .dv-mb24 { margin-bottom: 24px; }
.detail-v2 .dv-ml8 { margin-left: 8px; }
.detail-v2 .dv-mr4 { margin-right: 4px; }
.detail-v2 .dv-center { text-align: center; }
.detail-v2 .dv-muted { color: var(--muted); }
.detail-v2 .dv-medium { font-weight: 500; }
.detail-v2 .dv-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 500; }
.detail-v2 .dv-inline-flex { display: inline-flex; }
.detail-v2 .dv-line { margin-bottom: 8px; font-weight: 500; }

.detail-v2 .dv-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.detail-v2 .dv-head-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.detail-v2 .dv-cert {
  display: inline-block; padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; background: var(--accent-strong); color: #fff;
}
.detail-v2 .dv-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 18px; border-radius: 8px;
  background: var(--accent-strong); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none;
  transition: background-color .15s ease;
}
.detail-v2 .dv-btn:hover { background: #0284c7; }
.detail-v2 .dv-btn--boost { background: #b45309; }
.detail-v2 .dv-btn--boost:hover { background: #92400e; }

.detail-v2 .dv-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.detail-v2 .dv-tags--tight { gap: 8px; }
.detail-v2 .dv-tags--wide { gap: 12px; }
.detail-v2 .dv-tag-info { background: rgba(14, 165, 233, .14); border-color: rgba(14, 165, 233, .4); color: var(--accent); }

.detail-v2 .dv-box { margin-bottom: 20px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card-bg); }
.detail-v2 .dv-box-title { margin-bottom: 12px; font-size: 15px; font-weight: 700; color: var(--text); }
.detail-v2 .dv-kv { display: grid; grid-template-columns: 200px minmax(0, 1fr); row-gap: 8px; font-size: 14px; color: var(--text); }
.detail-v2 .dv-k { color: var(--muted); font-weight: 500; }

.detail-v2 .dv-locked { padding: 24px; text-align: center; border-radius: 8px; border: 1px dashed var(--border); background: rgba(14, 165, 233, .05); }
.detail-v2 .dv-lock-icon { display: block; margin: 0 auto 12px; color: var(--muted); }
.detail-v2 .dv-locked-title { margin: 0 0 8px; font-weight: 600; color: var(--text); }
.detail-v2 .dv-locked-text { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.detail-v2 .dv-cta {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 24px; border-radius: 10px;
  background: var(--accent-strong); color: #fff; font-weight: 600; text-decoration: none; transition: background-color .15s ease;
}
.detail-v2 .dv-cta:hover { background: #0284c7; }

.detail-v2 .dv-nophoto {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  background: var(--hover); color: var(--muted); border: 1px dashed var(--border); border-radius: 12px;
}
.detail-v2 .dv-map { width: 100%; height: 220px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.detail-v2 .dv-route { display: block; width: 100%; padding: 12px; border-radius: 12px; text-align: center; }

.detail-v2 .dv-stats { display: flex; gap: 8px; }
.detail-v2 .dv-stat { flex: 1; padding: 12px 8px; text-align: center; background: var(--hover); border: 1px solid var(--border); border-radius: 8px; }
.detail-v2 .dv-stat-value { font-size: 20px; font-weight: 800; color: var(--accent); }
.detail-v2 .dv-stat-value--fav { color: #e11d48; }
.detail-v2 .dv-stat-value--inq { color: #06b6d4; }
.detail-v2 .dv-stat-label { margin-top: 2px; font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .detail-v2 .dv-head-actions { align-items: flex-start; }
  .detail-v2 .dv-kv { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .detail-v2 .dv-k { margin-top: 8px; }
}
