/* ==========================================================================
   [flats_for_sale] — listing cards (templates/flats-for-sale.php)
   ========================================================================== */

.ffs {
    --ffs-navy: #0B3B5A;
    --ffs-line: #E3E8EE;
    --ffs-soft: #F4F6F8;
    --ffs-muted: #5F6B76;
    width: 100%;
}

.ffs-head {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.ffs-updated {
    margin: 0 !important;
    font-size: 13px;
    color: var(--ffs-muted);
}

/* Filters */
.ffs-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.ffs .ffs-filter {
    padding: 8px 18px !important;
    border: 1px solid var(--ffs-line) !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: #1d2b36 !important;
    font: inherit;
    font-size: 14px !important;
    line-height: 1.2 !important;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ffs .ffs-filter:hover {
    border-color: var(--ffs-navy) !important;
}

.ffs .ffs-filter.is-active {
    background: var(--ffs-navy) !important;
    border-color: var(--ffs-navy) !important;
    color: #fff !important;
}

/* Grid */
.ffs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    align-items: start;
}

.ffs-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--ffs-line);
    border-radius: 12px;
    overflow: hidden;
}

.ffs-card[hidden] {
    display: none !important;
}

.ffs-photo {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--ffs-soft);
}

.ffs-photo img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.ffs-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.ffs-badge--ready { background: #E4F4E9; color: #1E6B3A; }
.ffs-badge--build { background: #FDF0DC; color: #8A5A00; }

.ffs-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px 14px 16px;
}

.ffs .ffs-card-title {
    margin: 0 0 4px !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

.ffs-project {
    margin: 0 0 8px !important;
    font-size: 13px;
    color: var(--ffs-muted);
}

.ffs-project a {
    color: inherit;
    text-decoration: none;
}

.ffs-project a:hover {
    text-decoration: underline;
}

.ffs-size {
    margin: 0 0 8px !important;
    font-size: 13px;
    color: var(--ffs-muted);
}

.ffs-size strong {
    font-size: 22px;
    font-weight: 700;
    color: var(--ffs-navy);
}

.ffs .ffs-plans-toggle {
    align-self: flex-start;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    color: var(--ffs-navy) !important;
    font: inherit;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

/* Floor-plan panel */
.ffs-plans {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: var(--ffs-soft);
}

.ffs-plans[hidden] {
    display: none !important;
}

.ffs-type {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ffs-type + .ffs-type {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--ffs-line);
}

.ffs .ffs-plan-thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    padding: 0 !important;
    border: 1px solid var(--ffs-line) !important;
    border-radius: 6px !important;
    background: #fff !important;
    overflow: hidden;
    cursor: zoom-in;
}

.ffs-plan-thumb img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.ffs-type-info p {
    margin: 0 !important;
}

.ffs-type-name {
    font-size: 13px;
    font-weight: 600;
    color: #1d2b36;
}

.ffs-type-meta,
.ffs-type-rooms {
    margin-top: 2px !important;
    font-size: 12px;
    line-height: 1.45;
    color: var(--ffs-muted);
}

.ffs-unit {
    opacity: 0.8;
}

.ffs-price {
    margin: 12px 0 12px !important;
    font-size: 13px;
    color: var(--ffs-muted);
}

/* Buttons pinned to the bottom so rows line up */
.ffs-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: auto;
}

.ffs .ffs-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s ease, color 0.2s ease;
}

.ffs .ffs-btn--wa {
    background: var(--ffs-navy);
    color: #fff !important;
    border: 1px solid var(--ffs-navy);
}

.ffs .ffs-btn--wa:hover {
    background: #082c44;
}

.ffs .ffs-btn--call {
    background: #fff;
    color: var(--ffs-navy) !important;
    border: 1px solid var(--ffs-navy);
}

.ffs .ffs-btn--call:hover {
    background: var(--ffs-soft);
}

.ffs-empty {
    margin: 16px 0 0 !important;
    color: var(--ffs-muted);
}

.ffs-empty[hidden] {
    display: none !important;
}

.ffs :focus-visible {
    outline: 2px solid var(--ffs-navy);
    outline-offset: 2px;
}

/* ---------- Floor-plan lightbox ---------- */
.ffs-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 16px 24px;
    background: rgba(0, 0, 0, 0.9);
}

.ffs-lightbox[hidden] {
    display: none !important;
}

.ffs-lightbox figure {
    margin: 0;
    max-width: 100%;
    text-align: center;
}

.ffs-lightbox img {
    display: block;
    max-width: min(1000px, 100%);
    max-height: calc(100vh - 140px);
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    object-fit: contain;
}

.ffs-lightbox figcaption {
    margin-top: 12px;
    color: #fff;
    font-size: 15px;
}

.ffs-lightbox .ffs-lb-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.15) !important;
    cursor: pointer;
}

.ffs-lightbox .ffs-lb-close::before,
.ffs-lightbox .ffs-lb-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    background: #fff;
}

.ffs-lightbox .ffs-lb-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.ffs-lightbox .ffs-lb-close::after  { transform: translate(-50%, -50%) rotate(-45deg); }

@media (max-width: 767px) {
    .ffs-head {
        justify-content: flex-start; /* "Availability updated" left on phones */
    }

    .ffs-grid {
        grid-template-columns: 1fr;
    }

    .ffs-filters {
        gap: 6px;
    }

    .ffs .ffs-filter {
        padding: 7px 14px !important;
        font-size: 13px !important;
    }
}

/* ---------- [project_compare] — comparison table ---------- */
.ffs-compare-scroll {
    overflow-x: auto;
    border: 1px solid var(--ffs-line);
    border-radius: 12px;
}

.ffs .ffs-compare-table {
    width: 100%;
    table-layout: fixed;            /* project columns share the width equally */
    margin: 0 !important;
    border: 0 !important;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.5;
}

.ffs .ffs-compare-table--many {
    min-width: 720px;               /* 3+ projects: scroll sideways on small screens */
}

.ffs .ffs-compare-table th,
.ffs .ffs-compare-table td {
    overflow-wrap: break-word;
    padding: 12px 16px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--ffs-line) !important;
    background: #fff;
    text-align: left !important;
    vertical-align: top;
}

.ffs .ffs-compare-table tbody tr:last-child th,
.ffs .ffs-compare-table tbody tr:last-child td {
    border-bottom: 0 !important;
}

.ffs .ffs-compare-table thead th,
.ffs .ffs-compare-table thead td {
    background: var(--ffs-navy);
    border-bottom: 0 !important;
}

.ffs .ffs-compare-table thead th {
    font-size: 15px;
    font-weight: 700;
}

.ffs .ffs-compare-table thead a {
    color: #fff;
    text-decoration: none;
}

.ffs .ffs-compare-table thead a:hover {
    text-decoration: underline;
}

.ffs .ffs-compare-table thead td:first-child,
.ffs .ffs-compare-table tbody th {
    width: 130px;
}

.ffs .ffs-compare-table tbody th {
    font-weight: 600;
    color: var(--ffs-muted);
}

.ffs .ffs-compare-table tbody td {
    color: #1d2b36;
}

@media (max-width: 767px) {
    .ffs .ffs-compare-table {
        font-size: 13px;
    }

    .ffs .ffs-compare-table th,
    .ffs .ffs-compare-table td {
        padding: 10px 8px !important;
    }

    .ffs .ffs-compare-table thead th {
        font-size: 14px;
    }

    .ffs .ffs-compare-table thead td:first-child,
    .ffs .ffs-compare-table tbody th {
        width: 76px;
    }
}

/* ---------- [project_sale_cards] — project cards ---------- */
.ffs-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.ffs-project-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--ffs-line);
    border-radius: 12px;
    overflow: hidden;
}

.ffs-project-photo {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--ffs-soft);
}

.ffs-project-photo img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.ffs-project-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px 16px 18px;
}

.ffs .ffs-project-name {
    margin: 0 0 6px !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

.ffs .ffs-project-name a {
    color: inherit;
    text-decoration: none;
}

.ffs .ffs-project-name a:hover {
    color: var(--ffs-navy);
}

.ffs-project-meta {
    margin: 0 0 14px !important;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ffs-muted);
}

.ffs-project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.ffs-project-actions .ffs-btn {
    padding: 0 18px;
}

@media (max-width: 767px) {
    .ffs-projects-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- [loan_banks] — bank chips ---------- */
.ffs.ffs-banks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.ffs-bank {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    padding: 9px 14px;
    background: #fff;
    border: 1px solid var(--ffs-line);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.3;
    color: #1d2b36;
}

.ffs-bank::before {
    content: none !important; /* no theme list bullets */
}

.ffs-bank-note {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--ffs-soft);
    font-size: 11px;
    color: var(--ffs-muted);
}

/* ---------- [loan_cost_box] — cost box (WYSIWYG content) ---------- */
.ffs.ffs-cost-box {
    padding: 24px;
    background: #fff;
    border: 1px solid var(--ffs-line);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    color: #1d2b36;
}

.ffs-cost-box > :first-child {
    margin-top: 0 !important;
}

.ffs-cost-box > :last-child {
    margin-bottom: 0 !important;
}

.ffs-cost-box h2,
.ffs-cost-box h3,
.ffs-cost-box h4 {
    margin: 0 0 12px !important;
    line-height: 1.3 !important;
}

.ffs-cost-box ul,
.ffs-cost-box ol {
    margin: 0 0 12px !important;
    padding-left: 20px !important;
}

.ffs-cost-box li {
    margin: 0 0 6px !important;
}

.ffs-cost-box p {
    margin: 0 0 12px !important;
}

/* Last line (e.g. "Rates can change…") smaller and muted */
.ffs-cost-box > p:last-child {
    font-size: 12px;
    color: var(--ffs-muted);
}

@media (max-width: 767px) {
    .ffs.ffs-cost-box {
        padding: 18px;
    }
}