/* ==========================================================================
   Properties Show AI — Styles
   ========================================================================== */

:root {
    --psa-accent: #2563eb;
    --psa-accent-hover: #1d4ed8;
    --psa-green: #16a34a;
    --psa-red: #dc2626;
    --psa-gray-50: #f9fafb;
    --psa-gray-100: #f3f4f6;
    --psa-gray-200: #e5e7eb;
    --psa-gray-300: #d1d5db;
    --psa-gray-400: #9ca3af;
    --psa-gray-500: #6b7280;
    --psa-gray-600: #4b5563;
    --psa-gray-700: #374151;
    --psa-gray-800: #1f2937;
    --psa-gray-900: #111827;
    --psa-white: #ffffff;
    --psa-radius: 8px;
    --psa-radius-lg: 12px;
    --psa-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --psa-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --psa-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --psa-transition: 0.2s ease;
    --psa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Layout
   ========================================================================== */

.psa-wrap {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: var(--psa-font);
    color: var(--psa-gray-800);
    line-height: 1.5;
}

/* Filter Bar
   ========================================================================== */

.psa-filters {
    background: var(--psa-white);
    border: 1px solid var(--psa-gray-200);
    border-radius: var(--psa-radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--psa-shadow);
}

.psa-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.psa-filter-field {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 150px;
}

.psa-filter-field label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--psa-gray-500);
    margin-bottom: 6px;
}

.psa-filter-search {
    flex: 2;
    min-width: 200px;
}

.psa-filter-field input[type="text"],
.psa-filter-field input[type="number"],
.psa-filter-field select {
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--psa-gray-300);
    border-radius: var(--psa-radius);
    font-size: 14px;
    color: var(--psa-gray-800);
    background: var(--psa-white);
    transition: border-color var(--psa-transition);
    width: 100%;
    box-sizing: border-box;
}

.psa-filter-field input:focus,
.psa-filter-field select:focus {
    outline: none;
    border-color: var(--psa-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.psa-price-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.psa-price-inputs input {
    flex: 1;
    min-width: 80px;
}

.psa-price-sep {
    color: var(--psa-gray-400);
    font-size: 14px;
}

.psa-filter-price {
    min-width: 220px;
}

.psa-filter-actions {
    flex: 0 0 auto;
    min-width: auto;
}

.psa-btn-reset {
    height: 40px;
    padding: 0 20px;
    border: 1px solid var(--psa-gray-300);
    border-radius: var(--psa-radius);
    background: var(--psa-white);
    color: var(--psa-gray-600);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--psa-transition);
    white-space: nowrap;
}

.psa-btn-reset:hover {
    background: var(--psa-gray-50);
    border-color: var(--psa-gray-400);
}

/* Results Bar
   ========================================================================== */

.psa-results-bar {
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--psa-gray-500);
}

/* Property Grid
   ========================================================================== */

.psa-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    transition: opacity var(--psa-transition);
}

.psa-grid.psa-loading-active {
    opacity: 0.4;
    pointer-events: none;
}

.psa-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--psa-gray-500);
    font-size: 16px;
}

@media (min-width: 640px) {
    .psa-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .psa-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Property Card
   ========================================================================== */

.psa-card {
    display: block;
    background: var(--psa-white);
    border: 1px solid var(--psa-gray-200);
    border-radius: var(--psa-radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow var(--psa-transition), transform var(--psa-transition);
    box-shadow: var(--psa-shadow);
}

.psa-card:hover {
    box-shadow: var(--psa-shadow-lg);
    transform: translateY(-2px);
}

.psa-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--psa-gray-100);
}

.psa-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.psa-card:hover .psa-card-image img {
    transform: scale(1.03);
}

.psa-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--psa-gray-300);
}

.psa-card-placeholder svg {
    width: 48px;
    height: 48px;
}

.psa-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--psa-white);
}

.psa-status-available {
    background: var(--psa-green);
}

.psa-status-sold {
    background: var(--psa-red);
}

.psa-card-body {
    padding: 16px;
}

.psa-card-address {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--psa-gray-900);
}

.psa-card-city {
    font-size: 13px;
    color: var(--psa-gray-500);
    margin: 0 0 10px;
}

.psa-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--psa-accent);
    margin: 0 0 12px;
}

.psa-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid var(--psa-gray-100);
    padding-top: 12px;
}

.psa-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--psa-gray-600);
}

.psa-meta-item svg {
    color: var(--psa-gray-400);
    flex-shrink: 0;
}

/* Energy label badges */

.psa-energy {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    color: var(--psa-white);
}

.psa-energy-a { background: #22c55e; }
.psa-energy-b { background: #84cc16; }
.psa-energy-c { background: #eab308; color: var(--psa-gray-800); }
.psa-energy-d { background: #f97316; }
.psa-energy-e { background: #ef4444; }
.psa-energy-f { background: #dc2626; }
.psa-energy-g { background: #b91c1c; }

/* Pagination
   ========================================================================== */

.psa-pagination-wrap {
    margin-top: 32px;
}

.psa-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.psa-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--psa-gray-300);
    border-radius: var(--psa-radius);
    background: var(--psa-white);
    color: var(--psa-gray-700);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--psa-transition);
    user-select: none;
}

.psa-page-link:hover {
    background: var(--psa-gray-50);
    border-color: var(--psa-accent);
    color: var(--psa-accent);
}

.psa-page-link.psa-page-active {
    background: var(--psa-accent);
    border-color: var(--psa-accent);
    color: var(--psa-white);
    pointer-events: none;
}

.psa-page-dots {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    color: var(--psa-gray-400);
}

/* Loading
   ========================================================================== */

.psa-loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.psa-loading.psa-active {
    display: flex;
}

.psa-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--psa-gray-200);
    border-top-color: var(--psa-accent);
    border-radius: 50%;
    animation: psa-spin 0.7s linear infinite;
}

@keyframes psa-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Detail View
   ========================================================================== */

.psa-detail-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 16px 60px;
    font-family: var(--psa-font);
    color: var(--psa-gray-800);
    line-height: 1.6;
}

.psa-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--psa-accent);
    text-decoration: none;
    margin-bottom: 24px;
    transition: color var(--psa-transition);
}

.psa-back-link:hover {
    color: var(--psa-accent-hover);
}

/* Gallery
   ========================================================================== */

.psa-gallery {
    margin-bottom: 32px;
}

.psa-gallery-main {
    border-radius: var(--psa-radius-lg);
    overflow: hidden;
    background: var(--psa-gray-100);
    cursor: pointer;
    aspect-ratio: 16 / 9;
}

.psa-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.psa-gallery-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.psa-gallery-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: border-color var(--psa-transition), opacity var(--psa-transition);
    opacity: 0.6;
}

.psa-gallery-thumb:hover,
.psa-gallery-thumb.active {
    opacity: 1;
}

.psa-gallery-thumb.active {
    border-color: var(--psa-accent);
}

.psa-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.psa-no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--psa-gray-400);
    gap: 12px;
}

.psa-no-image p {
    font-size: 14px;
    margin: 0;
}

/* Detail Header
   ========================================================================== */

.psa-detail-header {
    margin-bottom: 32px;
}

.psa-detail-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.psa-detail-title-row .psa-card-badge {
    position: static;
    flex-shrink: 0;
    margin-top: 4px;
}

.psa-detail-address {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--psa-gray-900);
    line-height: 1.3;
}

.psa-detail-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--psa-accent);
    margin: 0 0 8px;
}

.psa-detail-slogan {
    font-size: 16px;
    color: var(--psa-gray-500);
    font-style: italic;
    margin: 0;
}

/* Specs Grid
   ========================================================================== */

.psa-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--psa-gray-900);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--psa-gray-100);
}

.psa-specs {
    margin-bottom: 32px;
}

.psa-specs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 640px) {
    .psa-specs-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.psa-spec {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--psa-gray-100);
}

@media (min-width: 640px) {
    .psa-spec {
        padding: 12px 16px;
    }

    .psa-spec:nth-child(odd) {
        border-right: 1px solid var(--psa-gray-100);
    }
}

.psa-spec-label {
    font-size: 14px;
    color: var(--psa-gray-500);
}

.psa-spec-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--psa-gray-800);
}

.psa-energy-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    color: var(--psa-white);
    font-weight: 700;
    font-size: 13px;
}

/* Description
   ========================================================================== */

.psa-description {
    margin-bottom: 32px;
}

.psa-desc-text {
    font-size: 15px;
    color: var(--psa-gray-700);
    line-height: 1.7;
}

.psa-dutch-toggle {
    margin-top: 16px;
}

.psa-toggle-btn {
    background: none;
    border: 1px solid var(--psa-gray-300);
    border-radius: var(--psa-radius);
    padding: 8px 16px;
    font-size: 14px;
    color: var(--psa-accent);
    cursor: pointer;
    transition: all var(--psa-transition);
}

.psa-toggle-btn:hover {
    border-color: var(--psa-accent);
    background: rgba(37, 99, 235, 0.04);
}

.psa-dutch-desc {
    margin-top: 16px;
}

/* Location
   ========================================================================== */

.psa-location {
    margin-bottom: 32px;
}

.psa-location p {
    font-size: 15px;
    color: var(--psa-gray-700);
    margin: 0;
}

/* Lightbox
   ========================================================================== */

.psa-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.psa-lightbox[hidden] {
    display: none;
}

.psa-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--psa-radius);
}

.psa-lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    background: none;
    border: none;
    color: var(--psa-white);
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    padding: 8px;
    opacity: 0.8;
    transition: opacity var(--psa-transition);
}

.psa-lightbox-close:hover {
    opacity: 1;
}

/* Responsive adjustments
   ========================================================================== */

@media (max-width: 639px) {
    .psa-filters-row {
        flex-direction: column;
    }

    .psa-filter-field {
        min-width: 100%;
    }

    .psa-detail-address {
        font-size: 20px;
    }

    .psa-detail-price {
        font-size: 22px;
    }

    .psa-gallery-main {
        aspect-ratio: 4 / 3;
    }

    .psa-gallery-thumb {
        width: 64px;
        height: 44px;
    }
}

@media (min-width: 640px) and (max-width: 767px) {
    .psa-filter-field {
        min-width: calc(50% - 8px);
    }
}

@media (min-width: 768px) {
    .psa-wrap {
        padding: 32px 24px;
    }

    .psa-detail-wrap {
        padding: 40px 24px 80px;
    }
}
