/**
 * RE/MAX Ultima Properties - Frontend CSS
 * Version: 1.2.0
 */

:root {
    --remax-primary: #0C2749;
    --remax-secondary: #e11b22;
    --remax-dark: #1a1a1a;
    --remax-gray: #666666;
    --remax-light-gray: #f5f5f5;
    --remax-border: #e0e0e0;
    --remax-white: #ffffff;
    --remax-radius: 12px;
    --remax-shadow: 0 2px 15px rgba(0,0,0,0.08);
    --remax-shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
}

/* =====================================================
   ARCHIVE PAGE STYLES
   ===================================================== */

.remax-archive-page {
    background: var(--remax-light-gray);
    padding: 60px 0;
    min-height: 60vh;
}

.remax-archive-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.remax-archive-header {
    text-align: center;
    margin-bottom: 40px;
}

.remax-archive-title {
    font-size: 42px;
    font-weight: 700;
    color: var(--remax-primary);
    margin: 0 0 15px 0;
    letter-spacing: 1px;
}

.remax-archive-subtitle {
    font-size: 18px;
    color: var(--remax-gray);
    margin: 0;
}

.remax-archive-filter {
    margin-bottom: 40px;
}

/* =====================================================
   FILTER FORM - MODERN DESIGN WITH SPACING
   ===================================================== */

.remax-filter-form {
    background: var(--remax-white);
    padding: 30px 35px;
    border-radius: var(--remax-radius);
    box-shadow: var(--remax-shadow);
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Main filter row - all items in single line */
.filter-row-main {
    flex-wrap: wrap;
    gap: 20px;
}

.filter-row-main .filter-field {
    flex: 1;
    min-width: 180px;
}

.filter-row-main .filter-buttons {
    display: flex;
    gap: 12px;
    flex: 0 0 auto;
}

.filter-field select,
.filter-field input[type="text"],
.filter-field input[type="number"] {
    width: 100%;
    padding: 16px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 15px;
    color: var(--remax-dark);
    background: var(--remax-white);
    transition: border-color 0.3s, box-shadow 0.3s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.filter-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
    cursor: pointer;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--remax-primary);
    box-shadow: 0 0 0 3px rgba(12, 39, 73, 0.1);
}

.filter-field input::placeholder {
    color: #999;
}

/* Buttons - Rounded Modern Style */
.remax-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 28px;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.remax-btn-search {
    flex: 1;
    background: var(--remax-primary);
    color: var(--remax-white);
}

.remax-btn-search:hover {
    background: #0a1f3a;
    transform: translateY(-2px);
}

.remax-btn-clear {
    flex: 1;
    background: var(--remax-light-gray);
    color: var(--remax-dark);
}

.remax-btn-clear:hover {
    background: var(--remax-border);
}

/* =====================================================
   PROPERTIES GRID - FULL WIDTH MATCH
   ===================================================== */

.remax-properties-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.remax-properties-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    width: 100%;
}

/* Responsive grid - FIXED: Match site breakpoints */
@media (max-width: 1024px) {
    .remax-properties-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .property-card-image {
        height: 200px;
    }
}

@media (max-width: 767px) {
    .remax-properties-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Keep same aspect ratio on mobile */
    .property-card-image {
        padding-bottom: 60%; /* Slightly shorter on mobile */
    }
    
    .property-card-content {
        padding: 15px;
    }
    
    .property-card-price {
        font-size: 16px;
    }
    
    .property-card-title {
        font-size: 18px !important;
        min-height: 47px;
        max-height: 47px;
    }
    
    .property-card-title a {
        font-size: 18px !important;
    }
}

/* =====================================================
   PROPERTY CARD - MATCHING THEME STYLE
   ===================================================== */

.remax-property-card {
    background: var(--remax-white);
    border-radius: var(--remax-radius);
    overflow: hidden;
    box-shadow: var(--remax-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.remax-property-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--remax-shadow-hover);
}

/* Card Image - ABSOLUTE POSITIONING for fixed height */
.property-card-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
    overflow: hidden;
    background: var(--remax-light-gray);
}

.property-card-image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.property-card-image img,
.property-card-image a img,
.remax-property-card .property-card-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: transform 0.5s ease;
}

.remax-property-card:hover .property-card-image img {
    transform: scale(1.05);
}

.property-card-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--remax-light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

/* Card Content */
.property-card-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Price */
.property-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--remax-primary);
    margin-bottom: 8px;
    line-height: 1;
}

/* Title - FIXED 18px */
.property-card-title {
    font-size: 18px !important;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 8px 0;
    min-height: 47px; /* 2 lines at 18px */
    max-height: 47px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.property-card-title a {
    color: var(--remax-dark);
    text-decoration: none;
    transition: color 0.3s;
    font-size: 18px !important;
}

.property-card-title a:hover {
    color: var(--remax-primary);
}

/* Location */
.property-card-location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--remax-gray);
    font-size: 14px;
    margin-bottom: 16px;
}

.location-icon {
    font-size: 14px;
    color: var(--remax-secondary);
}

/* Features */
.property-card-features {
    display: flex;
    gap: 20px;
    padding: 16px 0;
    border-top: 1px solid var(--remax-border);
    border-bottom: 1px solid var(--remax-border);
    margin-bottom: 16px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--remax-gray);
}

.feature-icon {
    font-size: 16px;
}

.feature-value {
    font-weight: 600;
    color: var(--remax-dark);
}

.feature-label {
    color: var(--remax-gray);
}

/* Button */
.property-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    background: var(--remax-primary);
    color: var(--remax-white) !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: auto;
}

.property-card-btn:hover {
    background: var(--remax-secondary);
    color: var(--remax-white) !important;
    transform: translateY(-2px);
}

/* =====================================================
   NO RESULTS
   ===================================================== */

.remax-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: var(--remax-white);
    border-radius: var(--remax-radius);
}

.remax-no-results p {
    color: var(--remax-gray);
    font-size: 18px;
    margin: 0;
}

/* =====================================================
   PAGINATION
   ===================================================== */

.remax-pagination-container {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.remax-pagination {
    display: flex;
    gap: 8px;
    align-items: center;
}

.remax-pagination a,
.remax-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 16px;
    background: var(--remax-white);
    color: var(--remax-dark);
    text-decoration: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: var(--remax-shadow);
}

.remax-pagination a:hover {
    background: var(--remax-primary);
    color: var(--remax-white);
}

.remax-pagination .page-link.active,
.remax-pagination .current {
    background: var(--remax-primary);
    color: var(--remax-white);
}

.remax-pagination ul {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.remax-pagination li {
    margin: 0;
}

/* =====================================================
   LOADING STATE
   ===================================================== */

.remax-properties-grid.loading {
    position: relative;
    pointer-events: none;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--remax-border);
    border-top-color: var(--remax-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* =====================================================
   RESPONSIVE FILTER - MODERN SPACING
   ===================================================== */

/* Tablet: 767px - 1024px */
@media (max-width: 1024px) {
    .filter-row-main {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .filter-row-main .filter-field {
        flex: 1 1 calc(50% - 10px);
        min-width: calc(50% - 10px);
    }
    
    .filter-row-main .filter-buttons {
        flex: 1 1 100%;
        justify-content: center;
        margin-top: 10px;
        gap: 15px;
    }
    
    .remax-filter-form {
        padding: 25px;
    }
}

/* Mobile: < 767px */
@media (max-width: 767px) {
    .remax-archive-title {
        font-size: 24px;
    }
    
    .remax-filter-form {
        padding: 20px;
    }
    
    .filter-row-main {
        gap: 12px;
    }
    
    .filter-row-main .filter-field {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .filter-field select,
    .filter-field input {
        padding: 14px 16px;
    }
    
    .filter-row-main .filter-buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 8px;
    }
    
    .remax-btn {
        width: 100%;
        padding: 14px 20px;
    }
    
    .property-card-features {
        gap: 12px;
        flex-wrap: wrap;
    }
    
    .feature-item {
        font-size: 13px;
    }
}

/* =====================================================
   ELEMENTOR WIDGET OVERRIDE
   ===================================================== */

.elementor-widget-remax_properties_grid .remax-properties-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.elementor-widget-remax_properties_grid.columns-2 .remax-properties-grid {
    grid-template-columns: repeat(2, 1fr);
}

.elementor-widget-remax_properties_grid.columns-4 .remax-properties-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* Tablet: 767px - 1024px */
@media (max-width: 1024px) {
    .elementor-widget-remax_properties_grid .remax-properties-grid,
    .elementor-widget-remax_properties_grid.columns-4 .remax-properties-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile: < 767px */
@media (max-width: 767px) {
    .elementor-widget-remax_properties_grid .remax-properties-grid,
    .elementor-widget-remax_properties_grid.columns-2 .remax-properties-grid,
    .elementor-widget-remax_properties_grid.columns-4 .remax-properties-grid {
        grid-template-columns: 1fr;
    }
}
