/* assets/frontend.css */

/* --- bazowe --- */
.jd-front-wrap {
  position: relative;
}

.jd-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.04);
}

.jd-front-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1100px;
  background: #fff;
}

/* ✅ KLUCZ: stała wysokość wiersza (wyrówna linie) */
.jd-front-table tbody tr {
  height: 56px;
}

/* ✅ KLUCZ: upewnij się, że border rysuje się równo */
.jd-front-table th,
.jd-front-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
  white-space: nowrap;
  background-clip: padding-box;
}

.jd-front-table tbody tr:hover td {
  background: #fcfcfc;
}

.jd-front-table thead th {
  position: sticky;
  top: 0;
  background: #fafafa;
  z-index: 1;
  border-bottom: 1px solid #e9e9e9;
}

.jd-front-table thead th:first-child {
  border-top-left-radius: 12px;
}
.jd-front-table thead th:last-child {
  border-top-right-radius: 12px;
}

.jd-front-table th.jd-sort {
  cursor: pointer;
  user-select: none;
}

.jd-front-table th.jd-sort::after {
  content: " ⇅";
  opacity: 0.35;
  font-size: 12px;
}

.jd-front-table th.jd-no-sort {
  cursor: default;
}

/* --- STATUS: wyrównanie + kolor zależny od statusu --- */
.jd-front-table td.jd-status {
  font-weight: 700;
  line-height: 1.2;

  /* ✅ wyrównanie w pionie jak w ikonach */
  height: 56px;
}

/* tylko kolor tekstu (prosto i czytelnie) */
.jd-st-available td.jd-status {
  color: #1f7a1f;
}
.jd-st-reserved td.jd-status {
  color: #b26a00;
}
.jd-st-sold td.jd-status {
  color: #b00020;
  opacity: 0.9;
}
.jd-st-soon td.jd-status {
  color: #005bbb;
}
.jd-st-other td.jd-status {
  color: #444;
}

/* opcjonalnie: lekko przygaś cały wiersz dla Sprzedane */
.jd-st-sold td {
  opacity: 0.88;
}

/* --- CECHY: wyrównanie bez psucia tabeli --- */
.jd-front-table td.jd-features {
  /* zostaje flex tylko dla tej komórki */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;

  /* ✅ zamiast min-height — dopasuj do wiersza */
  height: 56px;
}

.jd-feature-empty {
  opacity: 0.5;
  display: inline-flex;
  align-items: center;
  height: 34px;
  line-height: 34px;
}

/* ikonki */
.jd-feature-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #e2e2e2;
  background: #fff;
  cursor: pointer;
  padding: 0;
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.jd-feature-btn svg {
  width: 18px;
  height: 18px;
}

.jd-feature-btn svg * {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jd-feature-btn:hover {
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* --- Cena brutto: cena + zegar w jednej linii --- */
.jd-front-table td.jd-price-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  min-width: 180px;

  /* ✅ wyrównanie do wysokości wiersza */
  height: 56px;
}

.jd-front-table td.jd-price-cell .jd-price-text {
  display: inline-block;
}

/* zegar */
.jd-price-history-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid #e2e2e2;
  background: #fff;
  cursor: pointer;
  padding: 0;
  vertical-align: middle;
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.jd-price-history-btn svg {
  width: 16px;
  height: 16px;
}

.jd-price-history-btn svg * {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.jd-price-history-btn:hover {
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* --- Popover --- */
.jd-feature-popover {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.jd-feature-popover.is-open {
  display: flex;
}

.jd-feature-popover-inner {
  width: min(760px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.28);
  position: relative;
  padding: 18px 18px 14px;
}

.jd-feature-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #e2e2e2;
  background: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: box-shadow 0.15s ease;
}

.jd-feature-close:hover {
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.08);
}

.jd-feature-content h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

.jd-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.jd-feature-item {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fafafa;
}

.jd-feature-item .k {
  display: block;
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.jd-feature-item .v {
  font-weight: 600;
}

/* tabela historii w popupie */
.jd-price-history-table th,
.jd-price-history-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #eee;
  text-align: left;
  white-space: nowrap;
}

/* --- FIX: równe bordery w tabeli --- */

/* usuń stałe wysokości (one + padding powodują dziwne wyliczenia) */
.jd-front-table tbody tr {
  height: auto;
}

/* NIE rób flexa na TD */
.jd-front-table td.jd-features,
.jd-front-table td.jd-price-cell {
  display: table-cell;
  height: auto;
}

/* zamiast gap z flexa: odstępy przez marginesy */
.jd-front-table td.jd-features .jd-feature-btn {
  margin-right: 8px;
}
.jd-front-table td.jd-features .jd-feature-btn:last-child {
  margin-right: 0;
}

.jd-front-table td.jd-price-cell .jd-price-text {
  margin-right: 10px;
}

/* nie przygaszaj borderów w "Sprzedane" */
.jd-st-sold td {
  opacity: 1;
} /* border zostaje równy */
.jd-st-sold td > * {
  opacity: 0.88;
} /* przygaś tylko zawartość */

/* === Cechy lokalu: ciemne boxy === */
.jd-feature-btn {
  background: #1e1e1e;
  border-color: #2a2a2a;
  color: #fff;
}

.jd-feature-btn svg * {
  stroke: #fff;
}

.jd-feature-btn:hover {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

/* niedostępne / sprzedane */
.jd-feature-btn.jd-feature-disabled {
  background: #f2f2f2;
  border-color: #ddd;
  color: #888;
  cursor: not-allowed;
}

.jd-feature-btn.jd-feature-disabled svg * {
  stroke: #888;
}

.jd-feature-btn.jd-feature-disabled:hover {
  box-shadow: none;
  transform: none;
}

/* === Status w popupie (kolory) === */
.jd-feature-item .v.jd-status-available {
  color: #1f7a1f;
}

.jd-feature-item .v.jd-status-reserved {
  color: #b26a00;
}

.jd-feature-item .v.jd-status-sold {
  color: #b00020;
}

.jd-feature-item .v.jd-status-unavailable {
  color: #666;
}

/* Plan / rzut jako box-link */
a.jd-feature-btn.jd-doc-btn {
  text-decoration: none;
}

/* Czytelny link do rzutu, spójny z pozostałymi przyciskami. */
.jd-front-table a.jd-floorplan-btn {
  box-sizing: border-box;
  width: auto;
  height: 34px;
  padding: 0 10px;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  vertical-align: middle;
}

.jd-front-table a.jd-floorplan-btn svg {
  flex: 0 0 18px;
}

.jd-front-table a.jd-floorplan-btn:focus-visible {
  outline: 2px solid #005bbb;
  outline-offset: 3px;
}

/* Mobile: mniejszy tekst i zwarte komórki bez wymuszania szerokości. */
@media (max-width: 767px) {
  .jd-feature-grid {
    grid-template-columns: 1fr;
  }

  .jd-front-wrap .jd-front-table {
    min-width: 0;
  }

  .jd-front-wrap .jd-front-table,
  .jd-front-wrap .jd-front-table th,
  .jd-front-wrap .jd-front-table td,
  .jd-front-wrap .jd-front-table td *,
  .jd-front-wrap .jd-front-table th * {
    font-size: 14px;
  }

  .jd-front-wrap .jd-front-table th,
  .jd-front-wrap .jd-front-table td {
    padding: 8px;
    line-height: 1.3;
  }

  .jd-front-table td.jd-status {
    height: auto;
  }

  .jd-front-table td.jd-price-cell {
    min-width: 0;
  }

  .jd-front-table .jd-cell-flex,
  .jd-front-table .jd-features-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .jd-front-table td.jd-features .jd-feature-btn,
  .jd-front-table td.jd-price-cell .jd-price-text {
    margin-right: 0;
  }

  .jd-front-table .jd-feature-btn {
    flex-shrink: 0;
  }

  .jd-front-table a.jd-floorplan-btn {
    padding: 0 8px;
    gap: 5px;
  }
}
