/**
 * Frontend Styles - v5.7.0
 * 
 * @package AiInvestorTool
 * @since 5.7.0
 * Build: 2026-02-05T20:00:00Z
 * 
 * v5.7.0 - BULLETPROOF SCROLL & UNIVERSAL PRECISION (February 5, 2026)
 * =====================================================================
 * 
 * FIXES:
 * - FIX(a): Analytics scroll uses explicit height + position-based layout
 *   - Parent uses position:relative with explicit height
 *   - Scroll container uses position:absolute to fill parent
 *   - This bypasses Impreza's flex override issues entirely
 *   - touch-action: pan-y + -webkit-overflow-scrolling: touch for mobile
 * - FIX(c): Impreza CSS containment shield
 *   - contain: layout style on root container
 *   - All critical properties use !important for theme immunity
 *   - Box-sizing reset scoped to .ait-container
 * 
 * PRESERVED FROM v5.6.0:
 * - Market Analytics panel full scrollability
 * - Expand/Collapse toggle for analytics
 * - Visual scroll indicators (fade gradients)
 * - clamp() based fluid sizing
 * - 48px minimum touch targets
 * - GPU-accelerated animations
 */

/* ====================================
   CSS VARIABLES - FLUID SIZING
   ==================================== */
:root {
    --ait-color-primary: #4299e1;
    --ait-color-secondary: #00aaee;
    --ait-color-heading: #1a365d;
    --ait-color-text: #2d3748;
    --ait-color-faded: #718096;
    --ait-color-background: #ffffff;
    --ait-color-alt-background: #f7fafc;
    --ait-color-border: #e2e8f0;
    --ait-color-success: #48bb78;
    --ait-color-error: #f56565;
    --ait-radius: 22px;
    --ait-radius-sm: 8px;
    --ait-radius-md: 12px;
    --ait-radius-lg: 16px;
    --ait-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --ait-shadow-hover: 0 12px 32px rgba(66, 153, 225, 0.18);
    --ait-shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
    --ait-shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.1);
    
    --ait-spacing-xs: clamp(4px, 1vw, 8px);
    --ait-spacing-sm: clamp(8px, 2vw, 12px);
    --ait-spacing-md: clamp(12px, 3vw, 20px);
    --ait-spacing-lg: clamp(16px, 4vw, 30px);
    
    --ait-font-xs: clamp(9px, 2vw, 10px);
    --ait-font-sm: clamp(11px, 2.5vw, 13px);
    --ait-font-md: clamp(13px, 3vw, 16px);
    --ait-font-lg: clamp(16px, 4vw, 20px);
    --ait-font-xl: clamp(20px, 5vw, 28px);
    
    /* v5.7.0: Analytics panel heights - used in both CSS and JS */
    --ait-analytics-height: 650px;
    
    --ait-transition-fast: 0.15s ease-out;
    --ait-transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --ait-transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====================================
   v5.7.0: IMPREZA CONTAINMENT SHIELD
   Scoped reset prevents theme bleed
   ==================================== */
.ait-container,
.ait-container *,
.ait-container *::before,
.ait-container *::after {
    box-sizing: border-box !important;
}

/* ====================================
   CONTAINER & LAYOUT
   ==================================== */
.home-search-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: var(--ait-spacing-lg) var(--ait-spacing-md);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* v5.7.0: Containment prevents layout bleed */
    contain: layout style;
}

/* ====================================
   SEARCH HEADER
   ==================================== */
.ait-search-header {
    text-align: center;
    margin-bottom: var(--ait-spacing-lg);
    padding: var(--ait-spacing-lg);
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: var(--ait-radius);
    border: 2px solid var(--ait-color-border);
}

.search-title {
    font-size: var(--ait-font-xl);
    font-weight: 700;
    color: var(--ait-color-heading);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.search-subtitle {
    font-size: var(--ait-font-md);
    color: var(--ait-color-faded);
    margin: 0 0 var(--ait-spacing-md) 0;
}

.city-selector {
    max-width: 400px;
    margin: 0 auto var(--ait-spacing-md) auto;
}

.city-selector label {
    display: block;
    font-size: var(--ait-font-sm);
    font-weight: 600;
    color: var(--ait-color-heading);
    margin-bottom: 8px;
}

.city-selector label i {
    color: var(--ait-color-primary);
    margin-right: 6px;
}

.city-selector select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--ait-color-border);
    border-radius: var(--ait-radius-md);
    font-size: var(--ait-font-md);
    color: var(--ait-color-text);
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
    min-height: 48px;
    appearance: auto;
    -webkit-appearance: auto;
}

.city-selector select:focus {
    outline: none;
    border-color: var(--ait-color-primary);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

.search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--ait-color-primary) 0%, #3182ce 100%);
    color: white;
    border: none;
    border-radius: var(--ait-radius-md);
    font-size: var(--ait-font-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
    min-height: 48px;
    min-width: 48px;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(66, 153, 225, 0.4);
}

.search-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ====================================
   SPLIT-SCREEN LAYOUT
   ==================================== */
.ait-split-screen {
    display: flex !important;
    gap: clamp(16px, 3vw, 24px) !important;
    margin-top: var(--ait-spacing-lg);
    min-height: 600px;
    align-items: flex-start !important;
}

.ait-listings-sidebar {
    flex: 1 !important;
    min-width: 0 !important;
    overflow-y: auto !important;
    max-height: 90vh;
    padding-right: 10px;
}

.ait-map-sidebar {
    flex: 1 !important;
    min-width: 0 !important;
    position: sticky;
    top: 20px;
    display: flex !important;
    flex-direction: column !important;
    gap: clamp(12px, 2vw, 16px) !important;
    height: fit-content;
}

/* ====================================
   MAP CONTAINER - FLUID HEIGHT
   ==================================== */
.ait-map-wrapper {
    position: relative;
    width: 100%;
    height: clamp(350px, 50vh, 550px);
    min-height: 350px;
    border-radius: var(--ait-radius);
    overflow: hidden;
    border: 2px solid var(--ait-color-border);
    box-shadow: var(--ait-shadow);
    background: #f0f0f0;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ait-map-wrapper.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    border: none !important;
}

#ait-map {
    width: 100% !important;
    height: 100% !important;
    min-height: 350px !important;
    z-index: 1;
}

.leaflet-container {
    width: 100% !important;
    height: 100% !important;
}

/* Fullscreen Button */
.ait-fullscreen-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--ait-color-heading);
    font-size: 16px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ait-fullscreen-btn:hover {
    background: var(--ait-color-primary);
    color: white;
    transform: scale(1.05);
}

/* ====================================
   MAP STATS OVERLAY
   ==================================== */
.ait-map-stats {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: clamp(8px, 2vw, 10px) clamp(12px, 3vw, 18px);
    border-radius: 24px;
    font-size: var(--ait-font-sm);
    font-weight: 600;
    z-index: 1000;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ait-stat-icon {
    font-size: 16px;
    color: var(--ait-color-primary);
}

.ait-map-stats #markerCount {
    color: var(--ait-color-success);
    font-size: clamp(14px, 3vw, 18px);
    font-weight: 700;
}

.ait-geocoding-status {
    color: #ffd700;
    font-size: 12px;
}

.ait-geocoding-status.active {
    animation: ait-pulse 1s infinite;
}

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

/* ====================================
   GEOCODING PROGRESS BAR
   ==================================== */
.ait-geocoding-progress {
    position: absolute;
    bottom: 60px;
    left: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.85);
    padding: clamp(8px, 2vw, 10px) clamp(12px, 3vw, 16px);
    border-radius: 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(8px);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ait-color-primary), var(--ait-color-success));
    border-radius: 4px;
    transition: width 0.3s ease;
    will-change: width;
}

.progress-text {
    color: white;
    font-size: 12px;
    font-weight: 600;
    min-width: 50px;
    text-align: right;
}

.progress-eta {
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    margin-left: 4px;
}

/* ====================================
   THUMBNAIL MARKERS
   ==================================== */
.ait-thumbnail-marker {
    background: transparent !important;
    border: none !important;
}

.ait-marker-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--ait-color-primary);
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    transform: translateZ(0);
}

.ait-marker-thumb:hover {
    transform: scale(1.2) translateZ(0);
    border-color: var(--ait-color-secondary);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.ait-custom-marker {
    background: var(--ait-color-primary) !important;
    border: 3px solid white !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    cursor: pointer !important;
    transition: transform 0.2s !important;
    color: white !important;
    font-size: 18px !important;
}

.ait-custom-marker:hover {
    transform: scale(1.2) !important;
}

/* ====================================
   POPUP STYLES
   ==================================== */
.leaflet-popup-content-wrapper {
    border-radius: 16px !important;
    padding: 0 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25) !important;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: clamp(240px, 70vw, 280px) !important;
}

.ait-map-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ait-map-popup .popup-image {
    width: 100%;
    height: clamp(120px, 25vw, 150px);
    object-fit: cover;
    display: block;
}

.ait-map-popup .popup-content {
    padding: var(--ait-spacing-md);
}

.ait-map-popup h3 {
    margin: 0 0 8px 0;
    font-size: var(--ait-font-md);
    font-weight: 600;
    color: var(--ait-color-heading);
    line-height: 1.4;
}

.ait-map-popup .popup-price {
    font-size: var(--ait-font-xl);
    font-weight: 700;
    color: #059669;
    margin-bottom: 10px;
}

.ait-map-popup .popup-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: var(--ait-font-xs);
    color: var(--ait-color-text);
    margin-bottom: 10px;
}

.ait-map-popup .popup-specs span {
    background: var(--ait-color-alt-background);
    padding: 4px 8px;
    border-radius: 6px;
}

.ait-map-popup .popup-specs i {
    margin-right: 4px;
    color: var(--ait-color-faded);
}

.ait-map-popup .popup-cost-per-sqft {
    font-size: var(--ait-font-sm);
    color: var(--ait-color-faded);
    margin-bottom: 12px;
}

.ait-map-popup .popup-link {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ait-color-primary) 0%, #3182ce 100%);
    color: white !important;
    padding: 12px 16px;
    text-decoration: none !important;
    font-size: var(--ait-font-md);
    font-weight: 600;
    text-align: center;
    border-radius: 8px;
    transition: all 0.2s;
    min-height: 48px;
}

.ait-map-popup .popup-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

/* ====================================
   SKELETON LOADING
   ==================================== */
.ait-loading-skeleton {
    padding: 10px 0;
}

.skeleton-card {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: var(--ait-radius);
    border: 2px solid var(--ait-color-border);
    margin-bottom: 16px;
}

.skeleton-image {
    width: clamp(180px, 30vw, 280px);
    height: clamp(140px, 25vw, 180px);
    border-radius: 12px;
    background: #e2e8f0;
    flex-shrink: 0;
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-line {
    height: 20px;
    border-radius: 4px;
    background: #e2e8f0;
}

.skeleton-specs {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.skeleton-badge {
    width: 80px;
    height: 32px;
    border-radius: 8px;
    background: #e2e8f0;
}

/* v5.7.0: Shimmer with ait- prefix to avoid Impreza collision */
.shimmer {
    background: linear-gradient(
        90deg, 
        #e2e8f0 0%,
        #e2e8f0 35%, 
        #f0f4f8 45%,
        #f7fafc 50%, 
        #f0f4f8 55%,
        #e2e8f0 65%,
        #e2e8f0 100%
    );
    background-size: 300% 100%;
    animation: ait-shimmer 2s ease-in-out infinite;
    will-change: background-position;
}

@keyframes ait-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ====================================
   v5.7.0 ANALYTICS DASHBOARD - BULLETPROOF SCROLL
   
   ARCHITECTURE: Position-based height constraint
   - Parent (.ait-analytics-panel) has explicit height + position:relative
   - Child (.analytics-scroll-container) uses position:absolute to fill parent
   - This BYPASSES Impreza's flex overrides entirely
   - No reliance on flex:1 for scroll containment
   ==================================== */
.ait-analytics-panel {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%) !important;
    border-radius: var(--ait-radius) !important;
    color: white !important;
    border: 2px solid #2d3748 !important;
    box-shadow: var(--ait-shadow) !important;
    /* v5.7.0: CRITICAL - Position-based layout, NOT flex-only */
    position: relative !important;
    overflow: hidden !important;
    /* v5.7.0: Explicit height instead of max-height flex combo */
    height: var(--ait-analytics-height) !important;
    min-height: 400px !important;
    max-height: none !important;
    transition: height 0.4s ease !important;
    /* v5.7.0: Containment shield */
    contain: layout style !important;
}

/* v5.7.0: Expanded state - auto height with min */
.ait-analytics-panel.expanded {
    height: auto !important;
    min-height: var(--ait-analytics-height) !important;
    overflow: visible !important;
}

/* v5.7.0: BULLETPROOF scroll container using position:absolute fill */
.analytics-scroll-container {
    /* Position-based fill - immune to flex overrides */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    /* Scroll behavior */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* Padding for content */
    padding: var(--ait-spacing-md) !important;
    /* Mobile scroll optimization */
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    scroll-behavior: smooth !important;
    /* Touch support */
    touch-action: pan-y !important;
}

/* v5.7.0: When expanded, switch to relative positioning */
.ait-analytics-panel.expanded .analytics-scroll-container {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    overflow-y: visible !important;
}

/* v5.7.0: Scroll fade indicators */
.ait-analytics-panel::before,
.ait-analytics-panel::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 30px;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ait-analytics-panel::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(15, 15, 26, 1) 0%, rgba(15, 15, 26, 0) 100%);
    border-radius: var(--ait-radius) var(--ait-radius) 0 0;
}

.ait-analytics-panel::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(26, 26, 46, 1) 0%, rgba(26, 26, 46, 0) 100%);
    border-radius: 0 0 var(--ait-radius) var(--ait-radius);
}

.ait-analytics-panel.has-scroll-top::before {
    opacity: 1;
}

.ait-analytics-panel.has-scroll-bottom::after {
    opacity: 1;
}

.ait-analytics-panel.expanded::before,
.ait-analytics-panel.expanded::after {
    opacity: 0 !important;
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--ait-spacing-md);
    padding-bottom: var(--ait-spacing-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 10px;
}

.analytics-header h3 {
    margin: 0;
    font-size: var(--ait-font-lg);
    font-weight: 600;
    color: white;
}

.analytics-header h3 i {
    margin-right: 8px;
    color: var(--ait-color-primary);
}

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

.analytics-badge {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: var(--ait-font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: ait-pulse 2s infinite;
}

/* v5.7.0: Expand/Collapse Toggle Button */
.analytics-expand-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: var(--ait-font-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
}

.analytics-expand-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--ait-color-primary);
}

.analytics-expand-btn i {
    transition: transform 0.3s ease;
}

.ait-analytics-panel.expanded .analytics-expand-btn i {
    transform: rotate(180deg);
}

/* Stats grid */
.analytics-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(8px, 2vw, 12px);
    margin-bottom: var(--ait-spacing-md);
}

.analytics-stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: clamp(10px, 2.5vw, 14px);
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    transition: all 0.2s;
    transform: translateZ(0);
}

.analytics-stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px) translateZ(0);
}

.stat-icon {
    font-size: clamp(16px, 4vw, 20px);
    width: clamp(32px, 8vw, 40px);
    height: clamp(32px, 8vw, 40px);
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--ait-color-primary);
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 700;
    color: white;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-label {
    font-size: var(--ait-font-xs);
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ====================================
   CHART CONTAINER
   ==================================== */
.analytics-chart-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: var(--ait-spacing-sm);
    margin-bottom: var(--ait-spacing-sm);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--ait-spacing-sm);
    flex-wrap: wrap;
    gap: 8px;
}

.chart-title {
    font-size: var(--ait-font-sm);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.chart-title i {
    margin-right: 6px;
    color: var(--ait-color-primary);
}

.chart-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: clamp(45%, 50%, 60%);
    min-height: 150px;
}

.chart-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

.trend-indicator {
    font-size: var(--ait-font-sm);
    font-weight: 600;
}

.trend-up { color: #48bb78; }
.trend-down { color: #fc8181; }
.trend-neutral { color: #ecc94b; }

.trend-indicator i {
    margin-right: 4px;
}

/* ====================================
   MARKET SENTIMENT
   ==================================== */
.analytics-sentiment {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: var(--ait-spacing-sm);
    margin-bottom: var(--ait-spacing-sm);
}

.sentiment-header {
    font-size: var(--ait-font-sm);
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: var(--ait-spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sentiment-meter {
    height: clamp(20px, 5vw, 28px);
    background: linear-gradient(90deg, #4299e1 0%, #ecc94b 50%, #e53e3e 100%);
    border-radius: clamp(10px, 2.5vw, 14px);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sentiment-bar {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    transition: width 0.5s ease;
    border-radius: 0 clamp(10px, 2.5vw, 14px) clamp(10px, 2.5vw, 14px) 0;
}

.sentiment-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--ait-spacing-sm);
    font-size: var(--ait-font-sm);
    color: rgba(255, 255, 255, 0.6);
    padding: 0 4px;
}

.sentiment-labels span:nth-child(2) {
    color: white;
    font-weight: 700;
    font-size: var(--ait-font-md);
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
}

.sentiment-source {
    margin-top: var(--ait-spacing-sm);
    padding-top: var(--ait-spacing-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: var(--ait-font-xs);
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sentiment-source i {
    color: var(--ait-color-primary);
}

/* ====================================
   QUICK STATS
   ==================================== */
.analytics-quick-stats {
    display: flex;
    justify-content: space-between;
    gap: clamp(6px, 2vw, 10px);
    margin-bottom: var(--ait-spacing-sm);
}

.quick-stat {
    flex: 1;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: clamp(10px, 2.5vw, 14px);
    min-width: 0;
}

.qs-label {
    display: block;
    font-size: var(--ait-font-xs);
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qs-value {
    font-size: var(--ait-font-md);
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ====================================
   LOCAL NEWS SECTION
   ==================================== */
.analytics-news {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: var(--ait-spacing-sm);
    margin-bottom: var(--ait-spacing-sm);
}

.news-header {
    font-size: var(--ait-font-sm);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    margin-bottom: var(--ait-spacing-sm);
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.news-header i {
    margin-right: 6px;
    color: var(--ait-color-primary);
}

.news-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

a.news-item {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    padding: clamp(10px, 2.5vw, 12px);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border-left: 3px solid var(--ait-color-primary);
    transition: all 0.2s;
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
    min-height: 48px;
    align-items: center;
}

a.news-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
    border-left-color: var(--ait-color-success);
}

.news-icon {
    width: clamp(32px, 7vw, 36px);
    height: clamp(32px, 7vw, 36px);
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(66, 153, 225, 0.2);
    border-radius: 8px;
    color: var(--ait-color-primary);
    font-size: clamp(14px, 3.5vw, 16px);
    flex-shrink: 0;
}

.news-content {
    flex: 1;
    min-width: 0;
}

.news-title {
    font-size: var(--ait-font-sm);
    font-weight: 500;
    color: white;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-meta {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    font-size: var(--ait-font-xs);
    color: rgba(255, 255, 255, 0.5);
    flex-wrap: wrap;
}

.news-meta i {
    margin-right: 4px;
}

/* Analytics Footer */
.analytics-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--ait-spacing-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: var(--ait-font-xs);
    color: rgba(255, 255, 255, 0.4);
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.analytics-powered {
    font-weight: 500;
}

.analytics-powered i {
    margin-left: 4px;
}

/* ====================================
   LISTING CARDS
   ==================================== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--ait-spacing-md);
    background: linear-gradient(135deg, var(--ait-color-heading) 0%, #2a4365 100%);
    color: white;
    border-radius: var(--ait-radius) var(--ait-radius) 0 0;
    font-size: var(--ait-font-md);
    font-weight: 600;
    flex-wrap: wrap;
    gap: 10px;
}

.results-header i {
    margin-right: 8px;
}

.results-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: var(--ait-font-sm);
    white-space: nowrap;
}

.results-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--ait-spacing-sm) var(--ait-spacing-md);
    background: var(--ait-color-alt-background);
    border-bottom: 1px solid var(--ait-color-border);
    flex-wrap: wrap;
    gap: 10px;
}

.results-timestamp {
    font-size: var(--ait-font-xs);
    color: var(--ait-color-faded);
}

.results-timestamp i {
    margin-right: 6px;
}

.results-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-sort label {
    font-size: var(--ait-font-xs);
    font-weight: 600;
    color: var(--ait-color-heading);
    white-space: nowrap;
}

.results-sort select {
    padding: 6px 12px;
    border: 2px solid var(--ait-color-border);
    border-radius: 8px;
    font-size: var(--ait-font-sm);
    color: var(--ait-color-text);
    background: white;
    cursor: pointer;
    min-height: 36px;
}

.home-item {
    display: flex;
    gap: clamp(12px, 3vw, 20px);
    padding: var(--ait-spacing-md);
    background: white;
    border-bottom: 1px solid var(--ait-color-border);
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    transform: translateY(10px);
}

.home-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.home-item:hover {
    background: var(--ait-color-alt-background);
    box-shadow: var(--ait-shadow-card-hover);
    transform: translateX(4px);
}

.home-item.highlighted {
    background: #ebf8ff;
    box-shadow: inset 4px 0 0 var(--ait-color-primary);
    animation: ait-highlight-fade 2s ease-out;
}

@keyframes ait-highlight-fade {
    0% { background: #bee3f8; }
    100% { background: #ebf8ff; }
}

.home-image-container {
    width: clamp(180px, 30vw, 280px);
    height: clamp(140px, 25vw, 180px);
    flex-shrink: 0;
    border-radius: var(--ait-radius-md);
    overflow: hidden;
    background: var(--ait-color-alt-background);
}

.home-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.home-item:hover .home-image-container img {
    transform: scale(1.05);
}

.home-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    color: var(--ait-color-faded);
    font-size: 48px;
}

.home-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.home-address {
    margin-bottom: 8px;
}

.home-address a {
    color: var(--ait-color-heading);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--ait-font-md);
    line-height: 1.4;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-address a i {
    color: var(--ait-color-primary);
    margin-right: 6px;
}

.home-address a:hover {
    color: var(--ait-color-primary);
}

.home-price {
    font-size: var(--ait-font-lg);
    font-weight: 700;
    color: #059669;
    margin-bottom: 8px;
}

.home-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.home-specs span {
    display: inline-flex;
    align-items: center;
    background: var(--ait-color-alt-background);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: var(--ait-font-xs);
    color: var(--ait-color-text);
    font-weight: 500;
    white-space: nowrap;
}

.home-specs i {
    margin-right: 4px;
    color: var(--ait-color-faded);
}

.cost-per-sqft {
    background: linear-gradient(135deg, #ebf8ff, #bee3f8) !important;
    color: var(--ait-color-heading) !important;
    font-weight: 600 !important;
}

.view-listing-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--ait-color-alt-background);
    color: var(--ait-color-primary) !important;
    text-decoration: none !important;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: var(--ait-font-sm);
    font-weight: 600;
    transition: all 0.2s;
    align-self: flex-start;
    min-height: 36px;
}

.view-listing-btn:hover {
    background: var(--ait-color-primary);
    color: white !important;
    transform: translateY(-1px);
}

/* Results Footer */
.results-footer {
    padding: var(--ait-spacing-lg);
    text-align: center;
    background: var(--ait-color-alt-background);
    border-radius: 0 0 var(--ait-radius) var(--ait-radius);
}

.load-more-btn {
    width: 100%;
    max-width: 300px;
}

.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--ait-spacing-sm);
    color: var(--ait-color-primary);
    font-size: var(--ait-font-md);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    min-height: 48px;
    padding: 8px 16px;
}

.view-all-link:hover {
    color: var(--ait-color-secondary);
    text-decoration: underline;
}

/* Error Message */
.error-message {
    padding: var(--ait-spacing-lg);
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #fca5a5;
    border-radius: var(--ait-radius);
    color: #991b1b;
    text-align: center;
}

.error-icon {
    font-size: clamp(36px, 10vw, 48px);
    display: block;
    margin-bottom: 16px;
}

/* ====================================
   RESPONSIVE BREAKPOINTS
   ==================================== */
@media (max-width: 1024px) {
    .ait-split-screen {
        flex-direction: column !important;
    }
    
    .ait-map-sidebar {
        order: -1;
        position: relative;
        top: 0;
        max-height: none;
    }
    
    .ait-map-wrapper {
        height: clamp(300px, 45vh, 400px);
        min-height: 300px;
    }
    
    #ait-map {
        min-height: 300px !important;
    }
    
    .ait-listings-sidebar {
        max-height: none;
        overflow-y: visible;
    }
    
    /* v5.7.0: Analytics panel on tablet */
    .ait-analytics-panel {
        height: 600px !important;
        min-height: 350px !important;
    }
    
    .analytics-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .stat-value {
        font-size: clamp(14px, 3vw, 18px);
    }
}

@media (max-width: 768px) {
    .home-item {
        flex-direction: column;
    }
    
    .home-image-container {
        width: 100%;
        height: clamp(180px, 40vw, 220px);
    }
    
    .skeleton-card {
        flex-direction: column;
    }
    
    .skeleton-image {
        width: 100%;
        height: 180px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-sort {
        width: 100%;
    }
    
    .results-sort select {
        flex: 1;
    }
    
    /* v5.7.0: Analytics panel on tablet portrait */
    .ait-analytics-panel {
        height: 550px !important;
        min-height: auto !important;
    }
    
    .analytics-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-wrapper {
        padding-bottom: 55%;
        min-height: 160px;
    }
    
    .sentiment-meter {
        height: clamp(22px, 6vw, 32px);
    }
    
    .sentiment-labels span:nth-child(2) {
        font-size: var(--ait-font-lg);
        padding: 8px 18px;
    }
    
    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .analytics-header-controls {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .home-search-container {
        padding: var(--ait-spacing-md) var(--ait-spacing-sm);
    }
    
    .search-button {
        width: 100%;
        padding: 16px 24px;
    }
    
    .home-specs {
        flex-direction: column;
        gap: 6px;
    }
    
    .home-specs span {
        justify-content: center;
    }
    
    .ait-map-wrapper {
        height: clamp(250px, 40vh, 300px);
        min-height: 250px;
    }
    
    #ait-map {
        min-height: 250px !important;
    }
    
    .analytics-quick-stats {
        flex-direction: column;
    }
    
    .quick-stat {
        flex: none;
    }
    
    /* v5.7.0: Analytics panel on mobile */
    .ait-analytics-panel {
        height: 500px !important;
        min-height: auto !important;
    }
    
    .analytics-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-wrapper {
        padding-bottom: 65%;
        min-height: 180px;
    }
    
    .sentiment-meter {
        height: 28px;
    }
    
    .analytics-expand-btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 360px) {
    .analytics-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
    }
}

/* ====================================
   SCROLLBAR STYLING
   ==================================== */
.ait-listings-sidebar::-webkit-scrollbar,
.analytics-scroll-container::-webkit-scrollbar {
    width: 10px;
}

.ait-listings-sidebar::-webkit-scrollbar-track,
.analytics-scroll-container::-webkit-scrollbar-track {
    background: var(--ait-color-alt-background);
    border-radius: 5px;
}

.ait-listings-sidebar::-webkit-scrollbar-thumb {
    background: var(--ait-color-border);
    border-radius: 5px;
}

.ait-listings-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--ait-color-faded);
}

.analytics-scroll-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.analytics-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 5px;
}

.analytics-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.analytics-scroll-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.05);
}

/* ====================================
   GPU ACCELERATION
   ==================================== */
.home-item,
.ait-marker-thumb,
.ait-custom-marker,
.search-button,
.view-listing-btn,
.analytics-stat-card,
a.news-item {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* ====================================
   TOUCH DEVICE IMPROVEMENTS
   ==================================== */
@media (hover: none) and (pointer: coarse) {
    .home-item:hover {
        transform: none;
        box-shadow: var(--ait-shadow);
    }
    
    .analytics-stat-card:hover {
        transform: none;
    }
    
    a.news-item:hover {
        transform: none;
    }
    
    .ait-fullscreen-btn {
        width: 48px;
        height: 48px;
    }
    
    /* v5.7.0: Bulletproof touch scrolling on analytics */
    .analytics-scroll-container {
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        overscroll-behavior-y: contain !important;
    }
    
    .analytics-expand-btn {
        min-height: 44px;
        padding: 10px 16px;
    }
}

/* ====================================
   PRINT STYLES
   ==================================== */
@media print {
    .ait-analytics-panel {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .analytics-scroll-container {
        position: relative !important;
        overflow: visible !important;
    }
    
    .analytics-expand-btn {
        display: none !important;
    }
}
