/**
 * RS Real Estate – style frontendu (siatka ofert + mapa)
 * Paleta kolorów: ciemny granat + złoto (spójne z istniejącym pluginem Previo)
 *   --rs-dark:   #0d2038  (tło kart, navbar)
 *   --rs-accent: #d49f58  (złoto, akcenty)
 *   --rs-light:  #f5f7fa  (jasne tło)
 *   --rs-border: rgba(185,193,204,.18)
 */

/* ══════════════════════════════════════════════════════════════
   ZMIENNE CSS
══════════════════════════════════════════════════════════════ */
:root {
    --rs-dark:       #0d2038;
    --rs-dark2:      #122640;
    --rs-accent:     #d49f58;
    --rs-accent-h:   #c08a42;
    --rs-light:      #f5f7fa;
    --rs-text:       #1d2327;
    --rs-text-muted: #6b7280;
    --rs-border:     rgba(185, 193, 204, .2);
    --rs-radius:     12px;
    --rs-shadow:     0 4px 20px rgba(0, 0, 0, .08);
    --rs-shadow-h:   0 8px 32px rgba(0, 0, 0, .14);
}

/* ══════════════════════════════════════════════════════════════
   WRAPPER
══════════════════════════════════════════════════════════════ */
.rs-grid-wrapper {
    width: 100%;
    font-family: inherit;
    color: var(--rs-text);
}

/* ══════════════════════════════════════════════════════════════
   PASEK FILTRÓW
══════════════════════════════════════════════════════════════ */
.rs-filters-bar {
    background: #fff;
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--rs-shadow);
}

.rs-filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.rs-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 160px;
}

.rs-filter-group--price  { min-width: 200px; }
.rs-filter-group--actions { flex: 0 0 auto; min-width: auto; }

.rs-filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--rs-text-muted);
}

.rs-filter-select,
.rs-filter-input {
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d0d5db;
    border-radius: 8px;
    font-size: 14px;
    color: var(--rs-text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.rs-filter-select {
    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 d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.rs-filter-select:focus,
.rs-filter-input:focus {
    outline: none;
    border-color: var(--rs-accent);
    box-shadow: 0 0 0 3px rgba(212, 159, 88, .2);
}

.rs-filter-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rs-filter-range .rs-filter-input {
    flex: 1;
    min-width: 0;
}

.rs-filter-sep {
    color: var(--rs-text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

.rs-filter-btns {
    display: flex;
    gap: 8px;
}

/* ══════════════════════════════════════════════════════════════
   PRZYCISKI
══════════════════════════════════════════════════════════════ */
.rs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 20px;
    height: 42px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s, transform .15s, box-shadow .2s;
    border: none;
    white-space: nowrap;
}

.rs-btn--primary {
    background: var(--rs-dark);
    color: #fff;
}

.rs-btn--primary:hover {
    background: var(--rs-dark2);
    box-shadow: 0 4px 12px rgba(13, 32, 56, .3);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

.rs-btn--reset {
    background: transparent;
    color: var(--rs-text-muted);
    border: 1px solid #d0d5db;
}

.rs-btn--reset:hover {
    background: var(--rs-light);
    color: var(--rs-text);
    text-decoration: none;
}

.rs-btn--card {
    background: var(--rs-accent);
    color: #fff;
    padding: 0 16px;
    height: 36px;
    font-size: 13px;
    border-radius: 6px;
}

.rs-btn--card:hover {
    background: var(--rs-accent-h);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════════
   LICZNIK WYNIKÓW
══════════════════════════════════════════════════════════════ */
.rs-results-bar {
    margin-bottom: 16px;
}

.rs-results-count {
    font-size: 14px;
    color: var(--rs-text-muted);
    margin: 0;
}

.rs-results-count strong {
    color: var(--rs-text);
}

/* ══════════════════════════════════════════════════════════════
   GŁÓWNY UKŁAD: SIATKA + MAPA
══════════════════════════════════════════════════════════════ */
.rs-main-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.rs-main-layout--with-map {
    grid-template-columns: 1fr 420px;
    align-items: start;
}

@media (max-width: 1100px) {
    .rs-main-layout--with-map {
        grid-template-columns: 1fr 340px;
    }
}

@media (max-width: 900px) {
    .rs-main-layout--with-map {
        grid-template-columns: 1fr;
    }
}

/* ══════════════════════════════════════════════════════════════
   SIATKA KART
══════════════════════════════════════════════════════════════ */
.rs-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.rs-main-layout--with-map .rs-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ══════════════════════════════════════════════════════════════
   KARTA NIERUCHOMOŚCI
══════════════════════════════════════════════════════════════ */
.rs-card {
    background: #fff;
    border-radius: var(--rs-radius);
    overflow: hidden;
    box-shadow: var(--rs-shadow);
    transition: transform .3s ease, box-shadow .3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--rs-border);
}

.rs-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--rs-shadow-h);
}

.rs-card--featured {
    border-color: var(--rs-accent);
    box-shadow: 0 4px 20px rgba(212, 159, 88, .2);
}

/* ── Obrazek ── */
.rs-card__image-link {
    display: block;
    overflow: hidden;
    text-decoration: none;
}

.rs-card__image {
    position: relative;
    aspect-ratio: 4 / 2.7;
    overflow: hidden;
    background: #f0f0f0;
}

.rs-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}

.rs-card:hover .rs-card__image img {
    transform: scale(1.04);
}

.rs-card__image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f4;
}

/* ── Odznaki ── */
.rs-card__badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rs-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    line-height: 1.6;
}

.rs-badge--featured {
    background: var(--rs-accent);
    color: #fff;
}

.rs-badge--status {
    background: var(--rs-dark);
    color: #fff;
}

.rs-badge--market {
    background: rgba(255,255,255,.9);
    color: var(--rs-dark);
}

/* ── Treść ── */
.rs-card__body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.rs-card__meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.rs-card__type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--rs-accent);
    margin: 0;
}

.rs-card__city {
    font-size: 12px;
    color: var(--rs-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.rs-card__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
}

.rs-card__title a {
    color: var(--rs-text);
    text-decoration: none;
    transition: color .15s;
}

.rs-card__title a:hover {
    color: var(--rs-accent);
}

/* ── Statystyki ── */
.rs-card__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--rs-border);
    border-bottom: 1px solid var(--rs-border);
}

.rs-card__stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--rs-text-muted);
    font-weight: 500;
}

.rs-card__stat svg {
    color: var(--rs-accent);
    flex-shrink: 0;
}

/* ── Stopka ── */
.rs-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}

.rs-card__price-wrap { flex: 1; }

.rs-card__price {
    font-size: 18px;
    font-weight: 800;
    color: var(--rs-dark);
    margin: 0;
    line-height: 1.2;
}

.rs-card__price--ask {
    font-size: 14px;
    color: var(--rs-text-muted);
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════
   MAPA LEAFLET
══════════════════════════════════════════════════════════════ */
.rs-map-section {
    position: sticky;
    top: 80px;
}

.rs-leaflet-map {
    height: 620px;
    border-radius: var(--rs-radius);
    overflow: hidden;
    box-shadow: var(--rs-shadow);
    border: 1px solid var(--rs-border);
}

@media (max-width: 900px) {
    .rs-map-section {
        position: static;
    }
    .rs-leaflet-map {
        height: 380px;
    }
}

/* ── Niestandardowy marker z ceną ── */
.rs-map-price-icon { background: none; border: none; }

.rs-map-price-pin {
    background: var(--rs-dark);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 20px;
    white-space: nowrap;
    box-shadow: 0 3px 12px rgba(0,0,0,.35);
    cursor: pointer;
    transition: background .15s, transform .15s;
    position: relative;
}

.rs-map-price-pin::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--rs-dark);
    border-bottom: none;
}

.rs-map-price-pin:hover {
    background: var(--rs-accent);
    transform: scale(1.05);
}

/* ── Popup mapy ── */
.rs-map-popup {
    min-width: 180px;
    font-family: inherit;
    font-size: 13px;
}

.rs-map-popup__title {
    display: block;
    font-weight: 700;
    color: var(--rs-dark);
    text-decoration: none;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.3;
}

.rs-map-popup__title:hover { color: var(--rs-accent); }

.rs-map-popup__type {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--rs-accent);
    margin-bottom: 6px;
}

.rs-map-popup__meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--rs-text-muted);
    margin-bottom: 8px;
}

.rs-map-popup__btn {
    display: block;
    text-align: center;
    background: var(--rs-dark);
    color: #fff;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    transition: background .15s;
}

.rs-map-popup__btn:hover {
    background: var(--rs-accent);
    color: #fff;
}

/* Leaflet popup override */
.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.15) !important;
    padding: 0 !important;
}
.leaflet-popup-content {
    margin: 18px 20px !important;
}
.leaflet-popup-close-button {
    top: 10px !important;
    right: 10px !important;
    font-size: 18px !important;
    color: #6b7280 !important;
}

/* ══════════════════════════════════════════════════════════════
   PUSTY STAN
══════════════════════════════════════════════════════════════ */
.rs-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--rs-text-muted);
}

.rs-empty-state svg { display: block; margin: 0 auto 16px; }
.rs-empty-state p { font-size: 15px; line-height: 1.6; margin: 0; }
.rs-empty-state a { color: var(--rs-accent); text-decoration: none; font-weight: 600; }
.rs-empty-state a:hover { text-decoration: underline; }
