/**
 * Morehouse Property Listings - Main Stylesheet
 * Self-contained CSS for property listings plugin
 */

/* CSS Variables for easy theming */
:root {
    /* Morehouse.es brand palette: burgundy and terracotta. */
    --mh-primary: #760804;
    --mh-primary-dark: #6b0000;
    --mh-primary-light: #f7e9e7;

    --mh-secondary: #bc4233;

    /* Functional colors */
    --mh-success: var(--wp--preset--color--success, #10b981);
    --mh-danger: var(--wp--preset--color--error, var(--wp--preset--color--danger, #ef4444));

    /* Backgrounds */
    --mh-bg: var(--wp--preset--color--background, #ffffff);
    --mh-bg-alt: var(--wp--preset--color--light-background, #f7f7f7);
    --mh-bg-hover: var(--wp--preset--color--extra-color-1, #f1f1f1);

    /* Borders & UI */
    --mh-border: var(--wp--preset--color--border, #e6e6e6);
    --mh-border-focus: var(--mh-primary-light);

    /* Text */
    --mh-text: var(--wp--preset--color--foreground, var(--wp--preset--color--text, #222222));
    --mh-text-muted: var(--wp--preset--color--tertiary, #666666);

    /* Shadows & Radius */
    --mh-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --mh-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --mh-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --mh-shadow-focus: 0 0 0 3px rgba(118, 8, 4, 0.18);

    --mh-radius: 12px;
    --mh-radius-sm: 8px;
    --mh-radius-xs: 6px;

    --mh-transition: 0.2s ease;
    --mh-transition-fast: 0.15s ease;
}

/* Reset for plugin elements */
.mh-listings-wrapper,
.mh-property-single {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--mh-text);
}

.mh-listings-wrapper *,
.mh-property-single * {
    box-sizing: border-box;
}

/* Some WordPress content editors insert line breaks into shortcode output.
   Keep those breaks from becoming extra lines or flex items inside controls. */
.mh-listings-wrapper button > br,
.mh-latest-wrapper button > br,
.mh-property-single button > br,
.mh-sticky-header button > br,
.mh-lightbox button > br,
.mh-btn > br,
.mh-filter-panel br {
    display: none;
}

:is(.mh-listings-header, .mh-search-box, .mh-view-toggle,
    .mh-filter-actions, .mh-button-group, .mh-pagination,
    .mh-pagination-info, .mh-latest-nav) > br {
    display: none;
}

:is(.mh-listings-header, .mh-search-box, .mh-view-toggle,
    .mh-filter-actions, .mh-button-group, .mh-pagination,
    .mh-pagination-info, .mh-latest-nav) > p,
.mh-filter-panel p {
    display: contents;
    margin: 0;
}

.mh-listings-wrapper :focus-visible,
.mh-latest-wrapper :focus-visible,
.mh-property-single :focus-visible,
.mh-sticky-header :focus-visible {
    outline: 2px solid var(--mh-primary);
    outline-offset: 3px;
}

/* SVG Reset - Ensure inline SVGs are always visible */
.mh-listings-wrapper svg,
.mh-property-single svg,
.mh-latest-wrapper svg {
    display: inline-block !important;
    visibility: visible !important;
    /* fill: currentColor; */
}

/* =================================
   Listings Header
================================= */
.mh-listings-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--mh-bg);
    border-radius: var(--mh-radius);
    box-shadow: var(--mh-shadow-md);
    border: 1px solid var(--mh-border);
}

/* Search Box */
.mh-search-box {
    flex: 1;
    min-width: 200px;
    max-width: 450px;
    display: flex;
    align-items: stretch;
    background: var(--mh-bg);
    border: 1.5px solid var(--mh-border);
    border-radius: var(--mh-radius-sm);
    overflow: hidden;
    transition: all var(--mh-transition-fast);
}

.mh-search-box:focus-within {
    border-color: var(--mh-primary);
}

.mh-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
    color: var(--mh-text);
}

.mh-search-input::placeholder {
    color: var(--mh-text-muted);
    font-weight: 400;
}

.mh-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.75rem 1.25rem;
    background: var(--mh-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: all var(--mh-transition);
}

.mh-search-btn svg,
.mh-filter-toggle svg {
    flex-shrink: 0;
}

.mh-search-btn:hover {
    background: var(--mh-primary-dark);
}

/* Filter Toggle Button */
.mh-filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--mh-bg);
    border: 1.5px solid var(--mh-border);
    border-radius: var(--mh-radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all var(--mh-transition);
    color: var(--mh-text);
}

.mh-filter-toggle:hover {
    background: var(--mh-bg-alt);
    border-color: var(--mh-primary);
    color: var(--mh-primary);
}

.mh-filter-toggle svg {
    transition: transform var(--mh-transition);
}

.mh-filter-toggle.active svg {
    transform: rotate(180deg);
}

.mh-results-count {
    margin-left: auto;
    color: var(--mh-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* =================================
   Listings Layout
================================= */
/* =================================
   Listings Layout
================================= */
.mh-listings-main {
    display: flex;
    /* gap: 1.5rem;  <-- Removed to prevent gap when filter hidden */
}

.mh-listings-content {
    flex: 1;
    min-width: 0;
    transition: flex 0.3s ease;
}

/* =================================
   View Toggle
 ================================= */
.mh-view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-right: 1.5rem;
    margin-left: auto;
}

.mh-view-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mh-bg);
    border: 1px solid var(--mh-border);
    border-radius: var(--mh-radius-sm);
    color: var(--mh-text-muted) !important;
    cursor: pointer;
    transition: all var(--mh-transition);
    flex-shrink: 0; /* Prevent button from shrinking */
}

.mh-view-btn svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
    display: block;
}

.mh-view-btn:hover {
    background: var(--mh-primary);
    border-color: var(--mh-primary);
    color: white !important;
}

.mh-view-btn.active {
    background: var(--mh-primary);
    border-color: var(--mh-primary);
    color: white !important;
}

/* =================================
   List View Layout (Desktop Only)
 ================================= */
@media (min-width: 769px) {
    .mh-layout-list .mh-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .mh-layout-list .mh-property-card {
        display: flex;
        flex-direction: row;
        height: auto;
        min-height: 280px; /* Increased height for description */
        align-items: stretch;
    }

    .mh-layout-list .mh-card-image {
        width: 50%; /* 50% width as requested */
        flex-shrink: 0;
        aspect-ratio: auto; /* Allow image to fill height */
        height: auto;
    }

    .mh-layout-list .mh-card-image img {
        height: 100%;
        object-fit: cover;
    }

    .mh-layout-list .mh-card-content {
        flex: 1; /* This will take the other 50% roughly, or use width: 50% explicitly */
        width: 50%;
        display: flex;
        flex-direction: column;
        padding: 1.5rem;
        justify-content: flex-start;
    }

    .mh-layout-list .mh-card-title {
        font-size: 1.35rem; /* Larger */
        color: var(--mh-primary);
        margin-bottom: 0.25rem;
        font-weight: 600;
        line-height: 1.3;
    }

    .mh-layout-list .mh-card-address {
        margin-bottom: 1rem;
        font-size: 0.95rem;
        color: var(--mh-text-muted);
    }

    .mh-layout-list .mh-card-price-block {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--mh-text);
        margin-bottom: 0.75rem;
    }

    .mh-layout-list .mh-card-features {
        margin-bottom: 1rem;
        display: flex;
        gap: 1rem;
        font-size: 0.95rem;
        color: var(--mh-text);
    }

    /* Description specific to list view */
    .mh-layout-list .mh-card-description {
        display: -webkit-box;
        -webkit-line-clamp: 4; /* Limit lines */
        line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
        color: var(--mh-text-muted);
        font-size: 0.95rem;
        line-height: 1.6;
        margin-top: auto; /* Push to bottom if space permits, or just after features */
    }
}

/* Hide view toggle on mobile */
@media (max-width: 768px) {
    .mh-view-toggle {
        display: none;
    }
}

/* =================================
   Filter Panel - Modern Design
================================= */
.mh-filter-panel {
    width: 320px;
    flex-shrink: 0;
    background: var(--mh-bg);
    border-radius: var(--mh-radius);
    box-shadow: var(--mh-shadow-lg);
    padding: 1.5rem;
    border: 1px solid var(--mh-border);
    position: sticky;
    top: 20px;
    align-self: flex-start;
    /* Hidden by default on desktop - slide from left */
    transform: translateX(-100%);
    margin-left: -320px;
    margin-right: 0; /* Default no gap */
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                margin 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                visibility 0.3s ease;
}

/* Filter panel open state - slides in */
.mh-filter-panel.open {
    transform: translateX(0);
    margin-left: 0;
    margin-right: 1.5rem; /* Add gap only when open */
    opacity: 1;
    visibility: visible;
}

/* Filter toggle active state */
.mh-filter-toggle.active {
    background: var(--mh-primary);
    border-color: var(--mh-primary);
    color: white;
    box-shadow: var(--mh-shadow-md), 0 0 0 2px var(--mh-primary-light);
}

.mh-filter-toggle.active:hover {
    background: var(--mh-primary-dark);
    border-color: var(--mh-primary-dark);
}

/* Filter Header */
.mh-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--mh-bg-alt);
}

.mh-filter-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--mh-text);
    letter-spacing: -0.025em;
}

.mh-filter-close {
    display: none;
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
    background: var(--mh-bg-alt);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--mh-text-muted);
    transition: all var(--mh-transition-fast);
    line-height: 1;
}

.mh-filter-close:hover {
    background: var(--mh-danger);
    color: white;
}

/* Filter Groups */
.mh-filter-group {
    margin-bottom: 1rem;
}

.mh-filter-group h4 {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Select Inputs */
.mh-filter-group select {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border: 1.5px solid var(--mh-border);
    border-radius: var(--mh-radius-xs);
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--mh-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: all var(--mh-transition-fast);
    box-sizing: border-box;
    color: var(--mh-text);
}

.mh-filter-group select:hover {
    border-color: var(--mh-border-focus);
}

.mh-filter-group select:focus {
    outline: none;
    border-color: var(--mh-primary);
    box-shadow: var(--mh-shadow-focus);
}

/* Range Inputs */
.mh-range-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mh-range-inputs input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 0.875rem;
    border: 1.5px solid var(--mh-border);
    border-radius: var(--mh-radius-xs);
    font-size: 0.875rem;
    font-weight: 500;
    box-sizing: border-box;
    transition: all var(--mh-transition-fast);
    color: var(--mh-text);
    background: var(--mh-bg);
}

.mh-range-inputs input:hover {
    border-color: var(--mh-border-focus);
}

.mh-range-inputs input:focus {
    outline: none;
    border-color: var(--mh-primary);
    box-shadow: var(--mh-shadow-focus);
}

.mh-range-inputs input::placeholder {
    color: var(--mh-text-muted);
    font-weight: 400;
}

.mh-range-sep {
    color: var(--mh-border);
    font-weight: 600;
    flex-shrink: 0;
}

/* Modern Checkboxes */
.mh-checkbox {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mh-text);
    padding: 0.125rem 0;
    line-height: 1.4;
    transition: color var(--mh-transition-fast);
}

.mh-checkbox:hover {
    color: var(--mh-primary);
}

.mh-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--mh-primary);
    border-radius: 4px;
}

/* Custom Checkbox Styling */
.mh-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 2px solid var(--mh-border);
    border-radius: var(--mh-radius-xs);
    background: var(--mh-bg);
    transition: all var(--mh-transition-fast);
    position: relative;
    flex-shrink: 0;
}

.mh-checkbox input[type="checkbox"]:hover {
    border-color: var(--mh-primary);
}

.mh-checkbox input[type="checkbox"]:checked {
    background: var(--mh-primary);
    border-color: var(--mh-primary);
}

.mh-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mh-checkbox input[type="checkbox"]:focus {
    box-shadow: var(--mh-shadow-focus);
}

/* Amenities Grid */
.mh-amenities-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.125rem;
}

/* Button Groups (Rooms/Bathrooms) */
.mh-button-group {
    display: flex;
    gap: 0;
    background: var(--mh-bg-alt);
    border-radius: var(--mh-radius-sm);
    padding: 4px;
}

.mh-button-group button {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--mh-text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--mh-transition-fast);
    border-radius: var(--mh-radius-xs);
}

.mh-button-group button:hover {
    color: var(--mh-primary);
    background: var(--mh-bg);
}

.mh-button-group button:first-child {
    border-radius: var(--mh-radius-xs);
}

.mh-button-group button:last-child {
    border-radius: var(--mh-radius-xs);
}

.mh-button-group button.active {
    background: var(--mh-primary);
    color: white;
    box-shadow: var(--mh-shadow);
}

/* Filter Actions */
.mh-filter-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--mh-bg-alt);
}

/* =================================
   Buttons - Modern Design
================================= */
.mh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--mh-radius-sm);
    cursor: pointer;
    transition: all var(--mh-transition);
    border: none;
    text-decoration: none;
}

.mh-btn-primary {
    background: var(--mh-primary);
    color: white !important; /* Force white text */
    box-shadow: var(--mh-shadow), 0 2px 4px rgba(118, 8, 4, 0.3);
}

.mh-btn-primary:visited,
.mh-btn-primary:active,
.mh-btn-primary:focus {
    color: white !important; /* Ensure visited state stays white */
    text-decoration: none;
}

.mh-btn-primary:hover {
    background: var(--mh-primary-dark);
    color: #ffffff !important;
    box-shadow: var(--mh-shadow-md), 0 4px 12px rgba(118, 8, 4, 0.35);
    transform: translateY(-1px);
    text-decoration: none;
}

.mh-btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--mh-shadow);
}

.mh-btn-secondary {
    background: var(--mh-bg);
    color: var(--mh-text) !important;
    border: 1.5px solid var(--mh-border);
}

.mh-btn-secondary:hover {
    background: var(--mh-bg-alt);
    border-color: var(--mh-primary);
    color: var(--mh-primary) !important;
}

.mh-filter-actions .mh-btn {
    flex: 1;
}

/* =================================
   Properties Grid
================================= */
.mh-grid {
    display: grid;
    gap: 1.5rem;
}

.mh-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.mh-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.mh-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Property Card */
.mh-property-card {
    background: var(--mh-bg);
    border-radius: var(--mh-radius);
    overflow: hidden;
    box-shadow: var(--mh-shadow);
    border: 1px solid var(--mh-border);
    transition: all var(--mh-transition);
    cursor: pointer;
}

.mh-property-card:hover {
    transform: none;
    box-shadow: 0 0 0 2px var(--mh-primary);
}

.mh-card-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--mh-bg-alt);
}

.mh-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--mh-transition);
}

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

.mh-card-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mh-badge {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.mh-badge-sale {
    background: var(--mh-primary);
    color: white;
}

.mh-badge-rent {
    background: var(--mh-secondary);
    color: white;
}

.mh-card-content {
    padding: 1rem;
}

.mh-card-ref {
    font-size: 0.75rem;
    color: var(--mh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.mh-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mh-card-address {
    font-size: 0.875rem;
    color: var(--mh-text-muted);
    margin: 0 0 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mh-card-features {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--mh-text-muted);
}

.mh-card-features span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.mh-card-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--mh-primary);
}

.mh-card-price-rent {
    font-size: 0.9rem;
    color: var(--mh-secondary);
    margin-left: 0.5rem;
}

/* When rent is the only price in card, use larger font */
.mh-card-price-block .mh-card-price-rent:only-child {
    font-size: 1.25rem;
    font-weight: 700;
    margin-left: 0;
}

/* =================================
   Loading & Empty States
================================= */
.mh-loading,
.mh-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--mh-text-muted);
}

.mh-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--mh-border);
    border-top-color: var(--mh-primary);
    border-radius: 50%;
    animation: mh-spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

.mh-empty svg {
    margin-bottom: 1rem;
    color: var(--mh-border);
}

.mh-empty p {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.mh-error {
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid var(--mh-danger);
    border-radius: var(--mh-radius-sm);
    color: var(--mh-danger);
}

/* Price Block - Grid View / General */
.mh-card-price-block {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--mh-text);
}

/* Description - Default hidden in grid */
.mh-card-description {
    display: none;
    font-size: 0.875rem;
    color: var(--mh-text-muted);
}

/* =================================
   Pagination
================================= */
.mh-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--mh-border);
}

.mh-pagination-info {
    font-size: 0.9rem;
    color: var(--mh-text-muted);
}

.mh-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =================================
   Responsive
================================= */
.mh-pagination button {
    color: var(--mh-text);
}

.mh-pagination button:hover {
    color: var(--mh-primary);
}

@media (max-width: 1024px) {
    .mh-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .mh-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .mh-filter-panel {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 380px;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 1000;
        transition: left var(--mh-transition);
        overflow-x: hidden;
        overflow-y: auto;
        box-sizing: border-box;
        padding: 2rem 1.5rem 1rem;
        /* Reset desktop transform/margin styles */
        transform: none;
        margin-left: 0;
        opacity: 1;
        visibility: visible;
    }

    .mh-filter-panel.open {
        left: 0;
    }

    .mh-filter-close {
        display: block;
    }

    .mh-filter-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .mh-filter-overlay.open {
        display: block;
    }
}

@media (max-width: 768px) {
    .mh-filter-panel {
        width: 85%;
        max-width: 360px;
        padding: 2rem 1.25rem 1rem;
    }

    .mh-filter-header h3 {
        font-size: 1.1rem;
    }

    .mh-filter-group {
        margin-bottom: 1rem;
    }

    .mh-filter-group h4 {
        font-size: 0.813rem;
    }

    /* Ensure inputs don't overflow */
    .mh-filter-group input,
    .mh-filter-group select {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Make button groups wrap better */
    .mh-button-group {
        flex-wrap: wrap;
    }

    .mh-button-group button {
        min-width: 55px;
        flex: 1 1 auto;
    }
}

@media (max-width: 640px) {
    .mh-listings-header {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
    }

    .mh-search-box {
        max-width: none;
        width: 100%;
    }

    .mh-results-count {
        margin-left: 0;
        text-align: center;
    }

    .mh-grid-3,
    .mh-grid-2,
    .mh-grid-4 {
        grid-template-columns: 1fr;
    }

    /* Filter panel mobile improvements */
    .mh-filter-panel {
        width: 90%;
        max-width: 340px;
        padding: 1.75rem 1rem 1rem;
    }

    .mh-filter-header {
        margin-bottom: 1rem;
        margin-top: 0;
        padding-bottom: 0.75rem;
    }

    .mh-filter-header h3 {
        font-size: 1.05rem;
    }

    .mh-filter-close {
        font-size: 2rem;
        line-height: 1;
        padding: 0;
        width: 32px;
        height: 32px;
    }

    .mh-filter-group {
        margin-bottom: 1rem;
    }

    .mh-filter-group h4 {
        font-size: 0.813rem;
        margin-bottom: 0.5rem;
        word-wrap: break-word;
    }

    /* Range inputs mobile - stack vertically */
    .mh-range-inputs {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .mh-range-inputs input {
        width: 100%;
        max-width: 100%;
        padding: 0.75rem;
        font-size: 1rem; /* Prevent zoom on iOS */
        box-sizing: border-box;
    }

    .mh-range-sep {
        display: none;
    }

    /* Select inputs */
    .mh-filter-group select {
        width: 100%;
        max-width: 100%;
        padding: 0.75rem;
        font-size: 1rem; /* Prevent zoom on iOS */
        box-sizing: border-box;
    }

    /* Checkboxes mobile */
    .mh-checkbox {
        margin: 0;
        padding: 0.125rem 0;
    }

    .mh-checkbox input {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .mh-checkbox span {
        font-size: 0.95rem;
        word-wrap: break-word;
    }

    /* Amenities grid mobile */
    .mh-amenities-grid {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    /* Button groups mobile */
    .mh-button-group {
        gap: 0.375rem;
        flex-wrap: wrap;
    }

    .mh-button-group button {
        padding: 0.625rem 0.5rem;
        font-size: 0.875rem;
        min-width: 50px;
        flex: 1 1 auto;
        box-sizing: border-box;
    }

    /* Filter actions mobile */
    .mh-filter-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
        padding: 1rem;
        margin: 1rem -1rem 0;
        position: sticky;
        bottom: 0;
        background: var(--mh-bg);
        border-top: 2px solid var(--mh-border);
        box-sizing: border-box;
    }

    .mh-filter-actions .mh-btn {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        box-sizing: border-box;
    }

    /* Filter toggle button mobile */
    .mh-filter-toggle {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        justify-content: center;
        width: 100%;
        box-sizing: border-box;
    }

    .mh-filter-toggle svg {
        width: 18px;
        height: 18px;
    }

    /* Search input mobile */
    .mh-search-input {
        padding: 0.75rem 1rem;
        font-size: 1rem; /* Prevent zoom on iOS */
        box-sizing: border-box;
    }

    .mh-search-btn {
        padding: 0.75rem 1rem;
        flex-shrink: 0;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .mh-filter-panel {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
    }

    .mh-listings-header {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .mh-button-group {
        gap: 0.25rem;
    }

    .mh-button-group button {
        font-size: 0.813rem;
        padding: 0.5rem 0.25rem;
        min-width: 42px;
    }

    .mh-filter-actions {
        padding: 0.75rem 1rem;
        margin: 1rem -1rem 0;
    }
}

/* =================================
   Latest Properties Carousel (FORMAT 1)
================================= */
.mh-latest-wrapper {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 3rem 0;
    position: relative;
}

/* Shortcode-controlled width/max-width */
.mh-latest-wrapper.mh-has-custom-width {
    width: var(--mh-shortcode-width, 100%);
}

.mh-latest-wrapper.mh-has-custom-max-width {
    max-width: var(--mh-shortcode-max-width, 100%);
}

/* Gutenberg-compatible alignment fallbacks (works even outside Group blocks) */
.mh-latest-wrapper.alignwide {
    max-width: var(--mh-shortcode-max-width, 1200px);
}

.mh-latest-wrapper.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    overflow-x: clip;
}

.mh-latest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.mh-latest-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--mh-text);
}

.mh-latest-nav {
    display: flex;
    gap: 0.5rem;
}

.mh-latest-nav-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mh-bg);
    border: 1px solid var(--mh-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--mh-transition);
    color: var(--mh-text);
}

.mh-latest-nav-btn svg {
    display: inline-block !important;
    visibility: visible !important;
    stroke: currentColor;
    color: inherit;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    flex-shrink: 0;
}

.mh-latest-nav-btn:hover:not(:disabled) {
    background: var(--mh-primary);
    border-color: var(--mh-primary);
    color: white;
}

.mh-latest-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mh-latest-carousel {
    overflow: hidden;
    position: relative;
    padding: 24px 12px; /* Allow space for hover expansion & shadows */
    margin: -24px -12px; /* Compensate for layout shift if needed, or just let it breathe */
}

.mh-latest-track {
    display: flex;
    gap: 1.5rem;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: stretch;
}

.mh-latest-card {
    flex: 0 0 calc(25% - 1.125rem);
    min-width: 220px;
    display: flex;
}



.mh-latest-card-link {
    display: flex;
    flex-direction: column;
    background: var(--mh-bg);
    border-radius: var(--mh-radius);
    overflow: hidden;
    box-shadow: var(--mh-shadow);
    text-decoration: none;
    color: inherit;
    transition: all var(--mh-transition);
    width: 100%;
    height: 100%;
}

.mh-latest-card-link:hover {
    transform: none;
    box-shadow: 0 0 0 2px var(--mh-primary);
}

.mh-latest-card-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--mh-bg-alt);
}

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

.mh-latest-card-link:hover .mh-latest-card-image img {
    transform: scale(1.08);
}

.mh-latest-card-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mh-latest-card-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.mh-latest-card-ref {
    display: block;
    font-size: 0.75rem;
    color: var(--mh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.mh-latest-card-title {
    margin: 0 0 0.375rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--mh-text);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mh-latest-card-address {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: var(--mh-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mh-latest-card-features {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--mh-text-muted);
}

.mh-feature-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.mh-feature-item svg {
    opacity: 0.6;
}

.mh-latest-card-price {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.mh-price-sale {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--mh-primary);
}

.mh-price-rent {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--mh-secondary);
}

/* When rent is the only price in latest carousel, use larger font */
.mh-latest-card-price .mh-price-rent:only-child {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Indicators (mobile) */
.mh-latest-indicators {
    display: none;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.mh-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mh-border);
    cursor: pointer;
    transition: all var(--mh-transition);
}

.mh-indicator.active {
    width: 24px;
    border-radius: 4px;
    background: var(--mh-primary);
}

/* Footer with View All button */
.mh-latest-footer {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
}

.mh-view-all-btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    gap: 0.5rem;
}

/* Empty state */
.mh-latest-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--mh-text-muted);
}

/* Responsive - Latest Carousel */
@media (max-width: 1024px) {
    .mh-latest-card {
        flex: 0 0 calc(33.333% - 1rem);
    }
}

@media (max-width: 768px) {
    .mh-latest-card {
        flex: 0 0 100%;
        min-width: 100%;
    }

    .mh-latest-track {
        gap: 0;
    }

    .mh-latest-carousel {
        padding: 12px 0;
        margin: -12px 0;
    }

    .mh-latest-nav-btn {
        width: 40px;
        height: 40px;
    }

    .mh-latest-indicators {
        display: flex;
    }

    .mh-latest-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 640px) {
    .mh-latest-wrapper {
        padding: 2rem 0;
    }

    .mh-latest-header {
        margin-bottom: 1.5rem;
    }

    .mh-latest-title {
        font-size: 1.25rem;
    }
}

/* Property type filter (grouped checkboxes) */
.mh-type-group-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mh-type-group-head .mh-checkbox {
    margin-bottom: 0;
}

.mh-type-toggle {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--mh-text);
}

.mh-type-toggle::before {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    border: solid currentColor;
    border-width: 2px 0 0 2px;
    transform: translateY(2px) rotate(45deg);
    transition: transform var(--mh-transition-fast);
}

.mh-type-toggle[aria-expanded="false"]::before {
    transform: translateY(-2px) rotate(225deg);
}

.mh-type-children {
    padding-left: 1.875rem;
    margin-bottom: 0.5rem;
}

.mh-checkbox input[type="checkbox"]:indeterminate {
    background: var(--mh-primary);
    border-color: var(--mh-primary);
}

.mh-checkbox input[type="checkbox"]:indeterminate::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 7px;
    width: 8px;
    border-top: 2px solid white;
}
