/* ============================================================
   MedaHomes Rental Availability Search — search.css
   ============================================================ */

:root {
    --mh-accent:      #2d6cdf;
    --mh-accent-dark: #1a52b3;
    --mh-radius:      10px;
    --mh-shadow:      0 4px 28px rgba(0,0,0,0.09);
    --mh-shadow-hover:0 10px 36px rgba(0,0,0,0.15);
    --mh-text:        #1a1a2e;
    --mh-muted:       #888;
    --mh-border:      #e4e4e4;
    --mh-bg:          #fafafa;
}

/* ── Wrap ─────────────────────────────────────────────────── */
#mh-rental-search-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: inherit;
}

/* ── Search Form ──────────────────────────────────────────── */
.mh-search-form {
    background: #fff;
    border-radius: var(--mh-radius);
    box-shadow: var(--mh-shadow);
    padding: 30px 36px;
    margin-bottom: 40px;
}

.mh-search-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--mh-text);
    margin: 0 0 22px 0;
}

.mh-search-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}

.mh-field-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
    min-width: 160px;
}

.mh-field-group label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--mh-muted);
}

.mh-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.mh-input-icon {
    position: absolute;
    left: 13px;
    color: var(--mh-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.mh-field-group input,
.mh-field-group select {
    border: 1.5px solid var(--mh-border);
    border-radius: 8px;
    padding: 11px 14px 11px 38px;
    font-size: 15px;
    color: var(--mh-text);
    background: var(--mh-bg);
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.mh-field-group input:focus,
.mh-field-group select:focus {
    border-color: var(--mh-accent);
    box-shadow: 0 0 0 3px rgba(45,108,223,0.12);
    background: #fff;
}

/* Select arrow */
.mh-field-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Search button */
.mh-field-btn {
    flex: 0 0 auto;
    min-width: auto;
}

#mh_search_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--mh-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
    white-space: nowrap;
    height: 46px;
    letter-spacing: 0.01em;
}

#mh_search_btn:hover  {
    background: var(--mh-accent-dark);
    box-shadow: 0 4px 16px rgba(45,108,223,0.30);
}
#mh_search_btn:active { transform: scale(0.97); }

/* ── Loading ──────────────────────────────────────────────── */
#mh-search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 56px 0;
    color: var(--mh-muted);
    font-size: 15px;
}

/* Ring spinner */
.mh-loader-ring {
    display: inline-block;
    position: relative;
    width: 48px;
    height: 48px;
}
.mh-loader-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 40px; height: 40px;
    margin: 4px;
    border: 4px solid var(--mh-border);
    border-radius: 50%;
    animation: mh-ring 1.1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--mh-accent) transparent transparent transparent;
}
.mh-loader-ring div:nth-child(1) { animation-delay: -0.45s; }
.mh-loader-ring div:nth-child(2) { animation-delay: -0.3s;  }
.mh-loader-ring div:nth-child(3) { animation-delay: -0.15s; }

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

/* ── Results ──────────────────────────────────────────────── */
#mh-search-results {
    animation: mh-fadein 0.35s ease;
}

@keyframes mh-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.mh-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f0f0f0;
}

.mh-results-summary {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

#mh-results-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--mh-text);
}

#mh-results-dates {
    font-size: 14px;
    color: var(--mh-muted);
}

/* ── Property Grid ────────────────────────────────────────── */
.mh-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* ── Property Card ────────────────────────────────────────── */
.mh-prop-card {
    border-radius: var(--mh-radius);
    overflow: hidden;
    box-shadow: var(--mh-shadow);
    background: #fff;
    transition: transform 0.22s, box-shadow 0.22s;
}

.mh-prop-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--mh-shadow-hover);
}

.mh-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.mh-card-thumb {
    position: relative;
    width: 100%;
    height: 210px;
    overflow: hidden;
    background: #f0f0f0;
}

.mh-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.mh-prop-card:hover .mh-card-thumb img {
    transform: scale(1.05);
}

.mh-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    background: #f5f5f5;
}

.mh-card-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mh-badge {
    background: var(--mh-accent);
    color: #fff;
    border-radius: 5px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mh-card-body {
    padding: 16px 20px 20px;
}

.mh-card-location {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--mh-muted);
    margin-bottom: 6px;
}

.mh-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--mh-text);
    margin: 0 0 10px 0;
    line-height: 1.35;
}

.mh-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.mh-card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #555;
}

.mh-card-price {
    font-size: 19px;
    font-weight: 700;
    color: var(--mh-accent);
    margin-bottom: 12px;
}

.mh-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mh-accent);
    letter-spacing: 0.02em;
    transition: gap 0.2s;
}

.mh-prop-card:hover .mh-card-cta {
    gap: 8px;
}

/* ── Empty State ──────────────────────────────────────────── */
#mh-no-results {
    display: flex;
}

.mh-empty-state {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 24px;
    color: var(--mh-muted);
}

.mh-empty-state h3 {
    font-size: 20px;
    color: var(--mh-text);
    margin: 16px 0 8px;
}

.mh-empty-state p {
    font-size: 15px;
    margin: 0;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 680px) {
    .mh-search-form    { padding: 22px 18px; }
    .mh-field-group    { min-width: 100%; }
    .mh-field-btn      { min-width: 100%; }
    #mh_search_btn     { width: 100%; }
    .mh-results-grid   { grid-template-columns: 1fr; }
}

/* ── Results Page ─────────────────────────────────────────── */
.mh-results-summary-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background: #fff;
    border: 1.5px solid var(--mh-border);
    border-radius: var(--mh-radius);
    padding: 14px 20px;
    margin-bottom: 28px;
    font-size: 14px;
}

.mh-summary-item {
    color: var(--mh-text);
    font-weight: 600;
}

.mh-summary-edit {
    margin-left: auto;
    color: var(--mh-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.mh-summary-edit:hover { text-decoration: underline; }

.mh-results-header {
    margin-bottom: 20px;
}

#mh-results-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--mh-text);
}

#mh-results-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 60px 0;
    color: var(--mh-muted);
    font-size: 15px;
}

/* ── Results summary bar (shown above Houzez native listing) ── */
.mh-results-summary-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background: #fff;
    border: 1.5px solid var(--mh-border);
    border-radius: var(--mh-radius);
    padding: 13px 20px;
    margin-bottom: 24px;
    font-size: 14px;
}

.mh-summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--mh-text);
    font-weight: 600;
}

.mh-summary-edit {
    margin-left: auto;
    color: var(--mh-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.mh-summary-edit:hover { text-decoration: underline; }

/* Loading overlay on search form */
#mh-search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 0 8px;
    color: var(--mh-muted);
    font-size: 14px;
}


/* ── Results page summary bar ── */
}

.mh-results-summary-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background: #fff;
    border: 1.5px solid #e4e4e4;
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 24px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}
.mh-summary-item { display: flex; align-items: center; gap: 6px; color: #1a1a2e; font-weight: 600; }
.mh-summary-edit { margin-left: auto; color: #2d6cdf; text-decoration: none; font-weight: 600; font-size: 13px; }
.mh-summary-edit:hover { text-decoration: underline; }

/* ── Compact search form on results page ── */
.mh-results-search-wrap .mh-search-form--compact {
    padding: 20px 24px;
    margin-bottom: 28px;
    border-radius: 8px;
}
.mh-results-search-wrap .mh-search-title {
    display: none; /* hide title on results page - context is clear */
}

/* ── Results page uses Houzez native Bootstrap grid — no overrides needed ── */
/* Pagination now uses inline styles — see class-shortcode.php */
/* ── Extra filter fields row (City / Type / Price) ── */
.mh-search-fields--extra {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eee;
}

.mh-search-fields--extra .mh-field-group input[type="number"] {
    border: 1.5px solid var(--mh-border, #e4e4e4);
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 15px;
    color: var(--mh-text, #1a1a1a);
    background: var(--mh-bg, #fafafa);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.mh-search-fields--extra .mh-field-group input[type="number"]:focus {
    border-color: var(--mh-accent, #2d6cdf);
    background: #fff;
}

/* ── Custom dropdown (City / Property Type) — reuses Houzez bootstrap-select classes ── */
/* Minimal rules only: Houzez's own theme CSS styles .btn.dropdown-toggle,
   .filter-option, .dropdown-menu, .dropdown-item etc. We only need to
   handle show/hide since we're not running real Bootstrap JS. */
.mh-custom-dropdown {
    position: relative;
}

.mh-custom-dropdown .mh-dropdown-toggle {
    width: 100%;
    text-align: left;
    text-transform: none !important;
}

.mh-custom-dropdown .dropdown-menu.mh-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    z-index: 50;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.mh-custom-dropdown .dropdown-menu.mh-dropdown-panel.show {
    display: block;
}

/* Safety net: ensure the option list itself is always visible when the
   panel is open, regardless of any Bootstrap .dropdown-menu default
   display:none rules that might apply to nested elements. */
.mh-custom-dropdown .mh-dropdown-panel .inner {
    display: block !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.mh-custom-dropdown .mh-dropdown-panel .inner li {
    list-style: none;
    margin: 0;
}

.mh-custom-dropdown .mh-dropdown-panel .dropdown-item {
    position: relative; /* so the theme's absolutely-positioned checkmark icon aligns correctly */
    display: block;
    width: 100%;
    padding: 10px 40px 10px 16px; /* right padding leaves room for the checkmark */
    line-height: 1.4;
    font-size: 14px;
    color: #333;
    clear: both;
    white-space: nowrap;
    cursor: pointer;
    box-sizing: border-box;
}

.mh-custom-dropdown .mh-dropdown-panel .dropdown-item .text {
    text-transform: none !important;
    font-size: 14px;
}

.mh-custom-dropdown .mh-dropdown-panel .dropdown-item:hover {
    background: #eaf2ff;
}

.mh-custom-dropdown .mh-dropdown-panel .dropdown-item.selected {
    font-weight: 700;
}

/* Explicitly control checkmark position rather than relying on the
   theme's own absolute-positioning values, which assume different row
   dimensions than our compact layout. */
.mh-custom-dropdown .mh-dropdown-panel .check-mark {
    position: absolute !important;
    right: 14px !important;
    top: 50% !important;
    left: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    display: inline-block;
    line-height: 1;
}

.mh-custom-dropdown .mh-dropdown-option {
    cursor: pointer;
}

.mh-custom-dropdown .mh-dropdown-option .check-mark {
    display: none;
}

.mh-custom-dropdown .mh-dropdown-option.selected .check-mark {
    display: inline-block;
}

/* ============================================================
   Rent / Buy tabs  —  [medahomes_search_tabs]
   Tabs sit on top of the card (Houzez demo style)
   ============================================================ */
.mh-tabs {
    max-width: 1200px;
    margin: 0 auto 40px;
    padding: 0 16px;
}
.mh-tabs-card {
    position: relative;
    background: #fff;
    border-radius: var(--mh-radius);
    box-shadow: var(--mh-shadow);
    padding: 28px 36px 30px;
}
.mh-tabs--left .mh-tabs-card { border-top-left-radius: 0; }

.mh-tabs-nav {
    display: flex;
    gap: 3px;
    justify-content: center;
}
.mh-tabs--left .mh-tabs-nav { justify-content: flex-start; }

.mh-tab-btn {
    position: relative;
    background: var(--mh-tab-bg, var(--mh-accent));
    color: var(--mh-tab-text, #fff);
    border: none;
    border-radius: 6px 6px 0 0;
    padding: 13px 30px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background .18s, color .18s;
}
.mh-tab-btn:hover { background: var(--mh-tab-hover-bg, var(--mh-accent-dark)); }
.mh-tab-btn.is-active,
.mh-tab-btn.is-active:hover {
    background: var(--mh-tab-active-bg, #fff);
    color: var(--mh-tab-active-text, var(--mh-accent));
}
.mh-tab-btn.is-active::after {          /* accent line under the active tab */
    content: "";
    position: absolute;
    left: 12px; right: 12px; bottom: 0;
    height: 3px;
    background: var(--mh-tab-active-text, var(--mh-accent));
    border-radius: 2px;
}
.mh-tab-btn:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }

.mh-tab-panel           { display: none; }
.mh-tab-panel.is-active { display: block; }
.mh-tab-panel > .mh-search-title { margin: 0 0 20px; }

/* Rental form inside a tab: the tab card is the card */
.mh-tabs #mh-rental-search-wrap { padding: 0; max-width: none; }
.mh-tabs .mh-search-form        { box-shadow: none; padding: 0; margin: 0; border-radius: 0; background: transparent; }

/* Sale form */
.mh-sale-form .mh-search-fields--extra { margin-top: 14px; }
.mh-input-icon--text { font-size: 14px; font-weight: 600; line-height: 1; }

.mh-sale-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--mh-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    height: 46px;
    white-space: nowrap;
    transition: background .18s, box-shadow .18s, transform .1s;
}
.mh-sale-btn:hover  { background: var(--mh-accent-dark); box-shadow: 0 4px 16px rgba(45,108,223,.30); }
.mh-sale-btn:active { transform: scale(.97); }

@media (max-width: 680px) {
    .mh-tabs-card        { padding: 22px 18px 24px; border-top-left-radius: 0; border-top-right-radius: 0; }
    .mh-tabs-nav         { justify-content: stretch; }
    .mh-tab-btn          { flex: 1; padding: 12px 8px; }
    .mh-sale-btn         { width: 100%; }
}
