/**
 * Property Filter Styles
 */

 :root {
    --primary-color: #c2ac7a;
    --secondary-color: #385e48;
    --lightbg-color: #eef5f1;
    --text-color: #333333;
    --light-color: #ffffff;
    --border-radius: 0;
    --container-width: 1200px;
}

/* Container styles */
.apf-filter-container {
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
    background-color: var(--wp--preset--color--lightbg, #dfece4);
    padding-top: var(--wp--preset--spacing--70);
    padding-bottom: var(--wp--preset--spacing--70);
}

.apf-properties-container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
}

/* Filter form styles */
.apf-filter-form {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.apf-filter-fields {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: var(--wp--preset--spacing--50);
    margin-bottom: 20px;
    font-size: var(--wp--preset--font-size--r);
}

.apf-filter-field {
    display: flex;
    position: relative;
}

/* Select styles */
.apf-select {
    width: 100%;
    padding: .75rem 2rem;
    border: 1px solid var(--wp--preset--color--secondary, #385e48);
    background-color: var(--wp--preset--color--lightbg, #dfece4);
    border-radius: var(--border-radius);
    font-size: var(--wp--preset--font-size--r);
    cursor: pointer;
    appearance: none;
}

/* Button styles */
.apf-button {
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    transition: background-color 0.3s ease;
    border-radius: var(--border-radius);
    font-family: "PT Sans Narrow", sans-serif;
}

.apf-search-submit {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    font-weight: 700;
    text-transform: uppercase;
    min-width: 12.5rem;
}

.apf-search-submit:hover {
    background-color: var(--secondary-color);
}

.apf-options-button {
    background-color: transparent;
    color: var(--text-color);
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: .75rem 1.5rem;
    border: 1px solid transparent; /* for alignment */
}

.apf-more-options-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 15px;
}

.apf-more-icon,
.apf-clear-icon {
    height: 1em;
    width: 1em;
    fill: currentColor;
}

.apf-more-icon {
    transition: transform 0.3s ease;
    transform-origin: center;
}

.apf-more-toggle.expanded .apf-more-icon {
    transform: rotate(180deg);
}

.apf-reset {
    background-color: #f5f5f5;
    color: var(--text-color);
}

.apf-reset:hover {
    background-color: #e0e0e0;
}

/* Advanced filters */
.apf-advanced-filters {
    max-width: 720px;
    margin: 20px auto 0;
}

/* Filter row styles for advanced filters */
.apf-filter-row {
    display: flex;
    margin-bottom: 20px;
    align-items: center;
}

.apf-filter-row-label {
    width: 150px;
    color: var(--text-color);
}

.apf-filter-row-inputs {
    flex: 1;
}

.apf-filter-row-inputs select{
    width: 100%;
}

.apf-filter-row-full {
    width: 100%;
    text-align: center;
}

.apf-clear-filters-row {
   justify-content: center;
}

.apf-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.apf-input {
    border: 1px solid var(--wp--preset--color--secondary, #385e48);
    width: 100%;
    border-radius: var(--border-radius);
    min-height: 50px;
    background-color: var(--wp--preset--color--lightbg, #dfece4);
}

.apf-range-unit {
    flex-shrink: 0;
    margin-left: 5px;
}


/* Results header */
.apf-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.apf-orderby {
    border: 1px solid var(--wp--preset--color--secondary, #385e48);
    background-color: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
}

/* Property card - Horizontal Layout */
.apf-properties-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 40px;
    position: relative;
    min-height: 200px;
}

.apf-properties-list.apf-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255,255,255,0.7);
    z-index: 5;
}

.apf-properties-list.apf-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: apf-spin 1s linear infinite;
    z-index: 6;
}

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

.apf-property-card {
    background-color: white;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, .1);
}

.apf-property-card-inner {
    display: flex;
    flex-direction: row; /* Horizontal layout */
    height: 100%;
}

.apf-property-image-section {
    width: 50%;
    position: relative;
}

.apf-property-details-section {
    width: 50%;
    display: flex;
    flex-direction: column;
}

.apf-property-image {
    position: relative;
    height: 100%;
    overflow: hidden;
}

.apf-property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apf-property-price-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 0.9);
    padding-left: var(--wp--preset--spacing--40);
    padding-right: var(--wp--preset--spacing--40);
    height: 3.5rem;
}

.apf-price-main {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--primary-color);
}

.apf-currency {
    text-transform: uppercase;
}

.apf-price-per-m {
    display: flex;
    gap: 5px;
    align-items: center;
    font-size: var(--wp--preset--font-size--s);
}

.apf-property-details-content {
    flex-grow: 1;
    padding-top: var(--wp--preset--spacing--50);
    padding-bottom: var(--wp--preset--spacing--50);
    padding-left: var(--wp--preset--spacing--40);
    padding-right: var(--wp--preset--spacing--40);
    row-gap: var(--wp--preset--spacing--40);
}

.apf-property-title {
    font-family: "Oranienbaum", serif;
    font-weight: 700 !important;
    margin: 0 0 10px;
    line-height: 1.3;
}

:root body h2.apf-property-title {
    font-family: Oranienbaum !important;
    font-weight: 700 !important;
}

.apf-property-location {
    margin: 0 0 20px;
}

.apf-property-specs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
}

.apf-property-spec-item {
    display: flex;
    justify-content: space-between;
    line-height: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    font-size: var(--wp--preset--font-size--s) !important;
}

.apf-property-details-link {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: auto;
    height: 3.5rem;
}

.apf-property-details-link:hover {
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
}

/* Pagination */
.apf-pagination-container {
    margin-block: 40px;
    display: flex;
    justify-content: center;
}

.apf-pagination {
    display: flex;
    gap: 5px;
}

.apf-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: white;
    border: 1px solid rgba(0,0,0,0.1);
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.apf-page-link:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.apf-page-link.current {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    cursor: default;
}

.apf-page-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.apf-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

/* No results */
.apf-no-results {
    grid-column: 1 / -1;
    text-align: center;
    background-color: #f5f5f5;
    border: 1px solid rgba(0,0,0,0.1);
    align-items: center;
    display: flex;
    justify-content: center;
}

/* Select wrapper */
.apf-select-wrapper {
    position: relative;
    width: 100%;
}

.apf-input,
.apf-button,
.apf-select {
    padding: .75rem 2rem;
    width: fit-content;
    font-size: var(--wp--preset--font-size--r);
}

.apf-input::placeholder {
   font-size: var(--wp--preset--font-size--r);
}

/* Mobile responsive styles */
@media (max-width: 991px) {
    .apf-properties-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .apf-filter-fields {
        flex-direction: column;
        gap: 10px;
    }
    
    .apf-filter-field {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .apf-select, 
    .apf-input,
    .apf-button {
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .apf-properties-container {
        padding: 0 15px;
    }
    
    .apf-advanced-filters {
        width: 100%;
        max-width: 100%;
        padding: 0 15px;
    }
}

@media (max-width: 767px) {
    .apf-property-card-inner {
        flex-direction: column;
    }
    
    .apf-property-image-section, 
    .apf-property-details-section {
        width: 100%;
    }
    
    .apf-property-image {
        aspect-ratio: 4/3;
        height: auto;
    }

    .apf-filter-row-inputs {
        width: 100%;
    }
    
    .apf-property-specs {
        grid-template-columns: 1fr;
    }
    
    .apf-filter-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .apf-filter-row-label {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .apf-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 0 15px;
    }
    
    .apf-orderby {
        width: 100%;
    }
    
    .apf-range-inputs {
        flex-wrap: wrap;
    }
    
    .apf-input {
        font-size: 16px;
    }
}

/* Small mobile specific styles */
@media (max-width: 575px) {
    .apf-property-card {
        margin-bottom: 15px;
    }
    
    .apf-property-title {
        font-size: 18px;
    }
    
    .apf-property-details-content {
        padding: 15px;
    }
    
    .apf-pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}

.apf-location-search-wrapper {
    position: relative;
}

.apf-location-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #ccc;
    border-top: none;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.apf-location-item {
    padding: 10px;
    cursor: pointer;
}

.apf-location-item:hover {
    background-color: #f0f0f0;
}

.apf-no-results {
    padding: 10px;
    color: #888;
}
