/**
 * WPL Property Search Widget Styles
 */

/* Main Wrapper */
.wpl-property-search-wrapper {
    width: 100%;
    max-width: 100%;
}

/* Search Form Container */
.wpl-property-search-form {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Form Title */
.wpl-search-title {
    font-size: 28px;
    font-weight: 700;
    color: #333333;
    margin: 0 0 20px 0;
    text-align: center;
}

/* Search Form */
.wpl-search-form {
    width: 100%;
}

/* Search Fields Container - Grid Layout (Default) */
.wpl-search-fields.wpl-layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Search Fields Container - Horizontal Layout */
.wpl-search-fields.wpl-layout-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.wpl-layout-horizontal .wpl-search-field {
    flex: 1 1 auto;
    min-width: 150px;
    max-width: 250px;
}

/* Horizontal layout - hide labels on larger screens, use placeholders */
.wpl-layout-horizontal .wpl-search-field label {
    font-size: 12px;
    margin-bottom: 5px;
}

/* Horizontal layout - adjust button positioning */
.wpl-layout-horizontal + .wpl-search-button-wrapper {
    margin-top: 0;
}

/* Search Fields Container - Filter Bar Layout */
.wpl-search-fields.wpl-layout-filter-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 0;
    align-items: center;
}

.wpl-layout-filter-bar .wpl-search-field {
    flex: 1 1 auto;
    min-width: 150px;
    max-width: 200px;
}

/* Filter bar - no labels, use placeholders */
.wpl-layout-filter-bar .wpl-search-field label {
    display: none;
}

/* Filter bar - adjust select styling */
.wpl-layout-filter-bar .wpl-search-field select,
.wpl-layout-filter-bar .wpl-search-field input {
    height: 42px;
    font-size: 13px;
}

/* Filter bar button wrapper inline */
.wpl-layout-filter-bar + .wpl-search-button-wrapper {
    display: inline-flex;
    margin: 0;
    vertical-align: top;
}

/* Icon button for filter bar */
.wpl-search-submit.wpl-icon-button {
    min-width: 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.wpl-search-submit.wpl-icon-button:hover {
    transform: none;
}

.wpl-search-icon {
    display: block;
}

/* Select2 customization for filter bar */
.wpl-layout-filter-bar .select2-container {
    min-width: 150px;
    max-width: 200px;
}

.wpl-layout-filter-bar .select2-container .select2-selection--multiple {
    min-height: 42px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
}

.wpl-layout-filter-bar .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #0073aa;
    border-color: #005a87;
    color: #fff;
    padding: 2px 8px;
    font-size: 12px;
}

.wpl-layout-filter-bar .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    margin-right: 5px;
}

.wpl-layout-filter-bar .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff;
}

/* Individual Field */
.wpl-search-field {
    display: flex;
    flex-direction: column;
}

.wpl-search-field label {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 8px;
    display: block;
}

.wpl-search-field input,
.wpl-search-field select {
    width: 100%;
    padding: 12px 15px;
    font-size: 14px;
    color: #333333;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.wpl-search-field input:focus,
.wpl-search-field select:focus {
    outline: none;
    border-color: #0073aa;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

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

/* Select Arrow Styling */
.wpl-search-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 40px;
}

/* Button Wrapper */
.wpl-search-button-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Submit Button */
.wpl-search-submit {
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background-color: #0073aa;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wpl-search-submit:hover {
    background-color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.wpl-search-submit:active {
    transform: translateY(0);
}

.wpl-search-submit:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Loading State */
.wpl-search-submit.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.wpl-search-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: wpl-spin 0.8s linear infinite;
}

@keyframes wpl-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Results Container */
.wpl-search-results {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.wpl-search-results.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
}

.wpl-results-count {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 20px;
}

/* Results Grid */
.wpl-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* Property Card */
.wpl-property-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.wpl-property-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.wpl-property-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.wpl-property-image-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 16px;
}

.wpl-property-content {
    padding: 20px;
}

.wpl-property-title {
    font-size: 18px;
    font-weight: 700;
    color: #333333;
    margin: 0 0 10px 0;
}

.wpl-property-location {
    font-size: 14px;
    color: #666666;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.wpl-property-location::before {
    content: '📍';
    margin-right: 5px;
}

.wpl-property-price {
    font-size: 20px;
    font-weight: 700;
    color: #0073aa;
    margin: 10px 0;
}

.wpl-property-meta {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    color: #666666;
}

.wpl-property-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wpl-property-link {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background-color: #0073aa;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.wpl-property-link:hover {
    background-color: #005a87;
}

/* No Results */
.wpl-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
    font-size: 16px;
}

.wpl-no-results-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Error Message */
.wpl-error-message {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 15px 20px;
    color: #856404;
    font-size: 14px;
    margin-top: 20px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .wpl-property-search-form {
        padding: 20px;
    }

    .wpl-search-title {
        font-size: 24px;
    }

    .wpl-search-fields.wpl-layout-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Horizontal layout becomes vertical on mobile */
    .wpl-search-fields.wpl-layout-horizontal {
        flex-direction: column;
        gap: 15px;
    }

    .wpl-layout-horizontal .wpl-search-field {
        max-width: 100%;
        width: 100%;
    }

    /* Filter bar becomes vertical on mobile */
    .wpl-search-fields.wpl-layout-filter-bar {
        flex-direction: column;
        gap: 15px;
    }

    .wpl-layout-filter-bar .wpl-search-field {
        max-width: 100%;
        width: 100%;
    }

    .wpl-layout-filter-bar .wpl-search-field label {
        display: block;
    }

    .wpl-layout-filter-bar + .wpl-search-button-wrapper {
        display: flex;
        width: 100%;
    }

    .wpl-search-submit.wpl-icon-button {
        width: 100%;
    }

    .wpl-layout-filter-bar .select2-container {
        max-width: 100%;
        width: 100% !important;
    }

    .wpl-search-submit {
        width: 100%;
        padding: 12px 30px;
        font-size: 14px;
    }

    .wpl-results-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .wpl-property-search-form {
        padding: 15px;
    }

    .wpl-search-title {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .wpl-search-field label {
        font-size: 13px;
    }

    .wpl-search-field input,
    .wpl-search-field select {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Elementor Editor Styles */
.elementor-editor-active .wpl-property-search-form {
    min-height: 200px;
}

/* Accessibility */
.wpl-search-field input:focus-visible,
.wpl-search-field select:focus-visible,
.wpl-search-submit:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .wpl-search-form,
    .wpl-search-button-wrapper {
        display: none;
    }

    .wpl-search-results {
        border-top: none;
        margin-top: 0;
        padding-top: 0;
    }
}
