/* Reset & Base */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500;600&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --tbg-idx-font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --tbg-idx-font-heading: 'Cormorant Garamond', 'Georgia', serif;
    --tbg-idx-font-mono: 'DM Mono', monospace;
    --tbg-idx-bg-color: #faf9f7;
    --tbg-idx-bg-color-alt: #fff;
    --tbg-idx-text-color: #1a1a1a;
    --tbg-idx-text-color-muted: #6b7280;
    --tbg-idx-border-color: #f0f0f0;
    --tbg-idx-primary-color: #111;
    --tbg-idx-primary-hover: #333;
    --tbg-idx-card-bg-color: #fff;
    --tbg-idx-button-text-color: #fff;
}

/* Dark Mode Overrides */
[data-theme="dark"] .tbg-idx-single-listing,
.dark .tbg-idx-single-listing,
.dark-mode .tbg-idx-single-listing,
.dark-theme .tbg-idx-single-listing,
[data-bs-theme="dark"] .tbg-idx-single-listing {
    --tbg-idx-bg-color: var(--site-bg, #0f1115);
    --tbg-idx-bg-color-alt: var(--card-bg, #1a1d24);
    --tbg-idx-text-color: var(--text-main, #f3f4f6);
    --tbg-idx-text-color-muted: var(--text-muted, #9ca3af);
    --tbg-idx-border-color: var(--border-color, rgba(255, 255, 255, 0.1));
    --tbg-idx-primary-color: var(--primary-color, #e2e8f0);
    --tbg-idx-primary-hover: #ffffff;
    --tbg-idx-card-bg-color: var(--card-bg, #161b22);
    --tbg-idx-button-text-color: #000;
}

[data-theme="dark"] .tbg-idx-card,
.dark .tbg-idx-card,
.dark-mode .tbg-idx-card,
.dark-theme .tbg-idx-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .tbg-idx-feature-pill,
.dark .tbg-idx-feature-pill,
.dark-mode .tbg-idx-feature-pill,
.dark-theme .tbg-idx-feature-pill {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}

[data-theme="dark"] .tbg-idx-input-field,
.dark .tbg-idx-input-field,
.dark-mode .tbg-idx-input-field,
.dark-theme .tbg-idx-input-field {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .tbg-idx-days-market,
.dark .tbg-idx-days-market,
.dark-mode .tbg-idx-days-market,
.dark-theme .tbg-idx-days-market {
    background: #451a03;
    color: #fde68a;
}

[data-theme="dark"] .tbg-idx-description-text,
.dark .tbg-idx-description-text,
.dark-mode .tbg-idx-description-text,
.dark-theme .tbg-idx-description-text {
    color: #cbd5e1;
}

[data-theme="dark"] .tbg-idx-gallery-top-bar,
.dark .tbg-idx-gallery-top-bar,
.dark-mode .tbg-idx-gallery-top-bar,
.dark-theme .tbg-idx-gallery-top-bar {
    border-color: rgba(255, 255, 255, 0.1);
}

.tbg-idx-single-listing {
    margin: 0;
    padding: 80px 0 0 0;
    box-sizing: border-box;
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color);
    background: var(--tbg-idx-bg-color);
    width: 100%;
    position: relative;
    z-index: 10;
    line-height: 1.6;
}

.tbg-idx-single-listing *,
.tbg-idx-single-listing *:before,
.tbg-idx-single-listing *:after {
    box-sizing: inherit;
}

/* Typography Overrides */
.tbg-idx-single-listing h1,
.tbg-idx-single-listing h2,
.tbg-idx-single-listing h3,
.tbg-idx-property-header h1 {
    font-family: var(--tbg-idx-font-heading);
    color: var(--tbg-idx-text-color);
    margin-top: 0;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.tbg-idx-single-listing .section-title {
    font-family: var(--tbg-idx-font-heading);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--tbg-idx-text-color);
    margin-bottom: 1rem;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

/* Base Container Styles */
.tbg-idx-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 24px;
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color);
}

/* Card Styling replacing old glassmorphism */
.tbg-idx-card {
    background: var(--tbg-idx-card-bg-color);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 0 0 1px rgba(0, 0, 0, .03);
    border: none;
}

/* Top Typography Header Overlay (Address & Simple Price) */
.tbg-idx-gallery-top-bar {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem 1rem;
}

/* React-Style Gallery */
.tbg-idx-zillow-gallery {
    display: grid;
    gap: 6px;
    border-radius: 20px;
    overflow: hidden;
    height: auto;
    width: 100%;
    background: transparent;
    cursor: pointer;
    position: relative;
    max-width: 1200px;
    margin: 0 auto 2rem;
}

.tbg-idx-zillow-gallery.has-5-plus-photos {
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 220px 220px;
}

.tbg-idx-zillow-gallery.has-4-photos {
    grid-template-columns: 3fr 1fr 1fr;
    grid-template-rows: 220px 220px;
}

.tbg-idx-zillow-gallery.has-4-photos .tbg-idx-gallery-item:nth-child(2) {
    grid-column: 2 / 4;
}

.tbg-idx-zillow-gallery.has-3-photos {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 220px 220px;
}

.tbg-idx-zillow-gallery.has-2-photos {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 440px;
}

.tbg-idx-zillow-gallery.has-1-photo {
    grid-template-columns: 1fr;
    grid-template-rows: 440px;
}

.tbg-idx-gallery-main {
    grid-row: 1 / 3;
    grid-column: 1 / 2;
}

.tbg-idx-zillow-gallery.has-2-photos .tbg-idx-gallery-main,
.tbg-idx-zillow-gallery.has-1-photo .tbg-idx-gallery-main {
    grid-row: 1 / 2;
}

.tbg-idx-gallery-item {
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: var(--tbg-idx-bg-color-alt);
    transition: transform 0.3s ease;
    width: 100%;
    height: 100%;
}

.tbg-idx-gallery-item:hover {
    transform: scale(1.01);
}

.tbg-idx-gallery-item.has-more::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.tbg-idx-view-all-photos {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    gap: 6px;
    z-index: 10;
    font-family: var(--tbg-idx-font-family);
}

.tbg-idx-view-all-photos svg {
    width: 18px;
    height: 18px;
}

/* Layout */
.tbg-idx-single-listing {
    width: 100%;
    margin: 0 auto;
    background: transparent;
    display: block;
    word-wrap: normal;
    word-break: normal;
    overflow-wrap: normal;
}

/* Force modern themes (like block themes) to give us full width */
.entry-content>.tbg-idx-single-listing {
    flex: 1 1 100%;
    max-width: 100%;
}

.tbg-idx-content-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    align-items: start;
    width: 100%;
}

.tbg-idx-main-col {
    width: 100%;
    min-width: 0;
    flex: 1;
}

.tbg-idx-sidebar-col {
    width: 320px;
    flex: 0 0 320px;
    position: sticky;
    top: 2rem;
}

/* Header & Stats */
.tbg-idx-property-header {
    margin-bottom: 2rem;
}

.tbg-idx-address-block {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--tbg-idx-text-color-muted);
    font-size: 13px;
}

.tbg-idx-address-block svg {
    width: 16px;
    height: 16px;
}

.tbg-idx-days-market {
    font-size: 11px;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--tbg-idx-font-mono);
}

/* Action Bar (Save / Share) */
.tbg-idx-action-bar {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    flex-shrink: 0;
}

.tbg-idx-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--tbg-idx-border-color);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tbg-idx-action-btn:hover {
    background: var(--tbg-idx-border-color);
    transform: translateY(-1px);
}

.tbg-idx-action-btn svg {
    width: 18px;
    height: 18px;
    transition: all 0.2s ease;
}

.tbg-idx-action-btn.saved {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

/* Header Adjustments */
.tbg-idx-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.tbg-idx-header-top h1 {
    font-size: clamp(28px, 4vw, 36px);
    margin: 0 0 8px 0;
    line-height: 1.2;
    word-break: break-word;
    /* Safe fallback */
}

.tbg-idx-price-huge {
    font-size: clamp(32px, 5vw, 42px);
    font-family: var(--tbg-idx-font-mono);
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.tbg-idx-price-per-sqft {
    font-size: 14px;
    color: var(--tbg-idx-text-color-muted);
    font-family: var(--tbg-idx-font-family);
    font-weight: normal;
}

/* Sold / Pending Date Banner */
.tbg-idx-status-date-banner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--tbg-idx-font-family);
    margin-bottom: 16px;
    line-height: 1.4;
}

.tbg-idx-status-date-banner svg {
    flex-shrink: 0;
}

.tbg-idx-status-sold-banner {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.tbg-idx-status-pending-banner {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Dark mode */
[data-theme="dark"] .tbg-idx-status-sold-banner,
.dark .tbg-idx-status-sold-banner {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.25);
}

[data-theme="dark"] .tbg-idx-status-pending-banner,
.dark .tbg-idx-status-pending-banner {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}

/* Core Stats Row */
.tbg-idx-core-stats {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--tbg-idx-border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-icon {
    color: #9ca3af;
    display: flex;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    font-family: var(--tbg-idx-font-mono);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
}

/* Tab Navigation */
.tbg-idx-tabs {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid var(--tbg-idx-border-color);
    margin-bottom: 28px;
    margin-top: 32px;
}

.tbg-idx-tab-btn {
    padding: 12px 0;
    font-size: 14px;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    color: #9ca3af;
    position: relative;
    transition: color 0.2s;
    font-family: var(--tbg-idx-font-family);
    text-transform: capitalize;
}

.tbg-idx-tab-btn.active {
    color: var(--tbg-idx-text-color);
}

.tbg-idx-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--tbg-idx-primary-color);
    border-radius: 1px;
}

.tbg-idx-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tbg-idx-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* What's Special & Features */
.section-title {
    font-family: var(--tbg-idx-font-heading);
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 16px 0;
}

.tbg-idx-description-text {
    font-size: 15px;
    line-height: 1.8;
    color: #374151;
    white-space: pre-line;
}

/* Feature Pills Container */
.tbg-idx-features-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.tbg-idx-feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    border: 1px solid var(--tbg-idx-border-color);
    font-weight: normal;
}

.tbg-idx-feature-pill svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

/* Expandable Text */
.tbg-idx-expandable-text {
    position: relative;
}

.tbg-idx-expandable-text .text-content {
    max-height: 150px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.3s ease;
}

.tbg-idx-expandable-text .text-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--tbg-idx-bg-color));
    pointer-events: none;
}

.tbg-idx-expandable-text.is-expanded .text-content {
    max-height: 2000px;
}

.tbg-idx-expandable-text.is-expanded .text-content::after {
    display: none;
}

.tbg-idx-show-more-btn {
    background: none;
    border: none;
    color: var(--tbg-idx-primary-color);
    font-weight: 600;
    font-size: 14px;
    padding: 0;
    margin-top: 16px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-family: var(--tbg-idx-font-family);
}

/* Detail Grid overview */
.tbg-idx-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--tbg-idx-border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 28px;
}

.tbg-idx-detail-row {
    background: var(--tbg-idx-card-bg-color);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tbg-idx-detail-row span:first-child {
    font-size: 13px;
    color: var(--tbg-idx-text-color-muted);
}

.tbg-idx-detail-row span:last-child {
    font-size: 13px;
    font-weight: 600;
}

/* Sidebar Specific */
.tbg-idx-sidebar-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.tbg-idx-agent-img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    background: #e5e7eb;
}

.tbg-idx-sidebar-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.tbg-idx-sidebar-subtitle {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
}

.tbg-idx-input-field {
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--tbg-idx-border-color);
    border-radius: 12px;
    background: #f9fafb;
    color: var(--tbg-idx-text-color);
    font-family: inherit;
    font-size: 14px;
}

.tbg-idx-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--tbg-idx-font-family);
    background: var(--tbg-idx-primary-color);
    color: var(--tbg-idx-button-text-color);
}

.tbg-idx-submit-btn:hover {
    background: var(--tbg-idx-primary-hover);
}

.tbg-idx-submit-btn.secondary {
    background: #f3f4f6;
    color: var(--tbg-idx-text-color);
}

.tbg-idx-submit-btn.secondary:hover {
    background: #e5e7eb;
}

/* Status Pill */
.tbg-idx-status-pill {
    position: absolute;
    top: 16px;
    left: 16px;
    background: #10b981;
    color: #fff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    z-index: 2;
}

.tbg-idx-status-pill.status-pending {
    background: #f59e0b;
}

.tbg-idx-status-pill.status-sold,
.tbg-idx-status-pill.status-closed {
    background: #ef4444;
}

/* Zillow Facts & Features Module */
.tbg-idx-facts-module {
    margin-top: 1.5rem;
}

.tbg-idx-facts-title {
    font-family: var(--tbg-idx-font-heading);
    font-size: 1.6rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    color: var(--tbg-idx-text-color);
    letter-spacing: 0.01em;
}

/* Overview Grid (unified MLS sheet) */
.tbg-idx-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--tbg-idx-border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.tbg-idx-overview-grid .tbg-idx-detail-row {
    background: var(--tbg-idx-card-bg-color);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tbg-idx-overview-grid .tbg-idx-detail-row span:first-child {
    font-size: 13px;
    color: var(--tbg-idx-text-color-muted);
}

.tbg-idx-overview-grid .tbg-idx-detail-row span:last-child {
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 860px) {
    .tbg-idx-overview-grid {
        grid-template-columns: 1fr;
    }
}

.tbg-idx-fact-section {
    margin-bottom: 1.75rem;
}

.tbg-idx-fact-section-title {
    font-family: var(--tbg-idx-font-family);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--tbg-idx-card-bg-color, #f9fafb);
    border-radius: 6px;
    color: var(--tbg-idx-text-color-muted);
    border-left: 3px solid var(--tbg-idx-primary-color, #3b82f6);
}

.tbg-idx-fact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem 1.5rem;
    padding-left: 0.75rem;
}

.tbg-idx-fact-group {
    display: flex;
    flex-direction: column;
}

.tbg-idx-fact-subtitle {
    font-family: var(--tbg-idx-font-family);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--tbg-idx-text-color);
}

.tbg-idx-fact-list {
    list-style: disc outside none;
    margin: 0 0 0 1.25rem;
    padding: 0;
}

.tbg-idx-fact-list li {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 0.25rem;
    color: var(--tbg-idx-text-light);
}

/* Responsive Breakpoints */
@media (max-width: 860px) {
    .tbg-idx-content-wrapper {
        grid-template-columns: 1fr;
    }

    .tbg-idx-sidebar-col {
        width: 100%;
        flex: 1 1 100%;
        position: relative;
        top: 0;
    }

    .tbg-idx-details-grid {
        grid-template-columns: 1fr;
    }

    .tbg-idx-zillow-gallery.has-5-plus-photos {
        grid-template-columns: 1fr;
        grid-template-rows: 300px;
    }
}

@media (max-width: 768px) {

    .tbg-idx-zillow-gallery.has-5-plus-photos,
    .tbg-idx-zillow-gallery.has-4-photos,
    .tbg-idx-zillow-gallery.has-3-photos,
    .tbg-idx-zillow-gallery.has-2-photos,
    .tbg-idx-zillow-gallery.has-1-photo {
        grid-template-columns: 1fr;
        grid-template-rows: 300px;
    }

    .tbg-idx-zillow-gallery.has-4-photos .tbg-idx-gallery-item:nth-child(2) {
        grid-column: auto;
    }

    .tbg-idx-gallery-item:not(.tbg-idx-gallery-main) {
        display: none !important;
    }

    .tbg-idx-zillow-gallery .tbg-idx-gallery-main {
        grid-column: 1 / -1 !important;
        grid-row: 1 / -1 !important;
        height: 100%;
    }

    .tbg-idx-core-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

[data-theme="dark"] .tbg-idx-expandable-text .text-content::after,
.dark .tbg-idx-expandable-text .text-content::after,
.dark-mode .tbg-idx-expandable-text .text-content::after,
.dark-theme .tbg-idx-expandable-text .text-content::after {
    background: linear-gradient(to bottom, rgba(15, 17, 21, 0), var(--tbg-idx-bg-color));
}

/* Lightbox Styles */
.tbg-idx-lightbox {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.tbg-idx-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tbg-idx-lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.tbg-idx-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.tbg-idx-lightbox-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
    color: white;
    font-family: var(--tbg-idx-font-family);
}

.tbg-idx-lightbox-nav button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 18px;
}

.tbg-idx-lightbox-nav button:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   Phase 5: Search UI & Glassmorphism Defaults
   (Theme override-friendly variables)
   ========================================================================== */

/* Search Container & Form */
.tbg-idx-theme-container {
    padding: 24px;
    margin-bottom: 30px;
    background: var(--bg-card, rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border, rgba(0, 0, 0, 0.05));
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.tbg-idx-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.tbg-idx-search-field {
    flex: 1 1 auto;
    min-width: 140px;
}

.tbg-idx-search-field-omnibox {
    flex: 2 1 300px;
}

.tbg-idx-search-field-small {
    flex: 0 1 100px;
    min-width: 90px;
}

.tbg-idx-search-field-btn {
    flex: 0 1 auto;
}

.tbg-idx-form-control {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--form-bg, #ffffff);
    color: var(--text-main, #111111);
    font-size: 15px;
    font-family: var(--tbg-idx-font-family);
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.tbg-idx-form-control:focus {
    outline: none;
    border-color: var(--gold, #d4af37);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.tbg-idx-btn-primary {
    padding: 14px 28px;
    background: var(--primary-color, #111111);
    color: var(--button-text, #ffffff);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--tbg-idx-font-family);
    white-space: nowrap;
}

.tbg-idx-btn-primary:hover {
    background: var(--gold, #d4af37);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

/* Results Area & Grid */
.tbg-idx-search-results-area {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
}

.tbg-idx-results-col {
    flex: 1 1 50%;
    min-width: 320px;
    position: relative;
}

.tbg-idx-map-col {
    flex: 1 1 40%;
    min-width: 300px;
    position: sticky;
    top: 24px;
    height: calc(100vh - 48px);
}

.tbg-idx-map-container {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 1;
    background: var(--border, #eaebed);
    overflow: hidden;
    border: 1px solid var(--border, rgba(0, 0, 0, 0.05));
}

/* ───── Map Toggle Button (Custom Leaflet Control) ───── */
.tbg-idx-map-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--tbg-idx-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    color: #333;
    line-height: 1;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.tbg-idx-map-toggle-btn:hover {
    background: #f4f4f4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tbg-idx-map-toggle-btn svg {
    flex-shrink: 0;
}

/* ───── Map Section Collapse Animation ───── */
.tbg-idx-map-section {
    position: relative;
    overflow: visible;
}

/* Position the toggle button in the heading row */
.tbg-idx-section-toggle {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 5;
}

.tbg-idx-map-section .tbg-idx-map-container {
    transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.35s ease;
    max-height: 500px;
    overflow: hidden;
}

.tbg-idx-map-section.is-map-collapsed .tbg-idx-map-container {
    max-height: 0;
    opacity: 0;
    margin-top: 0 !important;
    pointer-events: none;
    border: none;
    box-shadow: none;
}

.tbg-idx-map-section.is-map-collapsed .tbg-idx-map-container+p {
    display: none;
}

/* Keep the Leaflet control visible when collapsed by moving it outside flow */
.tbg-idx-map-section.is-map-collapsed .leaflet-top.leaflet-left {
    position: fixed;
}

.tbg-idx-listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Theme Listing Card */
.tbg-idx-theme-card {
    background: var(--bg-card, #ffffff);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border, #f0f0f0);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.tbg-idx-theme-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--gold, #d4af37);
}

.tbg-idx-card-link {
    text-decoration: none !important;
    color: inherit !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tbg-idx-card-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--border, #f3f4f6);
}

.tbg-idx-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tbg-idx-theme-card:hover .tbg-idx-card-image img {
    transform: scale(1.05);
}

.tbg-idx-fallback-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #9ca3af);
    font-size: 14px;
    font-weight: 500;
}

/* Pill / Badge */
.tbg-idx-status-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 2;
    background: var(--bg-card, #ffffff);
    color: var(--text-main, #111111);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tbg-idx-status-badge.status-sold,
.tbg-idx-status-badge.status-closed {
    background: #ef4444;
    color: #ffffff;
}

.tbg-idx-status-badge.status-pending {
    background: #f59e0b;
    color: #ffffff;
}

/* Favorite Button */
.tbg-idx-favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bg-card, rgba(255, 255, 255, 0.9));
    backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted, #9ca3af);
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tbg-idx-favorite-btn:hover {
    transform: scale(1.05);
    color: var(--text-main, #111111);
}

.tbg-idx-favorite-btn.is-active {
    color: #ef4444;
}

/* Card Body Content */
.tbg-idx-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.tbg-idx-card-price {
    font-family: var(--tbg-idx-font-mono, monospace);
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--text-main, #111111);
    line-height: 1.1;
}

.tbg-idx-card-stats {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted, #6b7280);
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.tbg-idx-card-stats span strong {
    color: var(--text-main, #111111);
    font-family: var(--tbg-idx-font-mono, monospace);
    font-weight: 600;
}

.tbg-idx-card-stats span:not(:last-child)::after {
    content: '•';
    margin-left: 12px;
    color: var(--border, #d1d5db);
}

.tbg-idx-card-address {
    margin: 0 0 8px 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-main, #374151);
}

.tbg-idx-address-bold {
    font-weight: 600;
    display: block;
}

.tbg-idx-address-city {
    color: var(--text-muted, #6b7280);
    font-size: 14px;
}

.tbg-idx-subdivision {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--gold, #d4af37);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tbg-idx-card-type {
    margin: auto 0 0 0;
    font-size: 12px;
    color: var(--text-muted, #9ca3af);
    padding-top: 12px;
    border-top: 1px solid var(--border, #f3f4f6);
}

/* Loading & Empty State */
.tbg-idx-loading-indicator {
    padding: 60px 20px;
    text-align: center;
}

.idx-spinner {
    border: 3px solid var(--border, rgba(0, 0, 0, 0.1));
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--gold, #d4af37);
    animation: idx-spin 1s linear infinite;
    display: inline-block;
}

.tbg-idx-no-results {
    padding: 60px 20px;
    text-align: center;
    font-size: 16px;
    color: var(--text-muted, #6b7280);
    background: var(--bg-card, #ffffff);
    border-radius: 16px;
    border: 1px dashed var(--border, #e5e7eb);
}

/* Pagination */
.tbg-idx-pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tbg-idx-page-btn {
    padding: 10px 20px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border, #e5e7eb);
    color: var(--text-main, #374151);
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--tbg-idx-font-family);
    font-size: 14px;
}

.tbg-idx-page-btn:hover {
    background: var(--border, #f3f4f6);
    color: var(--primary-color, #111111);
    border-color: var(--gold, #d4af37);
}

.tbg-idx-page-info {
    font-size: 14px;
    color: var(--text-muted, #6b7280);
    font-weight: 500;
}

/* Dark Mode Form Tweaks */
[data-theme="dark"] .tbg-idx-form-control,
.dark .tbg-idx-form-control,
.dark-theme .tbg-idx-form-control {
    background: rgba(0, 0, 0, 0.2) !important;
    color: var(--text-main, #fff) !important;
    border-color: var(--border, rgba(255, 255, 255, 0.1)) !important;
}

[data-theme="dark"] .tbg-idx-theme-container,
.dark .tbg-idx-theme-container,
.dark-theme .tbg-idx-theme-container {
    background: rgba(255, 255, 255, 0.03);
}

/* Media Queries */
@media (max-width: 768px) {
    .tbg-idx-search-results-area {
        flex-direction: column;
    }

    .tbg-idx-map-col {
        height: 400px;
        position: relative;
        top: 0;
        min-width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Registration Modal (3-Heart Rule Progressive Capture)
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.tbg-idx-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.tbg-idx-modal-card {
    background: var(--tbg-idx-card-bg-color, #ffffff);
    border-radius: 20px;
    padding: 40px 36px;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.03);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-modal-overlay.is-visible .tbg-idx-modal-card {
    transform: scale(1) translateY(0);
}

.tbg-idx-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--tbg-idx-border-color, #f0f0f0);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    transition: all 0.2s;
    line-height: 1;
}

.tbg-idx-modal-close:hover {
    background: #ef4444;
    color: #fff;
    transform: scale(1.05);
}

.tbg-idx-modal-header {
    text-align: center;
    margin-bottom: 28px;
}

.tbg-idx-modal-header svg {
    margin-bottom: 12px;
}

.tbg-idx-modal-header h2 {
    font-family: var(--tbg-idx-font-heading, serif);
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-modal-header p {
    font-size: 14px;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    margin: 0;
    line-height: 1.5;
}

.tbg-idx-modal-form .tbg-idx-input-field {
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 12px;
    background: var(--tbg-idx-bg-color, #f9fafb);
    color: var(--tbg-idx-text-color, #1a1a1a);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.tbg-idx-modal-form .tbg-idx-input-field:focus {
    outline: none;
    border-color: var(--tbg-idx-primary-color, #111);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

.tbg-idx-modal-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tbg-idx-modal-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    margin-bottom: 20px;
    line-height: 1.5;
    cursor: pointer;
}

.tbg-idx-modal-consent input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.tbg-idx-modal-consent a {
    color: var(--tbg-idx-primary-color, #111);
    text-decoration: underline;
}

.tbg-idx-modal-form .tbg-idx-submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: var(--tbg-idx-primary-color, #111);
    color: var(--tbg-idx-button-text-color, #fff);
    font-family: var(--tbg-idx-font-family);
    transition: all 0.2s;
}

.tbg-idx-modal-form .tbg-idx-submit-btn:hover {
    background: var(--tbg-idx-primary-hover, #333);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════════════
   Portal Dashboard Styles
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-portal-dashboard {
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-portal-auth {
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color, #1a1a1a);
    max-width: 600px;
    margin: 0 auto;
}

.tbg-idx-portal-auth h3 {
    font-family: var(--tbg-idx-font-heading, serif);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

.tbg-idx-portal-auth .input,
.tbg-idx-portal-auth .tbg-idx-input-field {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 10px;
    font-size: 14px;
    background: var(--tbg-idx-bg-color, #f9fafb);
    color: var(--tbg-idx-text-color, #1a1a1a);
    font-family: inherit;
    box-sizing: border-box;
}

/* Dark mode for modal */
[data-theme="dark"] .tbg-idx-modal-card,
.dark .tbg-idx-modal-card,
.dark-mode .tbg-idx-modal-card {
    background: var(--card-bg, #1a1d24);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .tbg-idx-modal-form .tbg-idx-input-field,
.dark .tbg-idx-modal-form .tbg-idx-input-field {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main, #f3f4f6);
}

/* Mobile responsive modal */
@media (max-width: 520px) {
    .tbg-idx-modal-card {
        padding: 28px 24px;
    }

    .tbg-idx-modal-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .tbg-idx-modal-header h2 {
        font-size: 18px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Dashboard Layout (Sprint 2)
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-portal-dashboard {
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color, #1a1a1a);
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* Dashboard Header */
.tbg-idx-dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--tbg-idx-border-color, #f0f0f0);
}

.tbg-idx-dash-header-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tbg-idx-dash-avatar {
    flex-shrink: 0;
}

.tbg-idx-dash-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
}

.tbg-idx-dash-title {
    font-family: var(--tbg-idx-font-heading, serif);
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 2px;
}

.tbg-idx-dash-email {
    color: var(--tbg-idx-text-color-muted, #6b7280);
    font-size: 14px;
    margin: 0;
}

.tbg-idx-dash-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 8px;
    text-decoration: none;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.tbg-idx-dash-logout:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.04);
}

/* Tab Navigation */
.tbg-idx-dash-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--tbg-idx-border-color, #f0f0f0);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tbg-idx-dash-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
    bottom: -1px;
}

.tbg-idx-dash-tab:hover {
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-dash-tab.active {
    color: var(--tbg-idx-text-color, #1a1a1a);
    border-bottom-color: var(--tbg-idx-primary-color, #111);
}

.tbg-idx-dash-tab svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.tbg-idx-dash-tab.active svg {
    opacity: 1;
}

.tbg-idx-dash-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    background: var(--tbg-idx-border-color, #f0f0f0);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--tbg-idx-text-color-muted, #6b7280);
}

.tbg-idx-dash-tab.active .tbg-idx-dash-badge {
    background: var(--tbg-idx-primary-color, #111);
    color: var(--tbg-idx-button-text-color, #fff);
}

/* Properties Grid */
.tbg-idx-dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Empty State */
.tbg-idx-empty-state {
    padding: 60px 40px;
    text-align: center;
    background: var(--tbg-idx-card-bg-color, #fafafa);
    border-radius: 16px;
    border: 1px dashed var(--tbg-idx-border-color, #e5e7eb);
}

.tbg-idx-empty-state svg {
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    margin-bottom: 16px;
}

.tbg-idx-empty-state h4 {
    font-family: var(--tbg-idx-font-heading, serif);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
}

.tbg-idx-empty-state p {
    color: var(--tbg-idx-text-color-muted, #6b7280);
    font-size: 14px;
    margin: 0 0 20px;
    line-height: 1.5;
}

/* Account Settings Grid */
.tbg-idx-account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.tbg-idx-account-card {
    background: var(--tbg-idx-card-bg-color, #fff);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 0 0 1px rgba(0, 0, 0, .03);
}

.tbg-idx-account-info {
    grid-column: 1 / -1;
}

.tbg-idx-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--tbg-idx-font-family);
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--tbg-idx-border-color, #f0f0f0);
}

.tbg-idx-card-title svg {
    opacity: 0.5;
}

/* Info Grid (read-only data) */
.tbg-idx-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.tbg-idx-info-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tbg-idx-info-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tbg-idx-info-value {
    font-size: 15px;
    font-weight: 600;
    font-family: var(--tbg-idx-font-mono, monospace);
}

/* Form Utilities */
.tbg-idx-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tbg-idx-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.tbg-idx-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--tbg-idx-text-color-muted, #6b7280);
}

.tbg-idx-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.tbg-idx-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    line-height: 1.5;
    margin-bottom: 16px;
    cursor: pointer;
}

.tbg-idx-consent-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

/* Notices */
.tbg-idx-notice {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.tbg-idx-notice-success {
    color: #065f46;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.tbg-idx-notice-error {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Portal Auth/Link Helpers  */
.tbg-idx-portal-section {
    margin-bottom: 32px;
}

.tbg-idx-portal-divider {
    text-align: center;
    margin: 16px 0;
}

.tbg-idx-portal-hr {
    border: none;
    border-top: 1px solid var(--tbg-idx-border-color, #f0f0f0);
    margin: 24px 0;
}

.tbg-idx-link-muted {
    color: var(--tbg-idx-text-color-muted, #6b7280);
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tbg-idx-link-muted:hover {
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-text-muted {
    color: var(--tbg-idx-text-color-muted, #6b7280);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════
   Dark Mode — Full Portal Inheritance
   ═══════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .tbg-idx-portal-auth,
[data-theme="dark"] .tbg-idx-portal-dashboard,
.dark .tbg-idx-portal-auth,
.dark .tbg-idx-portal-dashboard {
    color: var(--text-main, #e5e7eb);
}

/* Dashboard header + tabs */
[data-theme="dark"] .tbg-idx-dash-title,
.dark .tbg-idx-dash-title {
    color: var(--text-main, #f3f4f6);
}

[data-theme="dark"] .tbg-idx-dash-tab,
.dark .tbg-idx-dash-tab {
    color: var(--text-muted, #9ca3af);
}

[data-theme="dark"] .tbg-idx-dash-tab.active,
.dark .tbg-idx-dash-tab.active {
    color: var(--text-main, #f3f4f6);
    border-color: #3b82f6;
}

[data-theme="dark"] .tbg-idx-dash-tab:hover,
.dark .tbg-idx-dash-tab:hover {
    color: var(--text-main, #f3f4f6);
}

/* Cards */
[data-theme="dark"] .tbg-idx-card,
[data-theme="dark"] .tbg-idx-account-card,
.dark .tbg-idx-card,
.dark .tbg-idx-account-card {
    background: var(--card-bg, #1a1d24);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tbg-idx-card-title,
.dark .tbg-idx-card-title {
    color: var(--text-main, #f3f4f6);
}

/* Input fields */
[data-theme="dark"] .tbg-idx-input-field,
.dark .tbg-idx-input-field {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-main, #e5e7eb);
}

[data-theme="dark"] .tbg-idx-input-field:focus,
.dark .tbg-idx-input-field:focus {
    border-color: #3b82f6;
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tbg-idx-input-field::placeholder,
.dark .tbg-idx-input-field::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

/* Buttons */
[data-theme="dark"] .tbg-idx-submit-btn,
.dark .tbg-idx-submit-btn {
    background: #3b82f6;
    color: #fff;
}

[data-theme="dark"] .tbg-idx-submit-btn:hover,
.dark .tbg-idx-submit-btn:hover {
    background: #2563eb;
}

/* Labels and muted text */
[data-theme="dark"] .tbg-idx-form-group label,
[data-theme="dark"] .tbg-idx-consent-label,
[data-theme="dark"] .tbg-idx-text-muted,
.dark .tbg-idx-form-group label,
.dark .tbg-idx-consent-label,
.dark .tbg-idx-text-muted {
    color: var(--text-muted, #9ca3af);
}

[data-theme="dark"] .tbg-idx-link-muted,
.dark .tbg-idx-link-muted {
    color: var(--text-muted, #9ca3af);
}

[data-theme="dark"] .tbg-idx-link-muted:hover,
.dark .tbg-idx-link-muted:hover {
    color: var(--text-main, #f3f4f6);
}

/* Auth divider / HR */
[data-theme="dark"] .tbg-idx-portal-hr,
.dark .tbg-idx-portal-hr {
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tbg-idx-portal-divider,
.dark .tbg-idx-portal-divider {
    color: var(--text-muted, #6b7280);
}

/* Empty state */
[data-theme="dark"] .tbg-idx-empty-state,
.dark .tbg-idx-empty-state {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text-muted, #9ca3af);
}

[data-theme="dark"] .tbg-idx-empty-state h4,
.dark .tbg-idx-empty-state h4 {
    color: var(--text-main, #f3f4f6);
}

/* Notices */
[data-theme="dark"] .tbg-idx-notice-success,
.dark .tbg-idx-notice-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

[data-theme="dark"] .tbg-idx-notice-error,
.dark .tbg-idx-notice-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Listing cards in dashboard */
[data-theme="dark"] .tbg-idx-dash-listing-card,
.dark .tbg-idx-dash-listing-card {
    background: var(--card-bg, #1a1d24);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tbg-idx-dash-listing-card:hover,
.dark .tbg-idx-dash-listing-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Dashboard Mobile Responsive */
@media (max-width: 768px) {
    .tbg-idx-dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .tbg-idx-dash-tabs {
        gap: 0;
    }

    .tbg-idx-dash-tab {
        padding: 10px 14px;
        font-size: 13px;
    }

    .tbg-idx-account-grid {
        grid-template-columns: 1fr;
    }

    .tbg-idx-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .tbg-idx-dash-grid {
        grid-template-columns: 1fr;
    }

    .tbg-idx-dash-title {
        font-size: 20px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Nearby Listings Carousel (Single Listing Page)
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-map-section {
    overflow: visible;
    position: relative;
    width: 100%;
    min-width: 0;
}

.tbg-idx-nearby-carousel-wrap {
    margin-top: 2rem;
    max-width: 100%;
    overflow: visible;
    position: relative;
}

.tbg-idx-nearby-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.tbg-idx-nearby-title {
    font-family: var(--tbg-idx-font-heading, serif);
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-nearby-nav {
    display: flex;
    gap: 8px;
}

.tbg-idx-carousel-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    background: var(--tbg-idx-card-bg-color, #fff);
    color: var(--tbg-idx-text-color, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tbg-idx-carousel-arrow:hover {
    background: var(--tbg-idx-primary-color, #111);
    color: var(--tbg-idx-button-text-color, #fff);
    border-color: var(--tbg-idx-primary-color, #111);
    transform: scale(1.05);
}

.tbg-idx-nearby-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    max-width: 100%;

    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tbg-idx-nearby-carousel::-webkit-scrollbar {
    display: none;
}

a.tbg-idx-nearby-card,
a.tbg-idx-nearby-card:visited,
a.tbg-idx-nearby-card:hover,
a.tbg-idx-nearby-card:focus,
a.tbg-idx-nearby-card:active,
.tbg-idx-nearby-card {
    flex: 0 0 260px;
    scroll-snap-align: start;
    border-radius: 14px;
    overflow: hidden;
    background: var(--tbg-idx-card-bg-color, #fff);
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    text-decoration: none !important;
    color: inherit;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    outline: none;
}

.tbg-idx-nearby-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    border-color: var(--tbg-idx-primary-color, #d4af37);
    text-decoration: none !important;
}

.tbg-idx-nearby-card-img {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: var(--tbg-idx-bg-color-alt, #f3f4f6);
}

.tbg-idx-nearby-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.tbg-idx-nearby-card:hover .tbg-idx-nearby-card-img img {
    transform: scale(1.06);
}

.tbg-idx-nearby-card-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    background: var(--tbg-idx-bg-color-alt, #f3f4f6);
}

.tbg-idx-nearby-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.tbg-idx-nearby-card-price {
    font-family: var(--tbg-idx-font-mono, monospace);
    font-size: 18px;
    font-weight: 700;
    color: var(--tbg-idx-text-color, #111);
    line-height: 1.2;
}

.tbg-idx-nearby-card-stats {
    font-size: 13px;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    font-weight: 500;
}

.tbg-idx-nearby-card-address {
    font-size: 12px;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Dark Mode */
[data-theme="dark"] .tbg-idx-nearby-card,
.dark .tbg-idx-nearby-card {
    background: var(--card-bg, #1a1d24);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tbg-idx-carousel-arrow,
.dark .tbg-idx-carousel-arrow {
    background: var(--card-bg, #1a1d24);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Mobile */
@media (max-width: 768px) {
    .tbg-idx-nearby-card {
        flex: 0 0 220px;
    }

    .tbg-idx-nearby-card-img {
        height: 130px;
    }

    .tbg-idx-nearby-card-price {
        font-size: 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Google OAuth Button (Sprint 3)
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 20px;
    background: #fff;
    border: 1px solid var(--tbg-idx-border-color, #dadce0);
    border-radius: 12px;
    color: #3c4043;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--tbg-idx-font-family);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    box-sizing: border-box;
}

.tbg-idx-google-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
    border-color: #c4c7c9;
}

.tbg-idx-google-btn svg {
    flex-shrink: 0;
}

.tbg-idx-auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.tbg-idx-auth-divider::before,
.tbg-idx-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--tbg-idx-border-color, #e5e7eb);
}

/* Dark mode Google button */
[data-theme="dark"] .tbg-idx-google-btn,
.dark .tbg-idx-google-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-main, #e5e7eb);
}

[data-theme="dark"] .tbg-idx-google-btn:hover,
.dark .tbg-idx-google-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════
   Saved Searches Tab (Sprint 5)
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-saved-searches-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tbg-idx-saved-search-card {
    padding: 20px;
    background: var(--tbg-idx-card-bg, #fff);
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 12px;
    transition: box-shadow 0.2s;
}

.tbg-idx-saved-search-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tbg-idx-saved-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.tbg-idx-saved-search-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--tbg-idx-text-color, #1a1a1a);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.tbg-idx-saved-search-label:hover {
    color: #2563eb;
}

.tbg-idx-saved-search-actions {
    display: flex;
    gap: 8px;
}

.tbg-idx-alert-toggle,
.tbg-idx-search-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    transition: all 0.2s;
}

.tbg-idx-alert-toggle:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.tbg-idx-alert-toggle.is-active {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

.tbg-idx-search-delete:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.tbg-idx-saved-search-criteria {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.tbg-idx-criteria-tag {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
}

.tbg-idx-saved-search-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
}

.tbg-idx-alert-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #2563eb;
    font-weight: 500;
}

/* Dark mode */
[data-theme="dark"] .tbg-idx-saved-search-card,
.dark .tbg-idx-saved-search-card {
    background: var(--card-bg, #1a1d24);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tbg-idx-criteria-tag,
.dark .tbg-idx-criteria-tag {
    background: rgba(37, 99, 235, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════
   Featured Listings Shortcode
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-featured-section {
    margin: 40px 0;
}

.tbg-idx-featured-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.tbg-idx-featured-title {
    font-family: var(--tbg-idx-font-heading, serif);
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-featured-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tbg-idx-primary-color, #111);
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.tbg-idx-featured-cta:hover {
    background: var(--tbg-idx-primary-color, #111);
    color: var(--tbg-idx-button-text-color, #fff);
    border-color: var(--tbg-idx-primary-color, #111);
}

.tbg-idx-featured-grid {
    display: grid;
    gap: 20px;
}

.tbg-idx-featured-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.tbg-idx-featured-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.tbg-idx-featured-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .tbg-idx-featured-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {

    .tbg-idx-featured-cols-3,
    .tbg-idx-featured-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .tbg-idx-featured-title {
        font-size: 22px;
    }

    .tbg-idx-featured-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 520px) {

    .tbg-idx-featured-cols-2,
    .tbg-idx-featured-cols-3,
    .tbg-idx-featured-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* Dark mode */
[data-theme="dark"] .tbg-idx-featured-title,
.dark .tbg-idx-featured-title {
    color: var(--text-main, #f3f4f6);
}

[data-theme="dark"] .tbg-idx-featured-cta,
.dark .tbg-idx-featured-cta {
    color: var(--text-main, #e5e7eb);
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .tbg-idx-featured-cta:hover,
.dark .tbg-idx-featured-cta:hover {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* ═══════════════════════════════════════════════════════════════════════
   Market Stats Shortcode
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-market-stats {
    margin: 40px 0;
}

.tbg-idx-market-stats__title {
    font-family: var(--tbg-idx-font-heading, serif);
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 24px;
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-market-stats__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.tbg-idx-market-stats__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 20px;
    background: var(--tbg-idx-card-bg-color, #fff);
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
    transition: all 0.25s ease;
}

.tbg-idx-market-stats__card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.1);
}

.tbg-idx-market-stats__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    margin-bottom: 16px;
}

.tbg-idx-market-stats__value {
    font-family: var(--tbg-idx-font-mono, monospace);
    font-size: 26px;
    font-weight: 700;
    color: var(--tbg-idx-text-color, #111);
    line-height: 1.2;
    margin-bottom: 6px;
}

.tbg-idx-market-stats__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Inline style variant */
.tbg-idx-market-stats--inline .tbg-idx-market-stats__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
}

.tbg-idx-market-stats--inline .tbg-idx-market-stats__card {
    flex: 1 1 180px;
    padding: 20px 16px;
    border: none;
    box-shadow: none;
    background: transparent;
}

.tbg-idx-market-stats--inline .tbg-idx-market-stats__card:hover {
    transform: none;
}

@media (max-width: 900px) {
    .tbg-idx-market-stats__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .tbg-idx-market-stats__grid {
        grid-template-columns: 1fr;
    }

    .tbg-idx-market-stats__title {
        font-size: 22px;
    }

    .tbg-idx-market-stats__value {
        font-size: 22px;
    }
}

/* Dark mode */
[data-theme="dark"] .tbg-idx-market-stats__title,
.dark .tbg-idx-market-stats__title {
    color: var(--text-main, #f3f4f6);
}

[data-theme="dark"] .tbg-idx-market-stats__card,
.dark .tbg-idx-market-stats__card {
    background: var(--card-bg, #1a1d24);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tbg-idx-market-stats__value,
.dark .tbg-idx-market-stats__value {
    color: var(--text-main, #f3f4f6);
}

[data-theme="dark"] .tbg-idx-market-stats__icon,
.dark .tbg-idx-market-stats__icon {
    background: rgba(59, 130, 246, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════
   City Links Shortcode
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-city-links {
    margin: 40px 0;
}

.tbg-idx-city-links__title {
    font-family: var(--tbg-idx-font-heading, serif);
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 24px;
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-city-links__grid {
    display: grid;
    gap: 12px;
}

.tbg-idx-city-links__cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.tbg-idx-city-links__cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.tbg-idx-city-links__cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

a.tbg-idx-city-links__card,
a.tbg-idx-city-links__card:visited {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--tbg-idx-card-bg-color, #fff);
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
}

a.tbg-idx-city-links__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.1);
    border-color: var(--tbg-idx-primary-color, #2563eb);
}

.tbg-idx-city-links__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    flex-shrink: 0;
}

.tbg-idx-city-links__name {
    font-size: 16px;
    font-weight: 600;
    color: var(--tbg-idx-text-color, #1a1a1a);
    flex: 1;
}

.tbg-idx-city-links__count {
    font-size: 13px;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    font-weight: 500;
    white-space: nowrap;
}

.tbg-idx-city-links__arrow {
    display: flex;
    align-items: center;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    flex-shrink: 0;
    transition: transform 0.2s;
}

a.tbg-idx-city-links__card:hover .tbg-idx-city-links__arrow {
    transform: translateX(3px);
    color: var(--tbg-idx-primary-color, #2563eb);
}

/* List style variant */
.tbg-idx-city-links--list .tbg-idx-city-links__grid {
    grid-template-columns: 1fr !important;
    max-width: 600px;
}

.tbg-idx-city-links--list .tbg-idx-city-links__card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow: none;
    padding: 14px 0;
}

.tbg-idx-city-links--list .tbg-idx-city-links__card:hover {
    transform: none;
    box-shadow: none;
}

@media (max-width: 768px) {

    .tbg-idx-city-links__cols-3,
    .tbg-idx-city-links__cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .tbg-idx-city-links__title {
        font-size: 22px;
    }
}

@media (max-width: 520px) {

    .tbg-idx-city-links__cols-2,
    .tbg-idx-city-links__cols-3,
    .tbg-idx-city-links__cols-4 {
        grid-template-columns: 1fr;
    }
}

/* Dark mode */
[data-theme="dark"] .tbg-idx-city-links__title,
.dark .tbg-idx-city-links__title {
    color: var(--text-main, #f3f4f6);
}

[data-theme="dark"] a.tbg-idx-city-links__card,
.dark a.tbg-idx-city-links__card {
    background: var(--card-bg, #1a1d24);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tbg-idx-city-links__name,
.dark .tbg-idx-city-links__name {
    color: var(--text-main, #f3f4f6);
}

[data-theme="dark"] .tbg-idx-city-links__icon,
.dark .tbg-idx-city-links__icon {
    background: rgba(59, 130, 246, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════
   Standalone Map Shortcode
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-standalone-map-wrap {
    margin: 24px 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.tbg-idx-standalone-map {
    z-index: 1;
}

/* Price marker pill */
.tbg-idx-price-marker {
    background: transparent !important;
    border: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   Contact Agent Form Shortcode
   ═══════════════════════════════════════════════════════════════════════ */
.tbg-idx-contact-agent {
    max-width: 560px;
    margin: 24px 0;
    padding: 28px;
    background: var(--tbg-idx-card-bg-color, #fff);
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.tbg-idx-contact-agent__title {
    font-family: var(--tbg-idx-font-heading, serif);
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-contact-agent__mls-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    margin-bottom: 16px;
}

.tbg-idx-contact-agent__form textarea.tbg-idx-input-field {
    resize: vertical;
    min-height: 80px;
}

.tbg-idx-contact-agent .tbg-idx-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Dark mode */
[data-theme="dark"] .tbg-idx-contact-agent,
.dark .tbg-idx-contact-agent {
    background: var(--card-bg, #1a1d24);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .tbg-idx-contact-agent__title,
.dark .tbg-idx-contact-agent__title {
    color: var(--text-main, #f3f4f6);
}

[data-theme="dark"] .tbg-idx-contact-agent__mls-badge,
.dark .tbg-idx-contact-agent__mls-badge {
    background: rgba(59, 130, 246, 0.15);
}

@media (max-width: 520px) {
    .tbg-idx-contact-agent {
        padding: 20px 16px;
    }

    .tbg-idx-contact-agent .tbg-idx-form-row {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════
   EXPLORE HOMES — Tabbed Widget
   ═══════════════════════════════════════════════════════════ */

.tbg-idx-explore-section {
    max-width: 1400px;
    margin: 3rem auto;
    padding: 0 1rem;
    font-family: var(--tbg-idx-font-family);
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: wrap !important;
    position: relative;
    overflow: visible;
}

.tbg-idx-explore-heading {
    font-family: var(--tbg-idx-font-heading);
    font-size: clamp(28px, 4vw, 40px) !important;
    font-weight: 600;
    margin: 0 0 1.5rem 0 !important;
    padding: 0;
    color: var(--tbg-idx-text-color, #1a1a1a);
    display: block !important;
    position: relative;
    z-index: 2;
    width: 100% !important;
    flex: 0 0 100% !important;
    text-align: center;
}

/* Tab Bar — Scrollable with fade indicators */
.tbg-idx-explore-tabs-wrapper {
    position: relative;
    width: 100%;
}

.tbg-idx-explore-tabs-wrapper::before,
.tbg-idx-explore-tabs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tbg-idx-explore-tabs-wrapper::before {
    left: 0;
    background: linear-gradient(to right, var(--tbg-idx-bg-color, #faf9f7), transparent);
}

.tbg-idx-explore-tabs-wrapper::after {
    right: 0;
    background: linear-gradient(to left, var(--tbg-idx-bg-color, #faf9f7), transparent);
}

.tbg-idx-explore-tabs-wrapper.can-scroll-left::before {
    opacity: 1;
}

.tbg-idx-explore-tabs-wrapper.can-scroll-right::after {
    opacity: 1;
}

/* Scroll Arrow Buttons */
.tbg-idx-explore-scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--tbg-idx-card-bg-color, #fff);
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--tbg-idx-text-color, #1a1a1a);
    transition: all 0.2s ease;
    padding: 0;
}

.tbg-idx-explore-scroll-arrow:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.tbg-idx-explore-scroll-arrow--left {
    left: 0;
}

.tbg-idx-explore-scroll-arrow--right {
    right: 0;
}

.tbg-idx-explore-tabs-wrapper.can-scroll-left .tbg-idx-explore-scroll-arrow--left,
.tbg-idx-explore-tabs-wrapper.can-scroll-right .tbg-idx-explore-scroll-arrow--right {
    display: flex;
}

.tbg-idx-explore-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--tbg-idx-border-color, #f0f0f0);
    scroll-behavior: smooth;
}

.tbg-idx-explore-tabs::-webkit-scrollbar {
    display: none;
}

.tbg-idx-explore-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s ease;
    font-family: var(--tbg-idx-font-family);
    border-radius: 0;
}

.tbg-idx-explore-tab:hover {
    color: var(--tbg-idx-text-color, #1a1a1a);
}

.tbg-idx-explore-tab.is-active {
    color: var(--tbg-idx-text-color, #1a1a1a);
    font-weight: 600;
}

.tbg-idx-explore-tab.is-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--tbg-idx-primary-color, #111);
    border-radius: 1px;
}

.tbg-idx-explore-tab svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.tbg-idx-explore-tab.is-active svg {
    opacity: 1;
}

/* Viewport + Arrows */
.tbg-idx-explore-viewport {
    position: relative;
}

.tbg-idx-explore-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tbg-idx-text-color, #1a1a1a);
    transition: all 0.2s ease;
}

.tbg-idx-explore-arrow:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%) scale(1.05);
}

.tbg-idx-explore-arrow--prev {
    left: -20px;
}

.tbg-idx-explore-arrow--next {
    right: -20px;
}

/* Card Grid (horizontal scroll with snap) */
.tbg-idx-explore-grid {
    display: grid;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 0;
    scroll-behavior: smooth;
    touch-action: pan-x pan-y;
}

.tbg-idx-explore-grid::-webkit-scrollbar {
    display: none;
}

.tbg-idx-explore-cols-4 {
    grid-auto-flow: column;
    grid-auto-columns: calc(25% - 12px);
}

.tbg-idx-explore-cols-3 {
    grid-auto-flow: column;
    grid-auto-columns: calc(33.33% - 11px);
}

.tbg-idx-explore-cols-2 {
    grid-auto-flow: column;
    grid-auto-columns: calc(50% - 8px);
}

/* Card Wrapper */
.tbg-idx-explore-card-wrapper {
    position: relative;
    scroll-snap-align: start;
    min-width: 0;
}

/* Days Ago Badge */
.tbg-idx-explore-days-badge {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: var(--tbg-idx-font-family);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    white-space: nowrap;
    line-height: 1.3;
    pointer-events: none;
}

/* Pagination Dots */
.tbg-idx-explore-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 1.25rem;
}

.tbg-idx-explore-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: #d1d5db;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.tbg-idx-explore-dot.is-active {
    background: var(--tbg-idx-primary-color, #111);
    width: 20px;
    border-radius: 4px;
}

/* Loading State */
.tbg-idx-explore-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    grid-column: 1 / -1;
}

.tbg-idx-explore-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--tbg-idx-border-color, #e5e7eb);
    border-top-color: var(--tbg-idx-primary-color, #111);
    border-radius: 50%;
    animation: tbgIdxSpin 0.7s linear infinite;
}

@keyframes tbgIdxSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.tbg-idx-explore-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--tbg-idx-text-color-muted, #6b7280);
}

.tbg-idx-explore-empty p {
    margin: 0;
    font-size: 15px;
}

/* Responsive */
@media (max-width: 1024px) {
    .tbg-idx-explore-cols-4 {
        grid-auto-columns: calc(33.33% - 11px);
    }

    .tbg-idx-explore-arrow--prev {
        left: -10px;
    }

    .tbg-idx-explore-arrow--next {
        right: -10px;
    }
}

@media (max-width: 768px) {

    .tbg-idx-explore-cols-4,
    .tbg-idx-explore-cols-3 {
        grid-auto-columns: calc(50% - 8px);
    }

    .tbg-idx-explore-arrow {
        display: none !important;
    }

    .tbg-idx-explore-section {
        padding: 0 0.75rem;
    }
}

@media (max-width: 480px) {

    .tbg-idx-explore-cols-4,
    .tbg-idx-explore-cols-3,
    .tbg-idx-explore-cols-2 {
        grid-auto-columns: calc(85% - 8px);
    }

    .tbg-idx-explore-grid {
        padding: 4px 4px;
        scroll-padding-left: 4px;
    }

    .tbg-idx-explore-tab {
        padding: 8px 14px;
        font-size: 13px;
        min-height: 40px;
    }

    .tbg-idx-explore-section {
        overflow-x: hidden;
    }
}


/* ═══════════════════════════════════════════════════════════
   3D TOUR BADGE — Listing Cards
   ═══════════════════════════════════════════════════════════ */

.tbg-idx-lc-badge.badge-3d-tour {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(79, 70, 229, 0.9);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.tbg-idx-lc-badge.badge-3d-tour svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}



/* Override theme global section styles for plugin sections */
.tbg-idx-map-section {
    min-height: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    display: block !important;
}

/* ═══════════════════════════════════════════════════════════
   VIRTUAL TOUR EMBED — Single Listing
   ═══════════════════════════════════════════════════════════ */

.tbg-idx-virtual-tour-section {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--tbg-idx-border-color, rgba(128, 128, 128, 0.15));
    /* Override theme global section styles */
    min-height: auto !important;
    padding: 0 !important;
    display: block !important;
}

/* Top bar */
.tbg-idx-vt-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.tbg-idx-vt-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
}

.tbg-idx-vt-label svg {
    opacity: 0.8;
}

.tbg-idx-vt-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tbg-idx-vt-ctrl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    padding: 0;
}

.tbg-idx-vt-ctrl:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

/* Iframe */
.tbg-idx-vt-iframe {
    display: block;
    width: 100%;
    height: 450px;
    border: none;
    background: #111;
}

/* Fullscreen Mode */
.tbg-idx-virtual-tour-section.is-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    margin: 0;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
}

.tbg-idx-virtual-tour-section.is-fullscreen .tbg-idx-vt-iframe {
    flex: 1;
    height: 100%;
}

@media (max-width: 768px) {
    .tbg-idx-vt-iframe {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .tbg-idx-vt-fullscreen-btn span {
        display: none;
    }

    .tbg-idx-vt-fullscreen-btn {
        padding: 8px;
    }

    .tbg-idx-vt-header {
        padding: 12px 16px;
    }
}


/* ═══════════════════════════════════════════════════════════
   3D TOUR TOGGLE — Search Form
   ═══════════════════════════════════════════════════════════ */

.tbg-idx-filter-toggle {
    display: flex;
    align-items: center;
}

.tbg-idx-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.tbg-idx-toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tbg-idx-toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: #d1d5db;
    border-radius: 11px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.tbg-idx-toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.tbg-idx-toggle-label input:checked+.tbg-idx-toggle-switch {
    background: #4f46e5;
}

.tbg-idx-toggle-label input:checked+.tbg-idx-toggle-switch::after {
    transform: translateX(18px);
}

.tbg-idx-toggle-text {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tbg-idx-text-color, #374151);
}

.tbg-idx-toggle-text svg {
    flex-shrink: 0;
    opacity: 0.7;
}


/* ═══════════════════════════════════════════════════════════
   DARK MODE OVERRIDES — New Components
   ═══════════════════════════════════════════════════════════ */

[data-theme="dark"] .tbg-idx-explore-section,
.dark .tbg-idx-explore-section {
    color: var(--text-main, #f3f4f6);
}

[data-theme="dark"] .tbg-idx-explore-heading,
.dark .tbg-idx-explore-heading {
    color: var(--text-main, #f3f4f6);
}

[data-theme="dark"] .tbg-idx-explore-tabs,
.dark .tbg-idx-explore-tabs {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .tbg-idx-explore-tab,
.dark .tbg-idx-explore-tab {
    color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .tbg-idx-explore-tab:hover,
[data-theme="dark"] .tbg-idx-explore-tab.is-active,
.dark .tbg-idx-explore-tab:hover,
.dark .tbg-idx-explore-tab.is-active {
    color: #f3f4f6;
}

[data-theme="dark"] .tbg-idx-explore-tab.is-active::after,
.dark .tbg-idx-explore-tab.is-active::after {
    background: #e2e8f0;
}

[data-theme="dark"] .tbg-idx-explore-arrow,
.dark .tbg-idx-explore-arrow {
    background: rgba(26, 29, 36, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

[data-theme="dark"] .tbg-idx-explore-dot,
.dark .tbg-idx-explore-dot {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .tbg-idx-explore-dot.is-active,
.dark .tbg-idx-explore-dot.is-active {
    background: #e2e8f0;
}

[data-theme="dark"] .tbg-idx-explore-spinner,
.dark .tbg-idx-explore-spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: #e2e8f0;
}

[data-theme="dark"] .tbg-idx-virtual-tour-section,
.dark .tbg-idx-virtual-tour-section {
    border-color: rgba(255, 255, 255, 0.1);
    background: var(--card-bg, #161b22);
}

[data-theme="dark"] .tbg-idx-vt-header,
.dark .tbg-idx-vt-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .tbg-idx-vt-fullscreen-btn,
.dark .tbg-idx-vt-fullscreen-btn {
    color: var(--text-main, #f3f4f6);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .tbg-idx-toggle-switch,
.dark .tbg-idx-toggle-switch {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .tbg-idx-toggle-text,
.dark .tbg-idx-toggle-text {
    color: var(--text-main, #f3f4f6);
}


/* ═══════════════════════════════════════════════════════════
   3D TOUR QUICK-ACTION BUTTON — Single Listing Header
   ═══════════════════════════════════════════════════════════ */

.tbg-idx-tour-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
}

.tbg-idx-btn-3d-tour {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #7c3aed 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--tbg-idx-font-family);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
    letter-spacing: 0.01em;
}

.tbg-idx-btn-3d-tour:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 50%, #8b5cf6 100%);
}

.tbg-idx-btn-3d-tour:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3);
}

.tbg-idx-btn-3d-tour svg {
    flex-shrink: 0;
    opacity: 0.9;
}

.tbg-idx-btn-3d-tour-external {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    border-radius: 10px;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    text-decoration: none;
    transition: all 0.2s ease;
    background: transparent;
}

.tbg-idx-btn-3d-tour-external:hover {
    color: #4f46e5;
    border-color: #4f46e5;
    background: rgba(79, 70, 229, 0.05);
}

[data-theme="dark"] .tbg-idx-btn-3d-tour-external,
.dark .tbg-idx-btn-3d-tour-external {
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .tbg-idx-btn-3d-tour-external:hover,
.dark .tbg-idx-btn-3d-tour-external:hover {
    color: #818cf8;
    border-color: #818cf8;
    background: rgba(129, 140, 248, 0.1);
}

@media (max-width: 480px) {
    .tbg-idx-btn-3d-tour {
        font-size: 13px;
        padding: 9px 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   Single Listing Improvements — Sprint Enhancement
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Subject Property Pin (Single Listing Map) ─── */
.tbg-idx-subject-pin-wrapper {
    background: transparent !important;
    border: none !important;
}

.tbg-idx-subject-pin {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.tbg-idx-subject-pin-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #3b82f6;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4), 0 0 0 2px rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    position: relative;
}

.tbg-idx-subject-pin-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.25);
    animation: tbg-idx-pin-pulse 2s ease-out infinite;
    z-index: 1;
}

@keyframes tbg-idx-pin-pulse {
    0% {
        width: 36px;
        height: 36px;
        opacity: 0.6;
    }
    100% {
        width: 80px;
        height: 80px;
        opacity: 0;
    }
}

/* ─── Content Card (Opaque Background for Legibility) ─── */
.tbg-idx-content-card {
    background: var(--tbg-idx-card-bg-color, #fff);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
}

[data-theme="dark"] .tbg-idx-content-card,
.dark .tbg-idx-content-card {
    background: rgba(15, 17, 21, 0.95);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .tbg-idx-content-card {
        padding: 1.25rem 1rem;
        border-radius: 12px;
    }
}

/* ─── Breadcrumb Navigation ─── */
.tbg-idx-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    font-size: 13px;
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color-muted, #6b7280);
}

.tbg-idx-breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--tbg-idx-primary-color, #111);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.tbg-idx-breadcrumb-link:hover {
    color: var(--tbg-idx-primary-hover, #333);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tbg-idx-breadcrumb-sep {
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    font-size: 16px;
}

.tbg-idx-breadcrumb-current {
    color: var(--tbg-idx-text-color-muted, #9ca3af);
}

/* ─── Mobile Photo Counter Badge ─── */
.tbg-idx-photo-counter {
    display: none;
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--tbg-idx-font-family);
    align-items: center;
    gap: 5px;
    z-index: 5;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
    .tbg-idx-photo-counter {
        display: inline-flex;
    }
}

/* ─── Listed Date Banner (for Active Listings) ─── */
.tbg-idx-status-listed-banner {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .tbg-idx-status-listed-banner,
.dark .tbg-idx-status-listed-banner {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.25);
}

/* ─── Sticky Scroll-Spy Navigation ─── */
.tbg-idx-scroll-nav {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: var(--tbg-idx-card-bg-color, #fff);
    border: 1px solid var(--tbg-idx-border-color, #f0f0f0);
    border-radius: 12px;
    position: sticky;
    top: 1rem;
    z-index: 50;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tbg-idx-scroll-nav::-webkit-scrollbar {
    display: none;
}

.tbg-idx-scroll-nav-link {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color-muted, #6b7280);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tbg-idx-scroll-nav-link:hover {
    color: var(--tbg-idx-text-color, #1a1a1a);
    background: rgba(128, 128, 128, 0.06);
}

.tbg-idx-scroll-nav-link.active {
    color: var(--tbg-idx-text-color, #1a1a1a);
    background: var(--tbg-idx-bg-color, #f5f5f5);
    font-weight: 600;
}

[data-theme="dark"] .tbg-idx-scroll-nav,
.dark .tbg-idx-scroll-nav {
    background: var(--card-bg, rgba(26, 29, 36, 0.95));
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .tbg-idx-scroll-nav-link.active,
.dark .tbg-idx-scroll-nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main, #f3f4f6);
}

/* ─── Mortgage Calculator ─── */
.tbg-idx-mortgage-calc {
    margin-top: 1rem;
}

.tbg-idx-mortgage-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--tbg-idx-font-family);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1.25rem;
    color: var(--tbg-idx-text-color);
}

.tbg-idx-mortgage-title svg {
    opacity: 0.5;
}

.tbg-idx-mortgage-result {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.tbg-idx-mortgage-amount {
    font-family: var(--tbg-idx-font-mono);
    font-size: 28px;
    font-weight: 700;
    color: var(--tbg-idx-text-color);
    line-height: 1;
}

.tbg-idx-mortgage-label {
    font-size: 14px;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    font-family: var(--tbg-idx-font-family);
}

.tbg-idx-mortgage-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1rem;
}

.tbg-idx-mortgage-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tbg-idx-mortgage-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tbg-idx-mortgage-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tbg-idx-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.tbg-idx-input-group .tbg-idx-input-field {
    padding-right: 32px;
    margin-bottom: 0;
}

.tbg-idx-input-suffix {
    position: absolute;
    right: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    pointer-events: none;
}

.tbg-idx-mortgage-breakdown {
    border-top: 1px solid var(--tbg-idx-border-color, #f0f0f0);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tbg-idx-mortgage-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.tbg-idx-mortgage-line span:first-child {
    color: var(--tbg-idx-text-color-muted, #6b7280);
}

.tbg-idx-mortgage-line span:last-child {
    font-family: var(--tbg-idx-font-mono);
    font-weight: 600;
    color: var(--tbg-idx-text-color);
}

.tbg-idx-mortgage-disclaimer {
    font-size: 11px;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    margin: 12px 0 0;
    line-height: 1.4;
    font-style: italic;
}

/* Dark mode mortgage calc */
[data-theme="dark"] .tbg-idx-mortgage-result,
.dark .tbg-idx-mortgage-result {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.15);
}

/* ─── Lightbox Thumbnails Strip ─── */
.tbg-idx-lightbox-thumbs {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    max-width: 90vw;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-top: 12px;
}

.tbg-idx-lightbox-thumbs::-webkit-scrollbar {
    display: none;
}

.tbg-idx-lightbox-thumb {
    flex: 0 0 60px;
    height: 44px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.tbg-idx-lightbox-thumb:hover {
    opacity: 0.8;
}

.tbg-idx-lightbox-thumb.active {
    opacity: 1;
    border-color: #fff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* Lightbox Image Fade Transition */
.tbg-idx-lightbox-img-animate {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tbg-idx-lightbox-img-animate.is-visible {
    opacity: 1;
}

/* ─── Section Entrance Animations ─── */
@keyframes tbg-idx-fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tbg-idx-property-header,
.tbg-idx-expandable-text,
.tbg-idx-facts-module,
.tbg-idx-virtual-tour-section,
.tbg-idx-map-section {
    animation: tbg-idx-fadeUp 0.5s ease-out both;
}

.tbg-idx-expandable-text { animation-delay: 0.05s; }
.tbg-idx-facts-module { animation-delay: 0.1s; }
.tbg-idx-virtual-tour-section { animation-delay: 0.15s; }
.tbg-idx-map-section { animation-delay: 0.2s; }

/* ─── Features Accordion Chevron Rotation ─── */
.tbg-idx-features-accordion[open] summary svg {
    transform: rotate(180deg);
}

.tbg-idx-features-accordion summary svg {
    transition: transform 0.25s ease;
}

/* ─── Virtual Tour Section Refinement ─── */
.tbg-idx-virtual-tour-section {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-top: 2.5rem;
}

.tbg-idx-vt-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--tbg-idx-card-bg-color, #fff);
    border-bottom: 1px solid var(--tbg-idx-border-color, #f0f0f0);
}

.tbg-idx-vt-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--tbg-idx-font-family);
    color: var(--tbg-idx-text-color);
}

.tbg-idx-vt-controls {
    display: flex;
    gap: 6px;
}

.tbg-idx-vt-ctrl {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb);
    background: transparent;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.tbg-idx-vt-ctrl:hover {
    background: var(--tbg-idx-bg-color, #f5f5f5);
    color: var(--tbg-idx-text-color);
}

.tbg-idx-vt-iframe {
    width: 100%;
    height: 500px;
    border: none;
    display: block;
}

.tbg-idx-virtual-tour-section.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 99998;
    border-radius: 0;
    border: none;
    margin: 0;
}

.tbg-idx-virtual-tour-section.is-fullscreen .tbg-idx-vt-iframe {
    height: calc(100vh - 50px);
}

/* ─── Description Text Polish ─── */
.tbg-idx-description-text p {
    margin-bottom: 1em;
    line-height: 1.8;
}

.tbg-idx-description-text p:last-child {
    margin-bottom: 0;
}

/* ─── Responsive Polish ─── */
@media (max-width: 768px) {
    .tbg-idx-scroll-nav {
        top: 0;
        border-radius: 0;
        margin-left: -24px;
        margin-right: -24px;
        width: calc(100% + 48px);
    }

    .tbg-idx-action-bar {
        flex-wrap: wrap;
    }

    .tbg-idx-action-btn span {
        display: none;
    }

    .tbg-idx-action-btn {
        padding: 8px 10px;
    }

    .tbg-idx-mortgage-row {
        grid-template-columns: 1fr;
    }

    .tbg-idx-vt-iframe {
        height: 300px;
    }

    .tbg-idx-breadcrumb {
        font-size: 12px;
    }
}

/* ─── Print Header & Footer (hidden on screen) ─── */
.tbg-idx-print-header,
.tbg-idx-print-footer {
    display: none;
}

/* ─── Print Styles ─── */
@media print {
    /* Show print header & footer */
    .tbg-idx-print-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 0 0 12px;
        margin-bottom: 16px;
        border-bottom: 2px solid #000 !important;
    }

    .tbg-idx-print-logo {
        display: flex;
        align-items: center;
    }

    .tbg-idx-print-logo img {
        max-height: 40px !important;
        width: auto !important;
    }

    .tbg-idx-print-team-name {
        font-size: 18pt !important;
        font-weight: 700 !important;
        letter-spacing: -0.02em;
    }

    .tbg-idx-print-contact {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
        font-size: 9pt !important;
    }

    .tbg-idx-print-footer {
        display: block !important;
        margin-top: 2rem;
        padding-top: 12px;
        font-size: 8pt !important;
        text-align: center;
        page-break-inside: avoid;
    }

    .tbg-idx-print-footer-line {
        height: 1px !important;
        background: #000 !important;
        margin-bottom: 8px;
    }

    .tbg-idx-print-footer p {
        margin: 2px 0 !important;
        line-height: 1.4 !important;
    }

    /* === Force light colors everywhere === */
    *,
    *::before,
    *::after {
        color: #000 !important;
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body,
    html {
        background: #fff !important;
        font-size: 12pt !important;
        line-height: 1.5 !important;
        overflow: visible !important;
    }

    /* === Hide non-essential elements === */
    .tbg-idx-sidebar-col,
    .tbg-idx-scroll-nav,
    .tbg-idx-breadcrumb,
    .tbg-idx-action-bar,
    .tbg-idx-map-section,
    .tbg-idx-virtual-tour-section,
    .tbg-idx-lightbox,
    .tbg-idx-nearby-carousel-wrap,
    .tbg-idx-tour-action-bar,
    .tbg-idx-show-more-btn,
    .tbg-idx-photo-counter,
    .tbg-idx-mortgage-calc,
    .tbg-idx-status-pill,
    .tbg-idx-view-all-photos,
    .tbg-idx-compliance,
    #wpadminbar,
    header,
    footer,
    nav,
    .site-header,
    .site-footer,
    .wp-site-blocks > header,
    .wp-site-blocks > footer {
        display: none !important;
    }

    /* === Layout === */
    .tbg-idx-container,
    .tbg-idx-single-listing,
    .tbg-idx-content-wrapper,
    .tbg-idx-main-col,
    .tbg-idx-single-scroll-content,
    .entry-content,
    article,
    main {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    .tbg-idx-content-wrapper {
        grid-template-columns: 1fr !important;
    }

    .tbg-idx-single-listing {
        padding-top: 0 !important;
    }

    /* === Gallery — just show main photo === */
    .tbg-idx-zillow-gallery {
        display: block !important;
        margin-bottom: 1rem !important;
        border-radius: 0 !important;
        height: auto !important;
        max-height: 350px !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
    }

    .tbg-idx-gallery-item:not(.tbg-idx-gallery-main) {
        display: none !important;
    }

    .tbg-idx-gallery-main {
        height: 300px !important;
        width: 100% !important;
        grid-column: 1 / -1 !important;
        grid-row: 1 / -1 !important;
        background-size: cover !important;
        background-position: center !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* === Header === */
    .tbg-idx-property-header {
        border: none !important;
        padding: 1rem 0 !important;
        animation: none !important;
    }

    .tbg-idx-property-type-badge {
        border: 1px solid #999 !important;
        padding: 2px 8px !important;
        font-size: 10pt !important;
    }

    .tbg-idx-price-huge {
        font-size: 24pt !important;
    }

    .tbg-idx-price-sqft-badge {
        font-size: 9pt !important;
        border: 1px solid #ccc !important;
    }

    /* === Core stats - make a clean row === */
    .tbg-idx-core-stats {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 1rem !important;
        padding: 0.75rem 0 !important;
        border-top: 1px solid #ccc !important;
        border-bottom: 1px solid #ccc !important;
        margin-bottom: 1rem !important;
    }

    .tbg-idx-core-stats .stat-item {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }

    /* === Status banners === */
    .tbg-idx-status-date-banner {
        border: 1px solid #999 !important;
        padding: 6px 12px !important;
        margin-bottom: 0.5rem !important;
    }

    /* === Description — show all text === */
    .tbg-idx-expandable-text {
        animation: none !important;
    }

    .tbg-idx-expandable-text .text-content {
        max-height: none !important;
        overflow: visible !important;
    }

    .tbg-idx-expandable-text .text-content::after {
        display: none !important;
    }

    .tbg-idx-description-text {
        font-size: 11pt !important;
        line-height: 1.6 !important;
    }

    /* === Features === */
    .tbg-idx-features-accordion {
        border: 1px solid #ccc !important;
        page-break-inside: avoid !important;
    }

    .tbg-idx-features-accordion[open] {
        break-inside: avoid !important;
    }

    .tbg-idx-feature-pill svg {
        color: #000 !important;
        stroke: #000 !important;
    }

    /* === Facts module === */
    .tbg-idx-facts-module {
        border: none !important;
        animation: none !important;
    }

    .tbg-idx-detail-row {
        border-bottom: 1px solid #eee !important;
        padding: 4px 0 !important;
    }

    .tbg-idx-facts-accordion {
        border: 1px solid #ccc !important;
        page-break-inside: avoid !important;
    }

    .tbg-idx-facts-accordion summary {
        background: transparent !important;
    }

    /* === Price history === */
    .tbg-idx-price-history {
        page-break-inside: avoid !important;
    }

    .tbg-idx-price-timeline::before {
        background: #ccc !important;
    }

    .tbg-idx-price-event-dot.current {
        background: #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .tbg-idx-price-event-dot.original {
        background: #999 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .tbg-idx-price-event-change.decrease {
        color: #c00 !important;
    }

    .tbg-idx-price-event-change.increase {
        color: #060 !important;
    }

    /* === Card styling for print === */
    .tbg-idx-card {
        border: 1px solid #ccc !important;
        padding: 1rem !important;
        box-shadow: none !important;
    }

    /* === Disable all animations === */
    .tbg-idx-property-header,
    .tbg-idx-expandable-text,
    .tbg-idx-facts-module,
    .tbg-idx-virtual-tour-section,
    .tbg-idx-map-section {
        animation: none !important;
    }

    /* === Page breaks === */
    .tbg-idx-property-header {
        page-break-after: avoid !important;
    }

    h1, h2, h3, h4 {
        page-break-after: avoid !important;
    }

    .tbg-idx-facts-module {
        page-break-before: auto !important;
    }
}

/* ─── Price History Timeline ─── */
.tbg-idx-price-history {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.tbg-idx-price-timeline {
    position: relative;
    padding-left: 24px;
}

.tbg-idx-price-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--tbg-idx-border-color, #e5e7eb);
}

.tbg-idx-price-event {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    padding: 12px 0;
}

.tbg-idx-price-event-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    position: absolute;
    left: -24px;
    top: 16px;
    z-index: 1;
    border: 3px solid var(--tbg-idx-card-bg-color, #fff);
}

.tbg-idx-price-event-dot.current {
    background: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.tbg-idx-price-event-dot.original {
    background: var(--tbg-idx-text-color-muted, #9ca3af);
}

.tbg-idx-price-event-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tbg-idx-price-event-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tbg-idx-price-event-value {
    font-family: var(--tbg-idx-font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--tbg-idx-text-color);
    line-height: 1.2;
}

.tbg-idx-price-event-change {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--tbg-idx-font-family);
}

.tbg-idx-price-event-change.decrease {
    color: #ef4444;
}

.tbg-idx-price-event-change.increase {
    color: #10b981;
}

.tbg-idx-price-event-date {
    font-size: 12px;
    color: var(--tbg-idx-text-color-muted, #9ca3af);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE OPTIMIZATION — Comprehensive Responsive Fixes
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── CLIENT PORTAL: Auth Forms (Login / Register) ─── */
.tbg-idx-portal-auth {
    padding: 0 16px;
    box-sizing: border-box;
}

/* Style WordPress core login form inputs to match plugin design */
.tbg-idx-portal-auth #tbg-idx-login-form input[type="text"],
.tbg-idx-portal-auth #tbg-idx-login-form input[type="password"] {
    width: 100% !important;
    padding: 12px 14px !important;
    border: 1px solid var(--tbg-idx-border-color, #e5e7eb) !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    background: var(--tbg-idx-bg-color, #f9fafb) !important;
    color: var(--tbg-idx-text-color, #1a1a1a) !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    margin-bottom: 12px !important;
}

.tbg-idx-portal-auth #tbg-idx-login-form label {
    font-size: 13px;
    font-weight: 500;
    color: var(--tbg-idx-text-color-muted, #6b7280);
    display: block;
    margin-bottom: 6px;
}

.tbg-idx-portal-auth #tbg-idx-login-form .login-submit input[type="submit"] {
    width: 100% !important;
    padding: 14px !important;
    border-radius: 12px !important;
    border: none !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    background: var(--tbg-idx-primary-color, #111) !important;
    color: var(--tbg-idx-button-text-color, #fff) !important;
    font-family: var(--tbg-idx-font-family) !important;
    transition: all 0.2s !important;
}

.tbg-idx-portal-auth #tbg-idx-login-form .login-submit input[type="submit"]:hover {
    background: var(--tbg-idx-primary-hover, #333) !important;
}

.tbg-idx-portal-auth #tbg-idx-login-form .login-remember {
    margin-bottom: 12px;
}

@media (max-width: 520px) {
    .tbg-idx-portal-auth {
        padding: 0 8px;
    }

    .tbg-idx-portal-auth h3 {
        font-size: 20px;
    }

    .tbg-idx-portal-auth .tbg-idx-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ─── CLIENT PORTAL: Dashboard ─── */
@media (max-width: 520px) {
    .tbg-idx-portal-dashboard {
        padding: 12px;
    }

    .tbg-idx-dash-header {
        padding-bottom: 16px;
        margin-bottom: 20px;
    }

    .tbg-idx-dash-header-info {
        gap: 12px;
    }

    .tbg-idx-dash-avatar img {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .tbg-idx-dash-title {
        font-size: 18px !important;
    }

    .tbg-idx-dash-email {
        font-size: 12px;
    }

    .tbg-idx-dash-logout {
        font-size: 12px;
        padding: 6px 12px;
    }

    .tbg-idx-dash-tabs {
        gap: 0;
        margin-bottom: 20px;
    }

    .tbg-idx-dash-tab {
        padding: 8px 10px;
        font-size: 12px;
        gap: 4px;
    }

    .tbg-idx-dash-tab svg {
        width: 14px;
        height: 14px;
    }

    .tbg-idx-dash-badge {
        min-width: 18px;
        height: 16px;
        font-size: 10px;
        padding: 0 4px;
    }

    /* Account Settings */
    .tbg-idx-account-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .tbg-idx-account-card {
        padding: 20px 16px;
    }

    .tbg-idx-card-title {
        font-size: 14px;
    }

    .tbg-idx-info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Saved Properties Grid */
    .tbg-idx-dash-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* Saved Searches */
    .tbg-idx-saved-search-card {
        padding: 14px;
    }

    .tbg-idx-saved-search-header {
        flex-wrap: wrap;
    }

    .tbg-idx-saved-search-label {
        font-size: 14px;
    }

    .tbg-idx-saved-search-criteria {
        gap: 4px;
    }

    .tbg-idx-criteria-tag {
        font-size: 11px;
        padding: 3px 8px;
    }

    .tbg-idx-saved-search-meta {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 11px;
    }

    /* Empty State */
    .tbg-idx-empty-state {
        padding: 40px 20px;
    }
}

/* ─── SINGLE LISTING: Container & Typography ─── */
@media (max-width: 480px) {
    .tbg-idx-container {
        padding: 12px;
    }

    .tbg-idx-property-header .tbg-idx-header-top h1,
    .tbg-idx-single-listing .tbg-idx-header-top h1 {
        font-size: 1.35rem !important;
    }

    .tbg-idx-price-huge {
        font-size: 28px;
        gap: 6px;
    }

    .tbg-idx-price-per-sqft {
        font-size: 12px;
    }

    .tbg-idx-status-date-banner {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* ─── SINGLE LISTING: Tab Navigation ─── */
@media (max-width: 480px) {
    .tbg-idx-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 16px;
        scrollbar-width: none;
    }

    .tbg-idx-tabs::-webkit-scrollbar {
        display: none;
    }

    .tbg-idx-tab-btn {
        white-space: nowrap;
        font-size: 13px;
    }
}

/* ─── SINGLE LISTING: Details & Facts Grid ─── */
@media (max-width: 480px) {
    .tbg-idx-details-grid,
    .tbg-idx-overview-grid {
        grid-template-columns: 1fr;
    }

    .tbg-idx-fact-grid {
        grid-template-columns: 1fr;
        padding-left: 0;
    }

    .tbg-idx-card {
        padding: 20px 16px;
        border-radius: 12px;
    }
}

/* ─── SINGLE LISTING: Gallery ─── */
@media (max-width: 480px) {
    .tbg-idx-zillow-gallery.has-5-plus-photos,
    .tbg-idx-zillow-gallery.has-4-photos,
    .tbg-idx-zillow-gallery.has-3-photos,
    .tbg-idx-zillow-gallery.has-2-photos,
    .tbg-idx-zillow-gallery.has-1-photo {
        grid-template-rows: 220px;
        border-radius: 0;
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
    }
}

/* ─── SINGLE LISTING: Map Height ─── */
@media (max-width: 480px) {
    .tbg-idx-single-listing .tbg-idx-map-container {
        height: 280px !important;
    }
}

/* ─── LIGHTBOX: Touch-friendly Sizing ─── */
@media (max-width: 768px) {
    .tbg-idx-lightbox-close {
        top: 10px;
        right: 10px;
        position: fixed;
        z-index: 100000;
        font-size: 32px;
    }

    .tbg-idx-lightbox-nav button {
        padding: 12px 20px;
        font-size: 20px;
    }

    .tbg-idx-lightbox-content {
        max-width: 98%;
    }
}

/* ─── LISTING CARDS: Stats & Content ─── */
@media (max-width: 480px) {
    .tbg-idx-lc-stats {
        flex-wrap: wrap;
        gap: 4px 8px;
        font-size: 13px;
    }

    .tbg-idx-lc-price {
        font-size: 20px;
    }

    .tbg-idx-lc-address {
        font-size: 13px;
    }

    .tbg-idx-lc-brokerage {
        font-size: 10px;
    }
}

/* ─── EXPLORE HOMES: Better card sizing and touch experience ─── */
@media (max-width: 480px) {
    .tbg-idx-explore-section {
        padding: 0 8px;
        margin: 2rem auto;
    }

    .tbg-idx-explore-heading {
        font-size: 24px !important;
        margin-bottom: 1rem !important;
    }

    .tbg-idx-explore-cols-4,
    .tbg-idx-explore-cols-3,
    .tbg-idx-explore-cols-2 {
        grid-auto-columns: 80vw;
    }

    .tbg-idx-explore-grid {
        scroll-padding-left: 8px;
        gap: 12px;
    }

    .tbg-idx-explore-tab {
        padding: 8px 12px;
        font-size: 13px;
    }

    .tbg-idx-explore-tabs {
        margin-bottom: 1rem;
    }
}

/* Extra small screens (iPhone SE, 375px and below) */
@media (max-width: 375px) {
    .tbg-idx-explore-cols-4,
    .tbg-idx-explore-cols-3,
    .tbg-idx-explore-cols-2 {
        grid-auto-columns: 85vw;
    }

    .tbg-idx-container {
        padding: 8px;
    }

    .tbg-idx-dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}