/**
 * @file live-search.css
 * @description Styles for the MLS Members Live Search front-end UI.
 * @package RealEstateMLS
 * @version 1.0.1
 */

/* Search Form Horizontal Layout */
.agent-search-form-horizontal {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1.5em;
}

/* Input + Select Styling */
.agent-search-form-horizontal input,
.agent-search-form-horizontal select {
    padding: 0.25em 0;
    font-size: 1em;
    height: 45px;
    line-height: 46px;
    width: 100%;
    box-sizing: border-box;
}

/* Make Select2 dropdown match input height */
.select2-container .select2-selection--single {
    height: 45px !important;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 1em;
    box-sizing: border-box;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: normal !important;
    padding-left: 0 !important;
}


/* Match Select2 to native select styling */
.select2-container--default .select2-selection--single {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    height: 45px;
    font-size: 1em;
    padding: 0 1em;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

/* Remove default Select2 arrow and use native-like arrow */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 50%;
    transform: translateY(-50%);
    right: 10px;
}

/* Ensure consistent text alignment */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 1.5;
    color: #333;
    padding: 0;
}


/* Grid Layout for Search and Sort Rows */
.search-row,
.sort-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1em;
    width: 100%;
    align-items: end;
}

/* Remove Clear Button */
.search-buttons {
    display: none;
}

/* Remove Clear button individual rules */
.search-buttons button {
    display: none;
}

/* Sort Labels */
.sort-row > div {
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}

/* Agent Card Grid */
.agent-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1em;
}

/* Agent Card Styling */
.agent-card {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    text-align: center;
    padding: 1em;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fafafa;
}

.agent-photo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
}

.agent-photo-wrapper img {
    width: 150px;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
}

.agent-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
}

.agent-info h3 {
    margin: 0.2em 0 0 0;
    font-size: 1.1em;
    padding-bottom: 10px;
}

.agent-info p {
    margin: 0.1em 0;
    font-size: 0.95em;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    margin-top: 2em;
    gap: 1em;
    flex-wrap: nowrap;
}

.pagination-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-links a,
.pagination-links span {
    padding: 6px 10px;
    border: 1px solid #ccc;
    text-decoration: none;
    border-radius: 4px;
    color: #333;
}

.pagination-links a:hover {
    background-color: #f0f0f0;
}

.pagination-links .current {
    background-color: #0073aa;
    color: white;
    font-weight: bold;
}

.pagination-links .disabled {
    color: #aaa;
    cursor: not-allowed;
    border: 1px dashed #ccc;
}

.pagination-links span.ellipsis {
    padding: 0 5px;
    font-size: 1.2em;
}

#results-per-page {
    width: 60px;
    padding: 0.3em;
    font-size: 0.95em;
}

/* Divider */
.divider {
    width: 100%;
    border: none;
    height: 1px;
    background-color: #ccc;
    margin: 20px 0 10px 0;
}

/* Spinner */
.spinner::after {
    content: '';
    width: 24px;
    height: 24px;
    display: inline-block;
    border: 4px solid #ccc;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 📱 Mobile Adjustments */
@media screen and (max-width: 768px) {
    .search-row,
    .sort-row {
        grid-template-columns: 1fr;
    }

    .pagination-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-controls .pagination-links {
        justify-content: center;
        margin-bottom: 1em;
    }

    .agent-results-grid {
        grid-template-columns: 1fr;
    }
}
