/* =========================================================
   SRA MLS Grid IDX — Front-End Styles
   ========================================================= */

/* ----------------------------------------------------------
   Search Form
   ---------------------------------------------------------- */
.sra-search-form-wrapper {
    margin-bottom: 24px;
}

.sra-search-form {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 24px;
    max-width: 900px;
}

.sra-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.sra-form-row-2col .sra-form-group {
    flex: 1;
    min-width: 180px;
}

.sra-form-row-price {
    align-items: flex-end;
}

.sra-form-row-price .sra-form-group {
    flex: 1;
    min-width: 140px;
}

.sra-price-to {
    line-height: 36px;
    color: #555;
    font-weight: 500;
    padding: 0 4px;
    margin-bottom: 0;
    align-self: flex-end;
}

.sra-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sra-form-group label,
.sra-checkboxes-label {
    font-size: 0.82em;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sra-select {
    width: 100%;
    height: 36px;
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    background: #fff;
    color: #333;
    cursor: pointer;
    appearance: auto;
}

.sra-select:focus {
    border-color: #5cb85c;
    outline: none;
    box-shadow: 0 0 0 2px rgba(92, 184, 92, 0.2);
}

/* Checkboxes row */
.sra-form-row-checkboxes {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.sra-checkboxes-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.sra-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92em;
    color: #333;
    cursor: pointer;
    user-select: none;
}

.sra-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #5cb85c;
}

/* Submit button */
.sra-form-row-submit {
    margin-bottom: 0;
}

.sra-search-btn {
    background-color: #5cb85c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 28px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
    letter-spacing: 0.3px;
}

.sra-search-btn:hover,
.sra-search-btn:focus {
    background-color: #449d44;
    outline: none;
}

/* ----------------------------------------------------------
   Listing Grid
   ---------------------------------------------------------- */

/*
 * Override the WordPress is-layout-constrained "content-size" (700px)
 * constraint that gets applied to direct children of Group blocks
 * with the Constrained layout. Using a higher-specificity selector
 * (0,2,0) and !important so it wins regardless of cascade order.
 */
.is-layout-constrained > .sra-listing-grid-wrapper,
.wp-block-group > .sra-listing-grid-wrapper {
    max-width: 960px !important;
    width: 100% !important;
}

.sra-listing-grid-wrapper {
    max-width: 960px;
    width: 100%;
}

.sra-grid-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.sra-results-count {
    font-size: 0.95em;
    color: #555;
}

.sra-sort-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.sra-sort-select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}

.sra-listing-grid {
    width: 100%;
}

/* ----------------------------------------------------------
   Listing Row
   ---------------------------------------------------------- */

/*
 * Use a two-class selector (.sra-listing-grid .sra-listing-row)
 * for specificity (0,2,0) so our flex-direction beats any
 * single-class WordPress layout rule that might conflict.
 */
.sra-listing-grid .sra-listing-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
}

/* Base styles on the row itself */
.sra-listing-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e8e8e8;
    align-items: flex-start;
}

.sra-listing-row:last-child {
    border-bottom: none;
}

.sra-listing-photo {
    flex: 0 0 180px !important;
    width: 180px !important;
}

.sra-listing-photo img {
    width: 180px;
    height: 135px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

/* Pending Badge */
.sra-pending-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f39c12;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sra-pending-badge svg {
    width: 14px;
    height: 14px;
}

.sra-listing-photo {
    position: relative;
}

.sra-no-photo {
    width: 180px;
    height: 135px;
    background: #f0f0f0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 0.85em;
}

.sra-listing-content {
    flex: 1 !important;
    min-width: 0 !important;
}

.sra-listing-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.sra-listing-address {
    margin: 0 0 4px 0;
    font-size: 1.1em;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
}

.sra-listing-address a {
    color: #2271b1;
    text-decoration: none;
}

.sra-listing-address a:hover {
    text-decoration: underline;
    color: #135e96;
}

.sra-listing-price {
    font-size: 1.15em;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
}

.sra-listing-excerpt {
    color: #555;
    font-size: 0.9em;
    margin: 8px 0;
    line-height: 1.5;
}

/* ----------------------------------------------------------
   Stats Pills
   ---------------------------------------------------------- */
.sra-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.sra-stat-pill {
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    padding: 3px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fafafa;
    min-width: 48px;
}

.sra-stat-value {
    font-size: 0.92em;
    font-weight: 700;
    color: #222;
    line-height: 1.2;
}

.sra-stat-label {
    font-size: 0.68em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    font-variant: small-caps;
    line-height: 1.2;
}

.sra-listing-attribution {
    font-size: 0.8em;
    color: #888;
    margin-top: 6px;
    margin-bottom: 0;
}

.sra-no-results {
    padding: 20px 0;
    color: #666;
    font-size: 0.95em;
}

/* ----------------------------------------------------------
   Pagination
   ---------------------------------------------------------- */
.sra-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.sra-page-link {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    color: #2271b1;
    text-decoration: none;
    font-size: 0.9em;
    background: #fff;
    transition: background 0.15s;
}

.sra-page-link:hover {
    background: #f0f7ff;
    border-color: #2271b1;
}

.sra-page-current {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
    font-weight: 600;
    cursor: default;
}

.sra-page-current:hover {
    background: #2271b1;
    color: #fff;
}

.sra-page-ellipsis {
    padding: 6px 4px;
    color: #888;
}

/* ----------------------------------------------------------
   Compliance Footer
   ---------------------------------------------------------- */
.sra-compliance-footer {
    border-top: 1px solid #e0e0e0;
    margin-top: 32px;
    padding-top: 16px;
    font-size: 0.78em;
    color: #666;
    line-height: 1.6;
}

.sra-compliance-footer p {
    margin-bottom: 6px;
}

.sra-compliance-footer a {
    color: #2271b1;
}

/* ----------------------------------------------------------
   Single Listing
   ---------------------------------------------------------- */
.sra-single-wrapper {
    max-width: 960px;
}

.sra-back-link {
    margin-bottom: 16px;
    font-size: 0.9em;
}

.sra-back-link a {
    color: #2271b1;
    text-decoration: none;
}

.sra-back-link a:hover {
    text-decoration: underline;
}

/* Gallery */
.sra-single-gallery {
    margin-bottom: 24px;
    position: relative;
}

.sra-gallery-main {
    position: relative;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.sra-main-photo {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.sra-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 40px;
    height: 60px;
    font-size: 1.8em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
    line-height: 1;
}

.sra-gallery-arrow:hover {
    background: rgba(0, 0, 0, 0.75);
}

.sra-gallery-prev {
    left: 8px;
}

.sra-gallery-next {
    right: 8px;
}

.sra-gallery-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.82em;
}

.sra-fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 34px;
    height: 34px;
    font-size: 1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sra-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.sra-gallery-thumbs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.sra-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.7;
    border: 2px solid transparent;
    flex-shrink: 0;
    transition: opacity 0.15s, border-color 0.15s;
}

.sra-thumb:hover {
    opacity: 1;
}

.sra-thumb-active {
    opacity: 1;
    border-color: #2271b1;
}

/* Lightbox */
.sra-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sra-lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}

.sra-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.2em;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

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

.sra-lightbox-prev,
.sra-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 2.5em;
    cursor: pointer;
    width: 50px;
    height: 70px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sra-lightbox-prev {
    left: 16px;
}

.sra-lightbox-next {
    right: 16px;
}

.sra-lightbox-prev:hover,
.sra-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sra-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9em;
}

/* Single Header */
.sra-single-header {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sra-single-price {
    font-size: 2em;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
}

.sra-single-address-block {
    flex: 1;
    min-width: 0;
}

.sra-single-address {
    font-size: 1.3em;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #222;
    line-height: 1.3;
}

.sra-single-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sra-badge {
    background: #f0f4f8;
    border: 1px solid #d0dae4;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
}

/* Single Listing Actions */
.sra-single-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.sra-favorite-btn,
.sra-share-btn {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}

.sra-favorite-btn:hover,
.sra-share-btn:hover {
    border-color: #1a5f7a;
    color: #1a5f7a;
}

.sra-favorite-btn.sra-is-favorite {
    border-color: #e74c3c;
    color: #e74c3c;
}

.sra-favorite-btn.sra-is-favorite svg {
    fill: #e74c3c;
    color: #e74c3c;
}

.sra-heart-icon {
    display: block;
    color: #666;
}

.sra-heart-icon-filled {
    display: none;
    fill: #e74c3c;
    color: #e74c3c;
}

.sra-favorite-btn.sra-is-favorite .sra-heart-icon {
    display: none;
}

.sra-favorite-btn.sra-is-favorite .sra-heart-icon-filled {
    display: block;
}

/* Feature badges */
.sra-feature-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.sra-feature-badge {
    background: #eaf4ea;
    border: 1px solid #c3e0c3;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.85em;
    color: #2d6a2d;
}

.sra-feature-badge a {
    color: #2d6a2d;
    text-decoration: none;
}

.sra-feature-badge a:hover {
    text-decoration: underline;
}

/* Modal trigger button */
.sra-modal-trigger {
    background: linear-gradient(135deg, #1a5f7a 0%, #2e8b57 100%);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 16px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.sra-modal-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 95, 122, 0.3);
}

/* Description */
.sra-description-section {
    margin-bottom: 28px;
}

.sra-description-section h2 {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 10px;
    color: #222;
}

.sra-description-text {
    color: #444;
    line-height: 1.7;
    font-size: 0.95em;
    margin: 0;
}

.sra-show-more-btn {
    background: none;
    border: none;
    color: #2271b1;
    font-size: 0.9em;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 6px;
    text-decoration: underline;
}

/* Key Stats */
.sra-key-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.sra-key-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sra-key-stat-value {
    font-size: 1.05em;
    font-weight: 700;
    color: #222;
}

.sra-key-stat-label {
    font-size: 0.73em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #777;
}

/* Listed By */
.sra-listed-by {
    background: none;
    border-left: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.78em;
    color: #bbb;
    margin-bottom: 8px;
}

.sra-listed-by strong {
    font-weight: normal;
    color: #bbb;
}

/* Source Attribution */
.sra-source-attribution {
    font-size: 0.74em;
    color: #bbb;
    margin-bottom: 16px;
    padding: 0;
    background: none;
    border-radius: 0;
}

.sra-source-attribution strong {
    font-weight: normal;
    color: #bbb;
}

/* Map */
.sra-map-section {
    margin-bottom: 28px;
}

.sra-map-section h2 {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 10px;
    color: #222;
}

.sra-map-wrapper {
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.sra-map-wrapper iframe {
    display: block;
}

.sra-map-section > p {
    font-size: 0.85em;
    margin-top: 6px;
}

/* Facts & Features */
.sra-facts-section {
    margin-bottom: 28px;
}

.sra-facts-section h2 {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 16px;
    color: #222;
    border-bottom: 2px solid #e8e8e8;
    padding-bottom: 8px;
}

.sra-facts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.sra-facts-group {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
}

.sra-facts-group h3 {
    font-size: 0.92em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    margin: 0 0 12px 0;
}

.sra-facts-list {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 16px;
    row-gap: 6px;
}

.sra-facts-list dt {
    font-weight: 600;
    color: #555;
    font-size: 0.88em;
}

.sra-facts-list dd {
    margin: 0;
    color: #333;
    font-size: 0.88em;
}

/* Price section */
.sra-price-section {
    margin-bottom: 24px;
}

.sra-price-section h2 {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 6px;
    color: #222;
}

.sra-price-display {
    font-size: 1.8em;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px 0;
}

.sra-modification-date {
    font-size: 0.82em;
    color: #888;
    margin: 0;
}

/* ----------------------------------------------------------
   Responsive
   ---------------------------------------------------------- */
@media (max-width: 768px) {
    .sra-search-form {
        padding: 16px;
    }

    .sra-form-row-2col {
        flex-direction: column;
        gap: 12px;
    }

    .sra-form-row-price {
        flex-wrap: wrap;
    }

    .sra-form-row-price .sra-form-group {
        flex: 1;
        min-width: 120px;
    }

    .sra-single-header {
        flex-direction: column;
        gap: 8px;
    }

    .sra-single-price {
        font-size: 1.6em;
    }

    .sra-facts-grid {
        grid-template-columns: 1fr;
    }

    .sra-gallery-thumbs {
        gap: 4px;
    }

    .sra-thumb {
        width: 60px;
        height: 45px;
    }

    .sra-pagination {
        gap: 3px;
    }

    .sra-page-link {
        padding: 5px 9px;
        font-size: 0.82em;
    }

    .sra-grid-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .sra-search-form {
        padding: 12px;
    }

    /* Stack listing rows vertically only on truly narrow (phone) viewports.
       High-specificity selector matches the base rule above. */
    .sra-listing-grid .sra-listing-row,
    .sra-listing-row {
        flex-direction: column !important;
        flex-wrap: wrap !important;
        gap: 10px;
    }

    .sra-listing-photo {
        flex: unset !important;
        width: 100% !important;
    }

    .sra-listing-photo img {
        width: 100%;
        height: 200px;
    }

    .sra-key-stats {
        gap: 12px;
    }

    .sra-single-address {
        font-size: 1.1em;
    }
}
