/**
 * HW Homefinder Frontend Styles
 * 
 * All styles are scoped under .hw-homefinder-wrapper to prevent
 * conflicts with theme styles.
 * 
 * @package HW_Homefinder
 * @since 1.0.0
 */

/* Color Variables (injected by WordPress via wp_add_inline_style) */
:root {
    --hwh-primary: #eba900;
    --hwh-secondary: #789c4a;
    --hwh-tertiary: #5c8cb4;
    --hwh-primary-dark: #d49800;
    --hwh-secondary-dark: #6a8a41;
    --hwh-tertiary-dark: #4a7a9e;
}

/* Scoped Reset & Base Styles */
.hw-homefinder-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hw-homefinder-wrapper *,
.hw-homefinder-wrapper *::before,
.hw-homefinder-wrapper *::after {
    box-sizing: border-box;
}

/* Utility Classes */
.hw-homefinder-wrapper .hidden {
    display: none !important;
}

/* Loading Spinner Overlay */
.hw-homefinder-wrapper .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hw-homefinder-wrapper .loading-spinner {
    background: white;
    padding: 40px 60px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.hw-homefinder-wrapper .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--hwh-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.hw-homefinder-wrapper .loading-spinner p {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 500;
}

/* Container */


        .hwh-container {
            max-width: 1400px;
            margin: 0 auto 100px auto;
        }

        .header {
            padding: 15px 0;
            margin-bottom: 20px;
        }

        .header h1 {
            color: #2d2d2d;
            font-size: 32px;
            margin-bottom: 10px;
        }

        .header p {
            color: #767676;
            font-size: 16px;
        }

        /* Email Capture Banner */
        .email-capture-banner {
            background: linear-gradient(135deg, var(--hwh-primary) 0%, var(--hwh-primary-dark) 100%);
            color: white;
            padding: 20px;
            border-radius: 12px;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 15px;
        }

        .email-capture-content {
            flex: 1;
        }

        .email-capture-content h3 {
            font-size: 18px;
            margin-bottom: 5px;
        }

        .email-capture-content p {
            font-size: 14px;
            opacity: 0.9;
        }

        .email-capture-form {
            display: flex;
            gap: 10px;
            flex: 1;
            max-width: 400px;
        }

        .email-capture-form input {
            flex: 1;
            padding: 12px;
            border: none;
            border-radius: 6px;
            font-size: 14px;
        }

        .email-capture-form button {
            padding: 12px 24px;
            background: white;
            color: var(--hwh-primary);
            border: none;
            border-radius: 6px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .email-capture-form button:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        }

        .version-toggle {
            display: flex;
            gap: 10px;
            margin-bottom: 30px;
            background: white;
            padding: 10px;
            border-radius: 12px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }

        .toggle-btn {
            flex: 1;
            padding: 15px;
            border: 2px solid #e0e0e0;
            background: white;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
            transition: all 0.3s ease;
        }

        .toggle-btn-form.active {
            background: var(--hwh-secondary);
            color: white;
            border-color: var(--hwh-secondary);
        }

        .toggle-btn-wizard.active {
            background: var(--hwh-tertiary);
            color: white;
            border-color: var(--hwh-tertiary);
        }

        .toggle-btn:hover:not(.active) {
            border-color: var(--hwh-primary);
            background: #fef9ed;
        }

        .search-container {
            background: white;
            padding: 40px;
            border-radius: 12px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            margin-bottom: 30px;
        }

        .form-section {
            display: none;
        }

        .form-section.active {
            display: block;
        }

        /* Form Styles - Default for wizard */
        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 25px;
            margin-bottom: 30px;
        }

        /* Wizard Step 1 - Force move-in date to new row */
        #panel-1 .form-grid .form-group:nth-child(4) {
            grid-column: 1 / -1;
            max-width: 400px;
        }

        /* Single Page Form - Custom 4 Column Layout */
        #single-form .form-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 25px;
        }

        /* Row 1: Listing Type | Max Price  (two equal halves — Style removed) */
        #single-form .form-group:nth-child(1) { 
            grid-column: 1 / 3; 
            grid-row: 1;
        }
        #single-form .form-group:nth-child(2) { 
            grid-column: 3 / 5; 
            grid-row: 1;
        }

        /* Row 2: Bedrooms | Bathrooms | Stories | Garage */
        #single-form .form-group:nth-child(3) { 
            grid-column: 1 / 2; 
            grid-row: 2;
        }
        #single-form .form-group:nth-child(4) { 
            grid-column: 2 / 3; 
            grid-row: 2;
        }
        #single-form .form-group:nth-child(5) { 
            grid-column: 3 / 4; 
            grid-row: 2;
        }
        #single-form .form-group:nth-child(6) { 
            grid-column: 4 / 5; 
            grid-row: 2;
        }

        /* Row 3: Move-in Date (2 cols) | Square Footage (2 cols) */
        #single-form .form-group:nth-child(7) { 
            grid-column: 1 / 3; 
            grid-row: 3;
        }
        #single-form .form-group:nth-child(8) { 
            grid-column: 3 / 5; 
            grid-row: 3;
        }

        .form-group {
            display: flex;
            flex-direction: column;
        }

        .form-group label {
            font-weight: 600;
            color: #34495e;
            margin-bottom: 8px;
            font-size: 14px;
        }

        .form-group input:not([type="range"]),
        .form-group select {
            width: 100%;
            padding: 12px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 15px;
            transition: all 0.3s ease;
            box-sizing: border-box;
        }

        .form-group input:focus,
        .form-group select:focus {
            outline: none;
            border-color: var(--hwh-primary);
            box-shadow: 0 0 0 3px rgba(235, 169, 0, 0.1);
        }

        .range-inputs {
            display: flex;
            gap: 10px;
            align-items: center;
            width: 100%;
        }

        .range-inputs input,
        .range-inputs select {
            flex: 1;
            min-width: 0; /* Allows flex items to shrink below content size */
        }

        .range-inputs span {
            color: #7f8c8d;
            font-weight: 600;
            flex-shrink: 0; /* Prevents the dash from shrinking */
        }

        /* Wizard Styles */
        .wizard-steps {
            display: flex;
            justify-content: space-between;
            margin-bottom: 40px;
        }

        .wizard-step {
            flex: 1;
            text-align: center;
            position: relative;
        }

        .wizard-step::after {
            content: '';
            position: absolute;
            top: 20px;
            right: -50%;
            width: 100%;
            height: 2px;
            background: #e0e0e0;
            z-index: -1;
        }

        .wizard-step:last-child::after {
            display: none;
        }

        .wizard-step-number {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: #e0e0e0;
            color: white;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            margin-bottom: 10px;
        }

        .wizard-step.active .wizard-step-number {
            background: var(--hwh-primary);
        }

        .wizard-step.completed .wizard-step-number {
            background: var(--hwh-secondary);
        }

        .wizard-step-label {
            font-size: 14px;
            color: #7f8c8d;
        }

        .wizard-content {
            min-height: 300px;
        }

        .wizard-buttons {
            display: flex;
            justify-content: space-between;
            margin-top: 40px;
        }

        /* Button Styles */
        .btn {
            padding: 14px 28px;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-primary {
            background: white;
            color: #2c3e50;
            border: 2px solid #ccd0d4;
        }

        .btn-primary:hover {
            background: #f8f9fa;
            border-color: #95a5a6;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        .btn-secondary {
            background: var(--hwh-primary);
            color: white;
        }

        .btn-secondary:hover {
            background: var(--hwh-primary-dark);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(235, 169, 0, 0.3);
            box-shadow: 0 4px 12px color-mix(in srgb, var(--hwh-primary) 30%, transparent);
        }

        /* Modal-specific button styles */
        .btn-gold {
            background: var(--hwh-primary);
            color: white !important;
            text-decoration: none;
            display: inline-block;
        }

        .btn-gold:hover {
            background: var(--hwh-primary-dark);
            color: white !important;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(235, 169, 0, 0.3);
            box-shadow: 0 4px 12px color-mix(in srgb, var(--hwh-primary) 30%, transparent);
        }

        .btn-schedule-tour {
            background: var(--hwh-secondary);
            color: white !important;
        }

        .btn-schedule-tour:hover {
            background: var(--hwh-secondary-dark, #6a8a41);
            color: white !important;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(120, 156, 74, 0.3);
            box-shadow: 0 4px 12px color-mix(in srgb, var(--hwh-secondary) 30%, transparent);
        }

        .btn-email-info {
            background: var(--hwh-tertiary);
            color: white !important;
        }

        .btn-email-info:hover {
            background: var(--hwh-tertiary-dark, #4a7a9e);
            color: white !important;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(92, 140, 180, 0.3);
            box-shadow: 0 4px 12px color-mix(in srgb, var(--hwh-tertiary) 30%, transparent);
        }

        .btn-submit {
            background: var(--hwh-secondary);
            color: white;
            width: 100%;
            margin-top: 20px;
        }

        .btn-submit:hover {
            background: var(--hwh-secondary-dark, #6a8a41);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(120, 156, 74, 0.3);
            box-shadow: 0 4px 12px color-mix(in srgb, var(--hwh-secondary) 30%, transparent);
        }

        /* Email Options */
        .email-options {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            margin-top: 20px;
        }

        .email-options h4 {
            color: #34495e;
            margin-bottom: 15px;
            font-size: 16px;
        }

        .email-option-item {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 10px;
        }

        .email-option-item input[type="checkbox"] {
            width: 20px;
            height: 20px;
        }

        .email-input-group {
            display: none;
            margin-top: 15px;
        }

        .email-input-group.show {
            display: block;
        }

        .email-input-group input {
            width: 100%;
            padding: 12px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 15px;
        }

        /* Results Section */
        .results-container {
            display: none;
        }

        .results-container.show {
            display: block;
        }

        .results-header {
            background: white;
            padding: 20px;
            border-radius: 12px;
            margin-bottom: 20px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }

        .results-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 15px;
        }

        .results-count {
            font-size: 18px;
            font-weight: 600;
            color: #34495e;
        }

        .results-controls {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .btn-email-results {
            padding: 10px 20px;
            background: var(--hwh-primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-email-results:hover {
            background: var(--hwh-primary-dark);
            transform: translateY(-1px);
        }

        /* XO Iframe Styles */
        .xoiframe-wrapper {
            position: relative;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            border-radius: 12px;
            overflow: hidden;
            min-height: 800px;
        }

        .xoiframe-wrapper::before {
            content: 'Loading properties...';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 18px;
            color: #7f8c8d;
            z-index: 1;
            animation: pulse 1.5s ease-in-out infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 0.5; }
            50% { opacity: 1; }
        }

        #xoiframe {
            position: relative;
            z-index: 2;
            background: white;
        }

        /* Modal Styles */
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            align-items: center;
            justify-content: center;
        }

        .modal.show,
        .modal[style*="display: flex"] {
            display: flex !important;
            align-items: center;
            justify-content: center;
        }

        .modal-content {
            background: white;
            padding: 30px;
            border-radius: 12px;
            max-width: 600px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .modal-title {
            font-size: 24px;
            color: #2c3e50;
        }

        .modal-close {
            font-size: 28px;
            color: #7f8c8d;
            cursor: pointer;
            background: none;
            border: none;
        }

        .modal-close:hover {
            color: #34495e;
        }


        .modal-form-group {
            margin-bottom: 20px;
        }

        .modal-form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #34495e;
        }

        .modal-form-group input,
        .modal-form-group textarea {
            width: 100%;
            padding: 12px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 15px;
        }

        .modal-form-group textarea {
            min-height: 100px;
            resize: vertical;
        }

        .success-message {
            display: none;
            background: #d4edda;
            color: #155724;
            padding: 15px;
            border-radius: 8px;
            margin-top: 20px;
        }

        .success-message.show {
            display: block;
        }

        /* Property Summary in Modal */
        .search-summary {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
        }

        .search-summary h4 {
            color: #34495e;
            margin-bottom: 10px;
            font-size: 16px;
        }

        .search-summary p {
            color: #7f8c8d;
            font-size: 14px;
            margin-bottom: 5px;
        }

        .property-list {
            max-height: 300px;
            overflow-y: auto;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 15px;
            background: white;
        }

        .property-item {
            padding: 10px;
            border-bottom: 1px solid #e0e0e0;
            font-size: 14px;
        }

        .property-item:last-child {
            border-bottom: none;
        }

        .property-item strong {
            color: #2c3e50;
        }

        /* Property Detail Modal Styles */
        .property-detail-modal-content {
            max-width: 900px;
            width: 95%;
            max-height: 90vh;
            padding: 20px;
        }


        .property-gallery {
            width: 100%;
            margin-bottom: 15px;
        }

        .property-main-image {
            width: 100%;
            max-height: 350px;
            object-fit: contain;
            border-radius: 8px;
            background: #f5f5f5;
        }

        .property-info-grid {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 20px;
        }

        @media (max-width: 768px) {
            .property-info-grid {
                grid-template-columns: 1fr;
            }
        }

        .property-details-column {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .property-status-badge-container {
            margin-bottom: 5px;
        }

        .property-price-section {
            border-bottom: 2px solid #e0e0e0;
            padding-bottom: 10px;
        }

        .property-price {
            font-size: 32px;
            font-weight: 700;
            color: var(--hwh-primary);
            margin: 0;
        }

        .property-homesite-price {
            font-size: 14px;
            color: #7f8c8d;
            margin-top: 5px;
        }

        .property-specs {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }

        .spec-item {
            display: flex;
            flex-direction: column;
        }

        .spec-label {
            font-size: 12px;
            color: #7f8c8d;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 5px;
        }

        .spec-value {
            font-size: 16px;
            font-weight: 600;
            color: #2c3e50;
        }

        .property-features {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 8px;
        }

        .property-features h4 {
            margin-top: 0;
            margin-bottom: 10px;
            color: #34495e;
        }

        .property-features ul {
            margin: 0;
            padding-left: 20px;
        }

        .property-features li {
            margin-bottom: 8px;
            color: #7f8c8d;
        }

        .property-description {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 8px;
        }

        .property-description p {
            margin: 0;
            color: #7f8c8d;
            line-height: 1.6;
        }

        .property-builder-column {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .builder-info {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            text-align: center;
        }

        .builder-info h4 {
            margin-top: 0;
            margin-bottom: 15px;
            color: #34495e;
            font-size: 14px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .builder-logo {
            width: 120px;
            height: 60px;
            object-fit: contain;
            margin: 0 auto 15px auto; /* Center horizontally */
            display: block; /* Required for margin auto to work */
        }

        .builder-info h3 {
            margin: 0 0 10px 0;
            color: #2c3e50;
            font-size: 18px;
        }

        .builder-phone {
            margin: 10px 0;
        }

        .builder-phone a {
            color: var(--hwh-primary);
            text-decoration: none;
            font-weight: 600;
        }

        .builder-phone a:hover {
            text-decoration: underline;
        }

        .property-cta-section {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .property-cta-section .btn {
            width: 100%;
            justify-content: center;
        }

        /* Property Modal HubSpot Form Panel (spec 3.2) */
        .property-form-panel {
            width: 100%;
        }

        .property-form-panel.slide-in {
            animation: hwhFormSlideIn 0.3s ease;
        }

        @keyframes hwhFormSlideIn {
            from {
                opacity: 0;
                transform: translateX(40px);
            }
            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        .property-form-back {
            background: none;
            border: none;
            color: var(--hwh-tertiary);
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            padding: 0 0 15px 0;
        }

        .property-form-back:hover {
            text-decoration: underline;
        }

        .property-form-heading {
            color: #2c3e50;
            margin-bottom: 15px;
        }

        /* Let the HubSpot iframe self-size — no fixed height so validation
           errors / reCAPTCHA never get clipped (FR-004) */
        #property-modal-hubspot-form iframe,
        #inv-property-modal-hubspot-form iframe {
            width: 100% !important;
        }

        .property-form-loading {
            color: #7f8c8d;
        }

        /* Property clickable cursor */
        .property-table tbody tr {
            cursor: pointer;
            transition: background-color 0.2s ease;
        }

        .property-table tbody tr:hover {
            background-color: #f8f9fa;
        }

        .property-card {
            cursor: pointer;
        }

        .property-card:hover {
            transform: translateY(-2px);
        }

        /* View Toggle Buttons */
        .view-toggle {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            justify-content: center;
        }

        .view-toggle-btn {
            padding: 10px 20px;
            border: 2px solid #e0e0e0;
            background: white;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .view-toggle-btn:hover {
            border-color: var(--hwh-primary);
            background: #fef9ed;
        }

        .view-toggle-btn.active {
            background: var(--hwh-primary);
            color: white;
            border-color: var(--hwh-primary);
        }

        /* Table View Styles */
        .property-table-view {
            display: none;
            overflow-x: auto;
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        .property-table-view.active {
            display: block;
        }

        .property-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
            background: white; /* Ensure white background */
        }

        .property-table thead {
            background: #f8f9fa !important; /* Light gray header */
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .property-table th {
            padding: 15px;
            text-align: left;
            font-weight: 600;
            color: #2c3e50 !important;
            background: #f8f9fa !important; /* Force light gray header */
            border-bottom: 2px solid #e0e0e0;
            white-space: nowrap;
        }

        .property-table td {
            padding: 15px;
            border-bottom: 1px solid #f0f0f0;
            vertical-align: middle;
            background: white !important; /* Force white background */
        }

        .property-table tbody tr {
            background: white !important; /* Force white rows */
        }

        .property-table tbody tr:nth-child(even) {
            background: #fafbfc !important; /* Light gray alternating rows */
        }

        .property-table tbody tr:nth-child(even) td {
            background: #fafbfc !important; /* Light gray cells in even rows */
        }

        .property-table tbody tr:hover {
            background: #f8f9fa !important; /* Light gray on hover */
        }

        .property-table tbody tr:hover td {
            background: #f8f9fa !important; /* Light gray cells on hover */
        }

        .property-table .property-image-cell {
            width: 100px;
        }

        .property-table .property-image-thumb {
            width: 80px;
            height: 60px;
            object-fit: cover;
            border-radius: 6px;
        }

        .property-table .property-badge {
            display: inline-block;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 11px;
            font-weight: 600;
        }

        /* Badge Color Styles - Bright solid colors like MVP */
        .badge-move-in-ready {
            background: #27ae60;
            color: white;
        }

        .badge-construction {
            background: #f39c12;
            color: white;
        }

        .badge-available-soon {
            background: #3498db;
            color: white;
        }

        .badge-homesite {
            background: #9b59b6;
            color: white;
        }

        .badge-available {
            background: #1abc9c;
            color: white;
        }

        .property-cards-view.active {
            display: block;
        }

        .property-cards-view {
            display: none;
        }

        /* Badge Legend Styles */
        .badge-legend-container {
            background: #f8f9fa;
            border-radius: 8px;
            margin-bottom: 20px;
            overflow: hidden;
        }

        .badge-legend-toggle {
            width: 100%;
            padding: 12px 20px;
            background: #e9ecef;
            border: none;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            color: #495057;
            text-align: left;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: background 0.3s ease;
        }

        .badge-legend-toggle:hover {
            background: #dee2e6;
        }

        .badge-legend {
            display: none;
            padding: 20px;
            background: white;
            border-top: 2px solid #dee2e6;
        }

        .badge-legend.show {
            display: block;
            animation: slideDown 0.3s ease;
        }

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

        .badge-legend h4 {
            margin: 0 0 15px 0;
            color: #2c3e50;
            font-size: 16px;
        }

        .legend-table {
            width: 100%;
            border-collapse: collapse;
            background: white; /* Ensure white background */
        }

        .legend-table th {
            text-align: left;
            padding: 10px;
            background: #f8f9fa !important; /* Light gray header */
            font-weight: 600;
            color: #495057;
            border-bottom: 2px solid #dee2e6;
            font-size: 13px;
        }

        .legend-table td {
            padding: 12px 10px;
            border-bottom: 1px solid #e9ecef;
            font-size: 13px;
            color: #495057;
            background: white !important; /* Force white background on cells */
        }

        .legend-table tbody tr {
            background: white !important; /* Force white background on rows */
        }

        .legend-table tbody tr:nth-child(even) {
            background: #fafbfc !important; /* Light gray alternating rows */
        }

        .legend-table tbody tr:last-child td {
            border-bottom: none;
        }

        .legend-table tbody tr:hover {
            background: #f8f9fa !important; /* Light gray on hover */
        }

        /* Property Card Styles - Modern Card Design */
        #property-cards-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            gap: 30px;
            padding: 20px 0;
        }

        .property-card {
            background: white;
            border-radius: 16px;
            overflow: hidden;
            box-shadow: 0 4px 6px rgba(0,0,0,0.07);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            cursor: pointer;
            border: 1px solid #f0f0f0;
            display: flex;
            flex-direction: column;
        }

        .property-card:hover {
            transform: translateY(-8px);
            box-shadow: 0 12px 24px rgba(0,0,0,0.12);
            border-color: #e0e0e0;
        }

        .property-card-image {
            width: 100%;
            height: 240px;
            object-fit: cover;
            background: linear-gradient(135deg, var(--hwh-primary) 0%, var(--hwh-secondary) 100%);
            display: block;
        }

        .property-card-content {
            padding: 24px;
            display: flex;
            flex-direction: column;
            flex-grow: 1;
        }

        .property-card-title {
            font-size: 20px;
            font-weight: 700;
            color: #2d2d2d;
            margin: 0 0 8px 0;
            line-height: 1.3;
        }

        .property-card-builder {
            font-size: 14px;
            color: #767676;
            margin: 0 0 16px 0;
            font-weight: 500;
        }

        .property-card-price {
            font-size: 28px;
            font-weight: 700;
            color: var(--hwh-primary);
            margin: 0 0 20px 0;
            letter-spacing: -0.5px;
        }

        .property-card-details {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
            gap: 12px;
            padding: 20px 0;
            margin-bottom: 20px;
            border-top: 1px solid #e9ecef;
            border-bottom: 1px solid #e9ecef;
        }

        .property-card-details span {
            font-size: 14px;
            color: #495057;
            font-weight: 500;
            text-align: center;
        }

        .property-card-details strong {
            display: block;
            font-size: 18px;
            color: #2d2d2d;
            font-weight: 700;
            margin-bottom: 4px;
        }

        .property-card-badge {
            display: inline-block;
            padding: 10px 16px;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-top: auto;
        }

        @media (max-width: 1024px) {
            #single-form .form-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            
            #single-form .form-group:nth-child(1) { grid-column: 1; grid-row: 1; }
            #single-form .form-group:nth-child(2) { grid-column: 2; grid-row: 1; }
            #single-form .form-group:nth-child(3) { grid-column: 1; grid-row: 2; }
            #single-form .form-group:nth-child(4) { grid-column: 2; grid-row: 2; }
            #single-form .form-group:nth-child(5) { grid-column: 1; grid-row: 3; }
            #single-form .form-group:nth-child(6) { grid-column: 2; grid-row: 3; }
            #single-form .form-group:nth-child(7) { grid-column: 1 / 3; grid-row: 4; }
            #single-form .form-group:nth-child(8) { grid-column: 1 / 3; grid-row: 5; }
            
            /* Make toggle buttons stack on tablet */
            .version-toggle-container {
                flex-direction: column;
                gap: 10px;
            }
            
            .toggle-btn {
                width: 100%;
            }
        }

        @media (max-width: 768px) {
            #single-form .form-grid {
                grid-template-columns: 1fr;
                gap: 20px;
            }
            
            #single-form .form-group {
                grid-column: 1 !important;
                grid-row: auto !important;
            }

            .wizard-steps {
                display: none;
            }

            .email-capture-banner {
                flex-direction: column;
            }

            .email-capture-form {
                max-width: 100%;
            }
            
            /* Better button sizing on mobile */
            .btn {
                padding: 12px 20px;
                font-size: 14px;
            }
            
            /* Make results section more mobile-friendly */
            .results-header {
                flex-direction: column;
                gap: 15px;
            }
            
            .view-toggle {
                width: 100%;
                justify-content: space-between;
            }
        }

        @media (max-width: 600px) {
            /* Extra small devices - make everything stack */
            .search-container {
                padding: 20px;
            }
            
            #single-form .form-grid {
                gap: 15px;
            }
            
            /* Range inputs (price & sqft) stack on very small screens */
            .range-inputs {
                flex-direction: column;
                gap: 10px;
            }
            
            .range-inputs span {
                display: none; /* Hide the dash when stacked */
            }
            
            /* Form labels smaller */
            .form-group label {
                font-size: 13px;
            }
            
            /* Inputs larger tap targets */
            .form-group select,
            .form-group input {
                font-size: 16px; /* Prevents zoom on iOS */
                min-height: 44px; /* Better tap target */
            }
        }

/* ============================================
   SQUARE FOOTAGE SLIDER
   ============================================ */
.form-group-full {
    grid-column: 1 / -1;
}

.sqft-slider-container {
    width: 100%;
    padding: 5px 0;
}

.sqft-slider-values {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.sqft-slider-track {
    position: relative;
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin: 15px 0;
}

.sqft-slider-range {
    position: absolute;
    height: 100%;
    background: var(--hwh-primary, #eba900);
    border-radius: 4px;
    z-index: 1;
}

.sqft-slider {
    position: absolute;
    top: -6px;
    left: 0;
    right: 0;
    width: 100%;
    height: 20px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 2;
    margin: 0;
    padding: 0;
}

.sqft-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--hwh-primary, #eba900);
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.15s ease;
}

.sqft-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.sqft-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--hwh-primary, #eba900);
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* ============================================
   MOVE-IN READY INVENTORY PAGE
   ============================================ */
.hwh-inventory-wrapper .header h2 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 8px;
}

.inventory-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.inventory-sort {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inventory-sort label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.inventory-sort select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.inventory-count {
    font-size: 16px;
    font-weight: 600;
    color: var(--hwh-primary, #eba900);
}

.inventory-builder-section {
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.inventory-builder-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.inventory-builder-logo {
    width: 60px;
    height: 40px;
    object-fit: contain;
}

.inventory-builder-info h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.inventory-builder-count {
    font-size: 13px;
    color: #7f8c8d;
}

.inventory-table {
    margin: 0;
    border: none;
    border-radius: 0;
}

.inventory-row.clickable:hover {
    background: #f0f7ff;
    transition: background 0.15s ease;
}

@media (max-width: 768px) {
    .inventory-controls {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .inventory-builder-header {
        padding: 12px 15px;
    }
    
    .inventory-table {
        font-size: 13px;
    }
}

/* ============================================
   Move-In Ready Homes by Builder ([hw_move_in_builder])
   All rules scoped under .hwh-builder-inventory-wrapper so nothing leaks
   into the theme or the other two shortcodes. Reuses existing .property-table,
   .property-badge, .badge-move-in-ready, .modal, .property-* / .builder-info,
   .loading-overlay, .loading-spinner, .spinner styles (not redefined here).
   ============================================ */

/* Combined header + sort bar. The separator rule sits at the TOP of the bar,
   dividing the builder description content above from the move-in content below. */
.hwh-builder-inventory-wrapper .hwh-builder-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* Left group: logo + name/label + count pill */
.hwh-builder-inventory-wrapper .hwh-builder-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Fixed bounding box so every builder's logo renders at a consistent height
   without distortion or cropping, regardless of native aspect ratio. */
.hwh-builder-inventory-wrapper .hwh-builder-header-logo {
    height: 60px;
    max-width: 180px;
    width: auto;
    object-fit: contain;
}

.hwh-builder-inventory-wrapper .hwh-builder-header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hwh-builder-inventory-wrapper .hwh-builder-header-info h2 {
    margin: 0;
    font-size: 22px;
    color: #2c3e50;
}

.hwh-builder-inventory-wrapper .hwh-builder-header-count {
    align-self: flex-start;
    padding: 3px 10px;
    background: var(--hwh-primary, #eba900);
    /* Fixed dark amber/brown for contrast on the gold background (same in light/dark mode) */
    color: #412402;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
}

.hwh-builder-inventory-wrapper .hwh-builder-sort {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hwh-builder-inventory-wrapper .hwh-builder-sort label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.hwh-builder-inventory-wrapper .hwh-builder-sort select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

/* Inherits .property-table; minor reset so it sits flush in this layout.
   Larger 18px text is scoped here so it affects only [hw_move_in_builder],
   not the shared .property-table used by [hw_move_in_inventory]. th/td have no
   font-size of their own, so they inherit this from the table element. */
.hwh-builder-inventory-wrapper .builder-inventory-table {
    margin: 0;
    font-size: 18px;
}

.hwh-builder-inventory-wrapper .builder-inventory-row.clickable:hover {
    background: #f0f7ff;
    transition: background 0.15s ease;
}

@media (max-width: 768px) {
    .hwh-builder-inventory-wrapper .hwh-builder-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .hwh-builder-inventory-wrapper .hwh-builder-header {
        gap: 10px;
    }

    .hwh-builder-inventory-wrapper .builder-inventory-table {
        font-size: 16px;
    }
}

/* Builder modal stacking fix. Intentionally NOT scoped under
   .hwh-builder-inventory-wrapper: openBuilderModal() re-parents this modal to
   <body> on open, so it is no longer inside the wrapper. The class is unique to
   the [hw_move_in_builder] modal, so this does not affect the [hw_homefinder] or
   [hw_move_in_inventory] modals (which keep .modal's default z-index: 1000).
   999999 beats typical theme carousels/sticky headers. */
.hwh-builder-modal {
    z-index: 999999;
}