/* Advanced Property Search - Modern Frontend Styles */

.aps-search-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 100%;
    margin: 0 auto;
}

/* No Configuration Message */
.aps-no-config {
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    margin: 20px 0;
}

/* Modern Filters Container with bold colors */
.aps-filters-container {
    background-color: #2a4555;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
}

.aps-main-filters {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 0;
}

/* Special layout for offer type with inline filter button */
.aps-offer-type-group {
    grid-column: 1 / -2; /* Span all columns except last (FIND button) */
}

/* Standalone filter button container */
.aps-filter-button-only {
    display: flex;
    align-items: center;
}

.aps-offer-type-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.aps-filter-field {
    position: relative;
}

/* Find button field should align with center in row layout */
.aps-filter-field:has(.aps-btn-find) {
    display: flex;
    align-items: center;
}

/* Field Label */
.aps-field-label {
    display: block;
    color: #d4a574;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: none;
    letter-spacing: 0.3px;
}

/* Offer Type and Property Type labels should be lighter orange-grey */
.aps-filter-field[data-field="offer_type"] .aps-field-label,
.aps-filter-field[data-field="property_type"] .aps-field-label {
    color: #d4a574;
}

/* Modern Input Styling */
.aps-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.aps-input-wrapper .aps-icon {
    position: absolute;
    left: 12px;
    font-size: 18px;
    pointer-events: none;
}

.aps-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dddddd;
    border-radius: 8px;
    font-size: 14px;
    background-color: #ffffff;
    color: #333333;
    transition: all 0.3s ease;
}

.aps-input::placeholder {
    color: #999999;
}

.aps-input:focus {
    outline: none;
    border-color: #d4602a;
    box-shadow: 0 0 0 3px rgba(212, 96, 42, 0.1);
}

/* Search Field Styling - Match Reference Design */
.aps-search-field-wrapper {
    flex: 1 1 auto; /* Grow to fill remaining space */
    margin-bottom: 0;
}

/* Fixed-size elements beside growing search field */
.aps-filter-button-only,
.aps-find-container {
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    .aps-main-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .aps-filter-button-only,
    .aps-find-container,
    .aps-property-count-wrapper {
        width: 100%;
    }
    
    .aps-property-count {
        min-width: auto;
        width: 100%;
    }
}

.aps-search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.aps-search-icon {
    position: absolute;
    left: 18px;
    color: #666666;
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
}

.aps-search-input {
    flex: 1;
    padding: 14px 16px 14px 50px; /* Left padding for icon, no right padding needed */
    border: none;
    background: transparent;
    font-size: 14px;
    color: #333333;
    border-radius: 8px;
    width: 100%;
}

.aps-search-input:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

.aps-search-input::placeholder {
    color: #999999;
}

/* Removed divider and dropdown icon - not needed */

.aps-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dddddd;
    border-radius: 8px;
    font-size: 14px;
    background-color: #ffffff;
    color: #333333;
    cursor: pointer;
    appearance: none;
    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='%23d4602a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    transition: all 0.3s ease;
}

.aps-select:focus {
    outline: none;
    border-color: #d4602a;
    box-shadow: 0 0 0 3px rgba(212, 96, 42, 0.1);
}

/* Number Range */
.aps-number-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Number chips group styling */
.aps-number-chips {
    background: transparent;
    padding: 0;
}

.aps-number-chips .aps-field-label {
    color: #333333;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 14px;
}

.aps-number-chips-container {
    background: #ffffff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #dddddd;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Modern Checkbox & Radio Styling */
.aps-checkbox-group,
.aps-radio-group {
    background: transparent;
    padding: 0;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.aps-buttons-group {
    background: transparent;
    padding: 0;
}

.aps-checkbox-group .aps-field-label,
.aps-radio-group .aps-field-label {
    color: #333333;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 14px;
    text-transform: none;
    letter-spacing: normal;
    width: 100%;
}

.aps-field-label i {
    font-size: 18px;
    color: #666;
}

/* Buttons container for chips */
.aps-buttons-container,
.aps-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aps-buttons-group .aps-buttons-container {
    background: #ffffff;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* When label is hidden, buttons should still look good */
.aps-filter-field[data-field="offer_type"] .aps-buttons-container,
.aps-filter-field[data-field="property_type"] .aps-buttons-container {
    background: #ffffff;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
    width: 100%;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.aps-checkbox-item,
.aps-radio-item,
.aps-button-item,
.aps-chip-item {
    display: inline-flex;
    margin: 0;
    padding: 0;
    cursor: pointer;
    position: relative;
    align-items: center;
}

/* Hide default input */
.aps-checkbox-item input,
.aps-radio-item input,
.aps-button-item input,
.aps-chip-item input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    appearance: none;
}

/* Style the span as the button - Regular buttons */
.aps-button-item span.aps-button-label,
.aps-chip-item span.aps-chip-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    color: #333333;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    user-select: none;
    text-align: center;
    white-space: nowrap;
    min-width: 80px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Number chips - Circular style */
.aps-number-chip .aps-chip-label {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    background-color: #ffffff;
    border: 2px solid #e0e0e0;
    color: #333333;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
}

/* Hover State */
.aps-button-item:hover .aps-button-label,
.aps-chip-item:hover .aps-chip-label,
.aps-number-chip:hover .aps-chip-label {
    background-color: #f5f5f5;
    border-color: #d4602a;
    color: #d4602a;
}

/* Checked State - Regular buttons */
.aps-button-item input:checked + .aps-button-label,
.aps-chip-item input:checked + .aps-chip-label {
    background-color: #2e7d4e;
    color: #ffffff;
    border-color: #2e7d4e;
    box-shadow: 0 2px 8px rgba(46, 125, 78, 0.3);
}

/* Checked State - Number chips */
.aps-number-chip input:checked + .aps-chip-label {
    background-color: #ffffff;
    border: 2px solid #2ecc71;
    color: #2ecc71;
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}

/* Legacy support for old class names */
.aps-checkbox-item span,
.aps-radio-item span {
    display: inline-block;
    padding: 10px 20px;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #333333;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    user-select: none;
    text-align: center;
    white-space: nowrap;
}

.aps-checkbox-item:hover span,
.aps-radio-item:hover span {
    background-color: #e0e0e0;
    color: #d4602a;
}

.aps-checkbox-item input:checked+span,
.aps-radio-item input:checked+span {
    background-color: #d4602a;
    color: #ffffff;
    border-color: #d4602a;
    box-shadow: 0 2px 6px rgba(212, 96, 42, 0.3);
}

/* Modern Find Button - Orange/Gold */
.aps-btn-find {
    padding: 16px 40px;
    background-color: #d4602a;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 3px 10px rgba(212, 96, 42, 0.4);
    min-height: 56px;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aps-btn-find:hover {
    background-color: #c2521d;
    box-shadow: 0 4px 14px rgba(212, 96, 42, 0.5);
    transform: translateY(-1px);
}

.aps-btn-find:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(212, 96, 42, 0.4);
}

/* Selected Filters */
.aps-selected-filters {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.aps-selected-filters-label {
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
}

.aps-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.aps-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background-color: #d4602a;
    color: #ffffff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(212, 96, 42, 0.2);
}

.aps-filter-tag-remove {
    padding: 0 !important;
    font-size: 20px !important;
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #ffffff;
    cursor: pointer;
    line-height: 1;
    margin: 0 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.aps-filter-tag-remove:hover {
    opacity: 1;
    transform: none;
}

/* Find Container */
.aps-find-container {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

/* Property Count Display */
.aps-property-count-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.aps-property-count {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    min-width: 140px;
    justify-content: center;
}

.aps-count-label {
    color: #d4a574;
    font-weight: 500;
}

.aps-count-number {
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    min-width: 40px;
    text-align: center;
}

/* Filters Icon Button - Inline with offer type buttons */
.aps-filter-icon-btn-inline {
    width: 48px;
    height: 48px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 0;
    flex-shrink: 0;
    margin: 0;
}

.aps-filter-icon-btn-inline:hover {
    background-color: #f5f5f5;
    border-color: #d4a574;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.aps-filter-icon-btn-inline:active {
    transform: translateY(0);
}

.aps-filter-icon-btn-inline .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #333333;
    line-height: 1;
}

.aps-filter-icon-btn-inline:hover .dashicons {
    color: #d4a574;
}

/* Modern Popup Modal Styling */
.aps-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aps-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

.aps-popup-content {
    position: relative;
    background-color: #ffffff;
    width: 90%;
    max-width: 750px;
    max-height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

/* Fullscreen popup on mobile */
@media (max-width: 768px) {
    .aps-popup-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

.aps-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #1a3a4a 0%, #2d4a5a 100%);
    border-radius: 12px 12px 0 0;
}

.aps-popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

.aps-popup-close {
    font-size: 45px !important;
    font-weight: 100 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    height: auto !important;
    width: auto !important;
    line-height: 1 !important;
    cursor: pointer;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    opacity: 0.8;
}

.aps-popup-close:hover {
    opacity: 1;
    transform: none;
}

.aps-popup-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.aps-popup-section {
    margin-bottom: 28px;
}

.aps-popup-section:last-child {
    margin-bottom: 0;
}

.aps-popup-section h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 700;
    color: #333333;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Popup Footer */
.aps-popup-footer {
    padding: 20px 24px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #f9f9f9;
}

.aps-popup-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #333333;
}

.aps-popup-count .aps-count-label {
    color: #666666;
    font-weight: 500;
}

.aps-popup-count .aps-count-number {
    color: #d4602a;
    font-weight: 700;
    font-size: 18px;
    min-width: 50px;
    text-align: left;
}

.aps-popup-actions {
    display: flex;
    gap: 12px;
}

.aps-btn-reset,
.aps-btn-filter {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aps-btn-reset {
    background-color: #f0f0f0;
    color: #666666;
}

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

.aps-btn-filter {
    background-color: #d4602a;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(212, 96, 42, 0.3);
}

.aps-btn-filter:hover {
    background-color: #c2521d;
    box-shadow: 0 4px 12px rgba(212, 96, 42, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .aps-filters-container {
        padding: 24px;
    }

    .aps-main-filters {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .aps-popup-content {
        width: 95%;
        max-height: 95vh;
    }

    .aps-popup-header,
    .aps-popup-body,
    .aps-popup-footer {
        padding: 16px;
    }
    
    .aps-popup-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .aps-popup-count {
        justify-content: center;
        margin-bottom: 12px;
    }
    
    .aps-popup-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .aps-popup-actions .aps-btn-reset,
    .aps-popup-actions .aps-btn-filter {
        flex: 1;
    }

    .aps-number-range {
        grid-template-columns: 1fr;
    }

    .aps-filter-tags {
        gap: 8px;
    }

    .aps-btn-find {
        padding: 14px 24px;
        font-size: 15px;
    }
    
    .aps-offer-type-group {
        grid-column: 1 / -1; /* Full width on mobile */
    }
    
    .aps-find-container {
        grid-column: 1 / -1; /* Full width on mobile */
        justify-content: stretch;
    }
    
    .aps-btn-find {
        width: 100%;
        min-width: auto;
        padding: 14px 24px;
        font-size: 15px;
    }
    
    .aps-filter-icon-btn-inline {
        width: 44px;
        height: 44px;
    }
    
    .aps-filter-icon-btn-inline .dashicons {
        font-size: 18px;
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .aps-filters-container {
        padding: 15px;
        border-radius: 6px;
    }

    .aps-main-filters {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .aps-input,
    .aps-select,
    .aps-btn-find {
        padding: 10px 12px;
        font-size: 14px;
    }

    .aps-popup-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 12px 12px 0 0;
    }

    .aps-filter-tag {
        padding: 6px 10px;
        font-size: 12px;
    }
}