/**
 * Unified Property Template Styles
 * Prefix: spt- (SplitSight Property Template)
 * Used by both grid-item-property and popup-property templates.
 */

/* === Card container === */
.spt-listing {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.spt-popup {
    min-width: 260px;
    max-width: 300px;
}

/* Reset Leaflet popup internal margins so image goes edge-to-edge */
.lv-popup .leaflet-popup-content:has(.spt-popup) {
    margin: 0;
    width: auto !important;
}

.lv-popup .leaflet-popup-content-wrapper:has(.spt-popup) {
    padding: 0;
    overflow: hidden;
}

/* === Image area === */
.spt-image {
    position: relative;
    overflow: hidden;
    height: auto; /* override core .lv-item-image fixed 160px height */
}

.spt-listing .spt-image {
    aspect-ratio: 4 / 3;
}

.spt-popup .spt-image {
    aspect-ratio: 16 / 10;
    max-height: 130px;
}

.spt-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.spt-image-placeholder {
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.spt-placeholder-icon {
    font-size: 48px;
    color: #ccc;
}

/* Popup image */
.spt-popup .spt-image img {
    border-radius: var(--lv-radius, 8px) var(--lv-radius, 8px) 0 0;
}

.spt-popup .spt-image-placeholder {
    min-height: 120px;
    border-radius: var(--lv-radius, 8px) var(--lv-radius, 8px) 0 0;
}

.spt-popup .spt-placeholder-icon {
    font-size: 32px;
}

/* === Image overlays === */
.spt-overlays {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 8px;
    pointer-events: none;
}

.spt-overlay {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.3;
    pointer-events: auto;
}

.spt-overlay-price {
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
}

.spt-overlay-badge {
    background: rgba(255, 255, 255, 0.92);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.3);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Popup overlays: smaller */
.spt-popup .spt-overlay {
    font-size: 11px;
    padding: 3px 7px;
}

/* === Content area === */
.spt-content {
    display: flex;
    flex-direction: column;
}

.spt-popup-content {
    padding: 0;
}

.spt-popup-content > *:not(.spt-price-row) {
    padding-left: 12px;
    padding-right: 12px;
}

.spt-popup-content > *:last-child {
    padding-bottom: 12px;
}

/* === Price row === */
.spt-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    margin-bottom: 4px;
    background: #f3f4f6;
    margin: -16px -16px 16px -16px;
    padding: 6px 16px;
}

.spt-price-type {
    font-size: 1.1em;
    color: #59799a;
    font-weight: 600;
    text-transform: capitalize;
}

.spt-price-value {
    font-size: 1.1em;
    color: #59799a;
    font-weight: 700;
}

.spt-price-secondary {
    font-size: 13px;
    color: #6a6a6a;
    margin-top: -4px;
    margin-bottom: 4px;
}

/* Popup price row — flush with image and sides, matching grid style */
.spt-popup .spt-price-row {
    margin: 0;
    padding: 6px 12px;
    background: #f3f4f6;
}

.spt-popup .spt-popup-title {
    margin-top: 16px;
}

.spt-popup .spt-details {
    margin-bottom: 0;
}

.spt-popup .spt-actions {
    margin-top: 4px;
}

.spt-popup .spt-actions a.spt-button,
.spt-popup .spt-actions button.spt-button {
    padding: 6px 12px;
    font-size: 11px;
}

.spt-popup .spt-price-type {
    font-size: 13px;
}

.spt-popup .spt-price-value {
    font-size: 14px;
}

/* === Title === */
.spt-listing .lv-item-title {
    margin-bottom: 2px;
    font-size: 1.3em !important;
}

.spt-listing .lv-item-title a {
    text-decoration: none;
    color: inherit;
}

.spt-popup-title {
    font-size: 14px;
    margin: 0 0 4px 0;
}

/* === Address === */
.spt-address {
    margin: 2px 0 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.spt-address-compact {
    margin-top: 2px;
}

.spt-address-street {
    font-size: 16px;
    font-weight: 600;
    color: #6a6a6a;
    line-height: 1.2;
    margin-top: 8px;
    margin-bottom: 2px;
}

.spt-address-csz {
    font-size: 13px;
    color: #7f8c8d;
    line-height: 1.2;
}

/* Popup address */
.spt-popup .spt-address {
    margin-bottom: 16px;
}

.spt-popup .spt-address-street {
    font-size: 13px;
}

.spt-popup .spt-address-csz {
    font-size: 12px;
}

/* === Detail chips === */
.spt-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 12px 0 24px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 15px;
    color: #6a6a6a;
    font-weight: 500;
    line-height: 1.4;
}

.spt-chip {
    display: inline-block;
    white-space: nowrap;
}

.spt-chip-sep {
    color: #c6c6c6;
    margin: 0 2px;
}

/* Popup chips: tighter */
.spt-popup .spt-details {
    margin: 4px 0 0 0;
    padding: 6px 8px;
    font-size: 12px;
}

/* === Description === */
.spt-description {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    margin: 4px 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Agent / broker section === */
.spt-agents {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    margin-top: auto;
}

.spt-agent-avatars {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
}

.spt-agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 30%;
    overflow: hidden;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    position: relative;
}

.spt-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top; /* headshots: keep the face when cropping */
    display: block;
    border-radius: 30%;
}

.spt-agent-placeholder {
    width: 100%;
    height: 100%;
    background: #e8eaed;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95999e;
    font-size: 14px;
}

.spt-agent-company {
    font-size: 12px;
    color: #5f6368;
    font-weight: 700;
}

/* === View Details button === */
.spt-actions {
    margin-top: auto;
}

.spt-actions .spt-button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: #4f627a;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    font-size: 1em;
    letter-spacing: 0.5px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.spt-actions .spt-button:hover {
    background: #3d4e63;
    color: #fff;
    text-decoration: none;
}
