/* ==========================================================================
   Pricelist Table — Stylesheet
   Uses CSS custom properties injected inline by the shortcode:
     --rp-header-color   header background & horizontal row border
     --rp-button-color   button background / outline colour
   ========================================================================== */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.rp-pricelist-wrapper {
  --rp-header-color: #1a1a2e;
  --rp-button-color: #1a1a2e;

  font-family: "Host Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #1e1e1e;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.rp-filters {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 30px;
  align-items: flex-end;
  margin-bottom: 24px;
}

.rp-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rp-filter-label {
  font-family: "Host Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #1e1e1e;
}

.rp-filter-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23555' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 11px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 8px 32px 8px 12px;
  font-family: "Host Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #1e1e1e;
  cursor: pointer;
  min-width: 160px;
  max-width: 100%;
  box-sizing: border-box;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.rp-filter-select:focus {
  outline: none;
  border-color: var(--rp-header-color);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

/* ── Table container ─────────────────────────────────────────────────────── */
.rp-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 600px;
  overflow-y: scroll;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.rp-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Host Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #1e1e1e;
  background: #fff;
}

.rp-table .rp-th {
  padding: 14px 3px;
  text-align: left;
  font-family: "Host Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #fff;
  white-space: nowrap;
  border: none;
  border-top: 0;
}

.rp-table .rp-td {
  padding: 14px 3px;
  border-top: 0;
}

/* Body rows — force transparent background to override any theme striping */
.rp-table .rp-row,
.rp-table .rp-row:nth-child(odd),
.rp-table .rp-row:nth-child(even),
.rp-table .rp-row:hover,
.rp-table .rp-row:nth-child(odd):hover,
.rp-table .rp-row:nth-child(even):hover {
  background-color: transparent !important;
  border-bottom: 1px solid var(--rp-header-color);
}

.rp-table .rp-row:last-of-type {
  border-bottom: none;
}

.rp-table .rp-td,
.rp-table .rp-row:nth-child(odd) > .rp-td,
.rp-table .rp-row:nth-child(even) > .rp-td {
  color: #1e1e1e;
  vertical-align: middle;
  white-space: nowrap;
  border-left: none;
  border-right: none;
  background-color: transparent !important;
}

/* Numeric/area columns — align right */
.rp-table .rp-col-area,
.rp-table .rp-col-gross_area,
.rp-table .rp-col-external_area,
.rp-table .rp-col-living_area,
.rp-table .rp-col-balcony,
.rp-table .rp-col-terrace,
.rp-table .rp-col-loggia,
.rp-table .rp-col-garden,
.rp-table .rp-col-asking_price {
  text-align: right;
}
.rp-table thead .rp-col-area,
.rp-table thead .rp-col-gross_area,
.rp-table thead .rp-col-external_area,
.rp-table thead .rp-col-living_area,
.rp-table thead .rp-col-balcony,
.rp-table thead .rp-col-terrace,
.rp-table thead .rp-col-loggia,
.rp-table thead .rp-col-garden,
.rp-table thead .rp-col-asking_price {
  text-align: right;
}

/* Center action columns */
.rp-table .rp-col-main_pdf,
.rp-table .rp-col-hs_pipeline_stage,
.rp-table .rp-col-contactar {
  text-align: center;
}
.rp-table thead .rp-col-main_pdf,
.rp-table thead .rp-col-hs_pipeline_stage,
.rp-table thead .rp-col-contactar {
  text-align: center;
}

.rp-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ── Sortable column headers ─────────────────────────────────────────────── */
.rp-table .rp-col--sortable {
  cursor: pointer;
  user-select: none;
}

.rp-table .rp-col--sortable::after {
  content: "↕";
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.15s;
}

.rp-table .rp-col--sortable:hover::after,
.rp-table .rp-col--sortable:focus::after {
  color: #fff;
}

.rp-table .rp-col--sortable.is-sort-asc::after {
  content: "↑";
  color: #fff;
}

.rp-table .rp-col--sortable.is-sort-desc::after {
  content: "↓";
  color: #fff;
}

/* ── Status pills ────────────────────────────────────────────────────────── */
.rp-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-family: "Host Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
}

.rp-status--available {
  background-color: #DFEDE1;
  color: #6F8572;
}

.rp-status--prereserved {
  background-color: #FAECB6;
  color: #BC7D35;
}

.rp-status--reserved {
  background-color: #FAECB6;
  color: #BC7D35;
}

.rp-status--sold {
  background-color: #F5C8C3;
  color: #9E504D;
}

.rp-status--unavailable {
  background-color: #f3f4f6;
  color: #6b7280;
}

.rp-status--delayed {
  background-color: #ede9fe;
  color: #5b21b6;
}

/* ── Buttons — shared ────────────────────────────────────────────────────── */
.rp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 4px;
  font-family: "Host Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  line-height: 1;
  transition:
    opacity 0.15s,
    background-color 0.15s,
    color 0.15s;
  white-space: nowrap;
}

.rp-btn:active {
  opacity: 0.85;
}

.rp-btn svg {
  flex-shrink: 0;
}

/* Planta — icon-only link */
.rp-btn--planta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background-color: transparent;
  border: none;
  color: inherit;
  vertical-align: middle;
}

.rp-btn--planta:hover,
.rp-btn--planta:focus {
  opacity: 0.75;
  text-decoration: none;
}

/* Contactar — icon-only button */
.rp-btn--contactar {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 3.5px 6px !important;
  background-color: var(--rp-button-color) !important;
  border: none !important;
  border-radius: 4px !important;
  color: #fff !important;
}

.rp-btn--contactar:hover,
.rp-btn--contactar:focus {
  opacity: 0.85;
  text-decoration: none;
}

/* ── Error / empty states ────────────────────────────────────────────────── */
.rp-error {
  padding: 12px 16px;
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
  border-radius: 4px;
  font-size: 16px;
}

.rp-empty {
  padding: 12px 16px;
  background: #f3f4f6;
  color: #6b7280;
  border-radius: 4px;
  font-size: 16px;
}

/* ── Mobile load-more ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .rp-row.rp-row--hidden {
    display: none !important;
  }

  .rp-load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
  }
}

@media (min-width: 769px) {
  .rp-load-more-wrap {
    display: none;
  }
}

/* ── Responsive table (< 1050px) ─────────────────────────────────────────── */

/* Default: detail rows are hidden on desktop */
.rp-row-details {
  display: none;
}

@media (max-width: 1050px) {
  /* Hide desktop-only columns */
  .rp-table .rp-col--desktop {
    display: none;
  }
	
  .rp-table {
  	font-size: 10px;
	}

	.rp-status {
	  font-size: 12px;
	}

  /* First mobile column holds the toggle button inside its padding */
  .rp-table .rp-col--has-toggle {
    position: relative;
  }

  /* Toggle button */
  .rp-toggle-btn {
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    color: var(--rp-button-color) !important;
    font-family: "Host Grotesk", sans-serif !important;
    font-size: 26px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: opacity 0.15s !important;
    padding-left: 10px !important;
  }

  .rp-toggle-btn:hover,
  .rp-toggle-btn:focus {
    opacity: 0.7;
    outline: none;
  }

  /* Detail row — hidden by default, shown as a normal table row when open */
  .rp-row-details {
    display: none;
  }

  .rp-row.is-open + .rp-row-details {
    display: table-row;
  }

  /* Remove border between the main row and its details */
  .rp-table .rp-row.is-open {
    border-bottom: none;
  }

  .rp-row.is-open + .rp-row-details > .rp-td {
    border-bottom: 1px solid var(--rp-header-color);
  }

  /* Inner details — full-width flex wrap, responsive item count */
  .rp-details-list {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin: 0;
    padding: 16px 0;
    list-style: none;
    border-bottom: 1px solid var(--rp-header-color);
  }

  .rp-detail-item {
    flex: 1 1 220px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    box-sizing: border-box;
    min-width: 0;
  }

  .rp-detail-label {
    font-family: "Host Grotesk", sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .rp-detail-value {
    font-family: "Host Grotesk", sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #1e1e1e;
    text-align: right;
    white-space: nowrap;
  }

  .rp-detail-value .rp-btn--planta {
    justify-content: flex-end;
  }

  /* Last group should not have a trailing border after details */
  .rp-row:last-of-type + .rp-row-details .rp-details-list {
    border-bottom: none;
  }

  /* Prevent horizontal scroll on the wrapper in mobile mode */
  .rp-table-container {
    overflow-x: visible;
  }
}

@media (max-width: 640px) {
  .rp-detail-item {
    flex: 1 1 100%;
  }
}

@media (min-width: 1051px) {
  .rp-toggle-btn {
    display: none !important;
  }

  .rp-row-details {
    display: none !important;
  }
}
