/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* Page background image - no stretch, no tiling */
}

/* Page Header and Footer Images */
.page-header-link,
.page-footer-link {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    text-decoration: none;
    border: none;
    outline: none;
}

.page-header-image {
    width: 100%;
    max-width: 100%;
    display: block;
    margin: 0;
    padding: 0;
    object-fit: cover;
    height: auto;
    position: relative;
    z-index: 1;
    vertical-align: top;
    /* transform: scaleY(0.9); */
    transform-origin: top center;
}

.page-footer-image {
    width: 100%;
    max-width: 100vw;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 0;
    padding: 0;
    object-fit: cover;
    height: auto;
    position: relative;
    z-index: 1;
    vertical-align: bottom;
    transform: scaleY(0.8);
    -ms-transform: scaleY(0.8);
    transform-origin: bottom center;
    max-height: 200px;
    box-sizing: border-box;
}

/* Header */
.main-header {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 20px;
}

.main-header h1 {
    color: #3569a4; /* Medium blue color matching the image */
    font-size: 25px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin: 0;
}

.header-logo {
    height: 60px;
    width: auto;
    flex-shrink: 0;
}

/* Map container */
#map {
    flex: 1;
    width: 100%;
    height: 80vh;
    min-height: calc(80vh - 200px);
    position: relative;
}

/* Map Loading Overlay */
.map-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none; /* Allow clicks to pass through to DetailedPane */
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.map-loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    pointer-events: auto; /* Re-enable pointer events on the loading content itself */
}

.loading-content h3 {
    color: #333;
    margin: 20px 0 10px 0;
    font-size: 1.4em;
    font-weight: 600;
}

.loading-content p {
    color: #666;
    margin: 0;
    font-size: 1em;
    line-height: 1.5;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* Filter Controls */
.filter-controls {
    background: white;
    padding-bottom: 15px;
    padding-left: 25px;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.filter-row {
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
    flex: 1;
    min-width: 0; /* Allow flex items to shrink below content size */
}

.filter-group label {
    font-weight: 600;
    color: #333;
    /* font-size: 0.9em; */
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
    transition: border-color 0.2s;
}

/* Dealer filter wrapper for clear button */
.dealer-filter-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.dealer-filter-wrapper input {
    padding-right: 35px; /* Make room for clear button */
    width: 100%;
}

.dealer-filter-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    line-height: 1;
    transition: color 0.2s;
    z-index: 10;
}

.dealer-filter-clear-btn:hover {
    color: #333;
}

.dealer-filter-clear-btn.hidden {
    display: none;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1002;
    display: none;
    margin-top: 2px; /* Small gap from input */
}

.suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.clear-btn {
    background: #3569a4;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    width: 50%;
    max-width: 150px;
}

.clear-btn:hover {
    background: #2c5a8a;
}

/* Brand Legend */
.brand-legend {
    position: fixed;
    bottom: 120px;
    left: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 140px;
    max-width: 200px;
    transition: all 0.3s ease;
}

.legend-header {
    background: #f8f9fa;
    color: #333;
    padding: 10px 12px;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.legend-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

.toggle-btn {
    background: #e9ecef;
    border: none;
    color: #333;
    font-size: 18px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.toggle-btn:hover {
    background: #dee2e6;
}

.legend-content {
    padding: 8px 12px;
    max-height: 400px;
    overflow-y: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    padding: 2px 0;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.legend-label {
    font-size: 0.8em;
    color: #333;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legend-count {
    margin-left: 4px;
    font-size: 0.7em;
    color: #666;
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.legend-collapsed .legend-content {
    display: none;
}

.legend-collapsed .toggle-btn {
    transform: rotate(180deg);
}

/* Footer */
.main-footer {
    background: #f8f9fa;
    padding: 0;
    margin: 0;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
    min-height: 40px;
    text-align: center;
    width: 100%;
    max-width: 100%;
    position: relative;
    left: 0;
    right: 0;
    overflow: hidden;
}

/* Detailed Pane - Chat Bubble Style */
.detailed-pane {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    z-index: 15000; /* Above loading overlay (z-index 10000) */
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Ensure no overlay backgrounds on detailed pane */
.overlay,
.detailed-pane-overlay,
.detailed-pane-backdrop {
    display: none !important;
}

.detailed-pane:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.detailed-pane.active {
    width: 30vw;
    height: 40vh;
    min-width: 400px;
    min-height: 700px;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 20px 20px 5px 20px; /* Chat bubble style - rounded except bottom-left */
    background: white;
    cursor: default;
    transform: scale(1);
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Media query for 1080p and below screens */
@media (max-height: 1080px) {
    .detailed-pane.active {
        max-height: calc(80vh - 200px);
        /* min-height: 600px; */
        z-index: 10001; /* Above loading overlay (z-index 10000) */
        height: calc(80vh - 250px);
    }
}

/* Chat bubble icon */
.detailed-pane::before {
    content: '💬';
    font-size: 20px;
    color: white;
    transition: all 0.3s ease-in-out;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    line-height: 1;
    text-align: center;
}

.detailed-pane.active::before {
    content: '';
    font-size: 0;
}

/* Chat bubble tail - only show when expanded */
.detailed-pane.active::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid white;
    z-index: 1001;
}

/* Pane Content - Hidden by default */
.pane-header,
.pane-content {
    display: none;
    opacity: 0;
    transition: all 0.3s ease-in-out;
}

.detailed-pane.active .pane-header {
    display: flex;
    opacity: 1;
}

.detailed-pane.active .pane-content {
    display: flex;
    opacity: 1;
}

/* Pane Header */
.pane-header {
    background: white;
    color: #333;
    padding: 18px 20px;
    min-height: 100px;
    position: relative;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0; /* Match the chat bubble top corners */
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border: 1px solid #e0e0e0;
    border-bottom: none;
}

.pane-header-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    flex: 1;
    margin-right: 25px;
}

.dealer-thumbnail-container {
    flex-shrink: 0;
}

.dealer-satellite-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.dealer-satellite-thumbnail:hover {
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.dealer-info-content {
    flex: 1;
    min-width: 0; /* Allow text to wrap */
}

.header-content {
    flex: 1;
    margin-right: 15px;
}

.pane-header h2 {
    font-size: 1.1em;
    margin: 0 0 8px 0;
    font-weight: 600;
    padding: 0;
    line-height: 1.2;
    word-wrap: break-word;
    hyphens: auto;
    color: #3569a4;
    text-align: left;
}

.pane-header p {
    font-size: 0.8em;
    opacity: 0.8;
    line-height: 1.3;
    margin: 0;
    padding: 0;
    color: #3569a4;
    text-align: left;
}

.pane-header p.dealer-brands {
    margin-top: 4px;
    font-size: 0.75em;
    opacity: 0.9;
    color: #3569a4;
    font-weight: 500;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    color: #666;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1002;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.close-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.close-btn:active {
    transform: scale(0.95);
}

/* Pane Content */
.pane-content {
    flex: 1;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Accordion Styles */
.accordion {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* Allow flex shrinking */
}

.accordion-item {
    margin-bottom: 12px;
}

.accordion-header {
    padding: 16px 20px;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    user-select: none;
}

.accordion-header:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.accordion-header h3 {
    font-size: 1.1em;
    color: #333;
    font-weight: 500;
}

.accordion-icon {
    font-size: 1.2em;
    color: #666;
    transition: transform 0.2s;
}

.accordion-content {
    display: none;
    padding-right: 10px;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-top: -8px;
    margin-bottom: 8px;
    max-height: 500px;
    overflow-y: auto;
}

/* When no dealer is selected - only show Piper Answers panel */
.detailed-pane.active.no-dealer-selected .accordion-item:not(.piper-answers-item) {
    display: none;
}

.detailed-pane.active.no-dealer-selected .piper-answers-item {
    height: 100%;
    display: flex;
    flex-direction: column;
    border: none;
    flex: 1; /* Take up all available space */
}

.detailed-pane.active.no-dealer-selected .piper-answers-item .accordion-content {
    display: block !important;
    flex: 1;
    height: 100%; /* Use full height */
    overflow-y: auto;
    padding: 20px;
    border: none;
    min-height: 0; /* Allow flex shrinking */
}

.detailed-pane.active.no-dealer-selected .piper-answers-item .accordion-header {
    flex-shrink: 0;
    margin: 0;
    border-radius: 0;
    border-bottom: none; /* Remove border when expanded */
    cursor: default; /* Make it non-clickable */
    background: #f8f9fa; /* Slightly different background to indicate non-interactive */
}

.detailed-pane.active.no-dealer-selected .piper-answers-item .accordion-icon {
    display: none; /* Hide the collapse icon when no dealer selected */
}

/* Visual indicator for non-collapsible panels */
.detailed-pane.active.no-dealer-selected .piper-answers-item .accordion-header h3::after {
    content: " ";
    font-size: 0.8em;
    color: #6c757d;
    font-weight: normal;
    font-style: italic;
}

/* When dealer is selected - show all panels */
.detailed-pane.active.dealer-selected .accordion-item {
    display: block;
}

.detailed-pane.active.dealer-selected .piper-answers-item {
    flex: 1; /* Take up all available space when dealer is selected */
    display: flex;
    flex-direction: column;
}

.detailed-pane.active.dealer-selected .piper-answers-item .accordion-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    min-height: 0; /* Allow flex shrinking */
}

/* Default expanded state for Piper Answers when dealer is selected */
.detailed-pane.active.dealer-selected .piper-answers-item .accordion-content.expanded {
    display: block !important;
}

.detailed-pane.active.dealer-selected .piper-answers-item .accordion-content:not(.expanded) {
    display: none !important;
}

.detailed-pane.active.dealer-selected .piper-answers-item .accordion-icon {
    display: block !important; /* Ensure icon is visible when dealer is selected */
    transform: rotate(45deg); /* Show expanded state */
}

/* Remove border when Piper Answers is expanded */
.detailed-pane.active.dealer-selected .piper-answers-item .accordion-header {
    border-bottom: none; /* Remove bottom border when expanded */
}

/* Chat bottom stack positioning within Piper Answers accordion */
#piperAnswersContent {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* Allow flex shrinking */
    padding-left: 10px; 
    overflow: hidden; /* Prevent content from bleeding outside */
}

/* Ensure the chat container uses full height */
#piperAnswersContent .w-full.flex.flex-col.items-center {
    height: 100% !important;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#piperAnswersContent .w-full.max-w-4xl.mx-auto {
    height: 100% !important;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#piperAnswersContent #chat-panel {
    flex: 1;
    height: 100% !important; /* Override chatscreen.css height calculation */
    min-height: 0 !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
}

#piperAnswersContent #chat-panel-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    min-height: 0; /* Allow flex shrinking */
}

#piperAnswersContent .message-content {
    min-height: 200px; /* Ensure minimum height for the message area */
    flex: 1;
}

#chat-bottom-stack {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%; /* Ensure it doesn't exceed container width */
    z-index: 15002 !important; /* Above DetailedPane (15000) and loading overlay (10000) to ensure inputs are clickable */
    background: white; /* Ensure it has a background */
    border-top: 1px solid #e0e0e0; /* Add a subtle border */
    box-sizing: border-box; /* Include padding/borders in width calculation */
    display: flex; /* Default display - will be toggled by JavaScript */
    flex-direction: column;
    align-items: center;
    pointer-events: none; /* Container doesn't block, but children will have pointer-events: auto */
}

/* Default state for other panels when dealer is selected */
.detailed-pane.active.dealer-selected .accordion-item:not(.piper-answers-item) {
    flex: 0 0 auto; /* Don't grow, don't shrink, auto size */
}

.detailed-pane.active.dealer-selected .accordion-item:not(.piper-answers-item) .accordion-content {
    display: none; /* Other panels collapsed by default */
}

.detailed-pane.active.dealer-selected .accordion-item:not(.piper-answers-item) .accordion-icon {
    transform: rotate(0deg); /* Show collapsed state */
}

/* Detail Sections */
.detail-section {
    margin-bottom: 20px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h4 {
    color: #333;
    font-size: 1em;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 600;
}

.detail-section p {
    margin-bottom: 8px;
    line-height: 1.5;
    color: #555;
}

.detail-section p:last-child {
    margin-bottom: 0;
}

.detail-section strong {
    color: #333;
    font-weight: 600;
}

/* Street View Sections */
.street-view-section {
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section-header {
    background: white;
    color: #333;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.section-header h5 {
    font-size: 1em;
    font-weight: 600;
    margin: 0;
}

.section-stats {
    font-size: 0.9em;
    background: #f8f9fa;
    color: #666;
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.section-details {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.section-details p {
    margin-bottom: 4px;
    font-size: 0.85em;
    color: #555;
}

.section-details p:last-child {
    margin-bottom: 0;
}

/* Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 12px;
    padding: 16px;
    background: white;
    max-height: 300px;
    overflow-y: auto;
}

.image-item {
    text-align: center;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.image-item.qualified {
    border-color: #28a745;
}

.image-item.unqualified {
    border-color: #dc3545;
}

.image-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.image-overlay {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qualification-badge {
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.image-item p {
    font-size: 0.8em;
    color: #666;
    margin-top: 4px;
    line-height: 1.3;
    padding: 0 4px;
}

.image-item .decision {
    font-size: 0.75em;
    color: #888;
    font-style: italic;
    margin-top: 2px;
}

.more-images {
    text-align: center;
    padding: 8px 16px;
    background: #f8f9fa;
    margin: 0;
    font-size: 0.8em;
    color: #666;
}

/* Q&A Items */
.qa-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    border-left: 4px solid #667eea;
}

.qa-item:last-child {
    margin-bottom: 0;
}

.qa-item p {
    margin-bottom: 6px;
}

.qa-item p:last-child {
    margin-bottom: 0;
}

.qa-item em {
    color: #666;
    font-size: 0.9em;
}

/* Tablet Responsive Design */
@media (max-width: 1024px) and (min-width: 769px) {
    .filter-controls {
        padding: 14px 18px;
    }
    
    .filter-row {
        gap: 16px;
    }
    
    .filter-group input,
    .filter-group select {
        min-width: 180px;
    }
}

/* iPad Portrait and Small Tablets */
@media (max-width: 820px) and (min-width: 481px) {
    .filter-controls {
        padding: 12px 16px;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 14px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group input,
    .filter-group select {
        min-width: auto;
        width: 100%;
    }
    
    .clear-btn {
        width: 50%;
        max-width: 140px;
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .main-header h1 {
        font-size: 48px;
        flex: none;
    }
    
    .header-logo {
        height: 45px;
    }
    
    .detailed-pane {
        width: 50px;
        height: 50px;
    }
    
    .detailed-pane.active {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        max-height: 90vh;
        border-radius: 20px 20px 20px 5px; /* Mobile: rounded except top-right */
    }
    
    .brand-legend {
        bottom: 80px;
        left: 10px;
        right: 50%;
        min-width: 140px;
        max-width: 200px;
    }
    
    .legend-header {
        padding: 8px 10px;
    }
    
    .legend-header h3 {
        font-size: 1.0em;
    }
    
    .legend-content {
        padding: 6px 10px;
    }
    
    .legend-item {
        margin-bottom: 4px;
    }
    
    .legend-color {
        width: 10px;
        height: 10px;
        margin-right: 6px;
    }
    
    .legend-label {
        font-size: 0.75em;
    }
    
    .legend-count {
        font-size: 0.65em;
        padding: 1px 3px;
        min-width: 14px;
    }
    
    .filter-controls {
        padding: 12px 15px;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group input,
    .filter-group select {
        min-width: auto;
        width: 100%;
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .clear-btn {
        width: 50%;
        max-width: 120px;
        padding: 10px 16px;
        font-size: 16px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .filter-controls {
        padding: 10px 12px;
    }
    
    .filter-group label {
        font-size: 0.85em;
    }
    
    .filter-group input,
    .filter-group select {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .clear-btn {
        width: 50%;
        max-width: 100px;
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .detailed-pane.active::after {
        right: 20px;
        bottom: -10px;
        border-left: 15px solid transparent;
        border-right: 15px solid transparent;
        border-top: 15px solid white;
    }
    
    .image-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        padding: 10px 12px;
    }
    
    .section-header h5 {
        font-size: 0.9em;
    }
    
    .section-details {
        padding: 10px 12px;
    }
    
    .image-grid {
        padding: 12px;
    }
    
    .pane-header {
        padding: 16px;
    }
    
    .pane-header-content {
        gap: 12px;
    }
    
    .dealer-satellite-thumbnail {
        width: 100px;
        height: 100px;
    }
    
    .pane-header h2 {
        font-size: 1.0em;
    }
    
    .pane-header p {
        font-size: 0.75em;
    }
    
    .accordion-header {
        padding: 14px 16px;
    }
    
    .accordion-content {
        padding: 16px;
    }
}

/* Image Modal Styles */
.image-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important; /* Even higher z-index to appear above everything including detailed pane */
    display: flex !important; /* Force display to override any conflicting styles */
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    margin: 0 !important;
    padding: 0 !important;
}

.image-modal.hidden {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
    z-index: 9998;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 10000;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.modal-content img {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

.modal-image-info {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    text-align: center; /* Center all text content */
}

.modal-image-info p {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    text-align: center; /* Ensure text is centered */
}

.modal-image-info p:last-child {
    margin-bottom: 0;
}

.modal-image-info .decision {
    font-style: italic;
    color: #666;
    text-align: center; /* Center decision text */
}

/* Make images clickable */
.image-item img {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-item img:hover {
    transform: scale(1.05);
}

/* Mobile responsiveness for modal */
@media (max-width: 768px) {
    .image-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
    }
    
    .modal-content {
        max-width: 95vw;
        max-height: 95vh;
        margin: 10px;
    }
    
    .modal-close-btn {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .modal-content img {
        max-height: 60vh;
    }
    
    .modal-image-info {
        padding: 15px;
        text-align: center;
    }
    
    .modal-image-info p {
        font-size: 13px;
        text-align: center;
    }
}

/* Scrollbar Styling */
.pane-content::-webkit-scrollbar,
.accordion-content::-webkit-scrollbar,
.image-grid::-webkit-scrollbar {
    width: 6px;
}

.pane-content::-webkit-scrollbar-track,
.accordion-content::-webkit-scrollbar-track,
.image-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.pane-content::-webkit-scrollbar-thumb,
.accordion-content::-webkit-scrollbar-thumb,
.image-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.pane-content::-webkit-scrollbar-thumb:hover,
.accordion-content::-webkit-scrollbar-thumb:hover,
.image-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading states */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Welcome Modal Styles - Top Level Modal (matching image modal pattern) */
.welcome-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 100000 !important; /* Higher than image modal's 99999 */
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    margin: 0 !important;
    padding: 0 !important;
}

.welcome-modal.show {
    display: flex !important; /* Force display override */
}

.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(245, 245, 245, 0.75); /* Whitesmoke overlay at 55% opacity - professional lead-gen modal */
    cursor: default;
    z-index: 99998; /* Below modal content */
}

.welcome-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    z-index: 100001; /* Above overlay */
    display: flex;
    flex-direction: column;
}

.welcome-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100002; /* Above everything */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.welcome-close-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Welcome Content Styles */
.welcome-content {
    padding-top: 15px;
    padding-left: 15px;
    padding-right: 15px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
    min-height: 0;
}

.welcome-content h1 {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.2;
    flex-shrink: 0;
}

.welcome-panels {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.welcome-left-panel {
    flex: 1.7; /* Reduced from 2 to give more space to right panel */
    padding-top: 35px;
}

.welcome-right-panel {
    flex: 1.8; /* Increased from 1 to make graph bigger */
    display: flex;
    flex-direction: column;
}

.greeting {
    margin-bottom: 15px;
}

.greeting p {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    margin-bottom: 8px;
}

.study-section {
    margin-bottom: 15px;
}

.study-section h2 {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.2;
}

.study-section p {
    font-size: 13px;
    line-height: 1.3;
    color: #333;
    margin-bottom: 8px;
}

.study-link {
    color: #1e3a8a;
    text-decoration: none;
    font-weight: 500;
}

.study-link:hover {
    text-decoration: underline;
}

.welcome-right-panel h2 {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
    line-height: 1.2;
}

.graph-placeholder {
    background: #f8f9fa;
    /*
    border: 2px dashed #dee2e6;
    border-radius: 8px; */
    flex: 1; /* Fill available height in right panel */
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #666;
    overflow: hidden;
    padding: 5px;
}

.graph-placeholder p {
    margin: 3px 0;
    font-size: 14px;
}

.graph-placeholder .chart-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.welcome-bottom-panel {
    text-align: center;
    padding-top: 15px;
    padding-bottom: 30px;
    border-top: 1px solid #e0e0e0;
    margin-top: 15px;
    flex-shrink: 0;
    min-height: auto;
    height: auto;
}

.dealerships-btn {
    background: #FFD700;
    color: #000000;
    border: none;
    padding: 14px 30px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    width: 80%;
    max-width: 800px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    text-transform: none;
    letter-spacing: 0.3px;
}

.dealerships-btn:hover {
    background: #FFC700;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.dealerships-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.bottom-text {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.3;
}

/* Responsive styles for Welcome Modal - Stack panels below 1200px */
@media (max-width: 1200px) {
    .welcome-panels {
        flex-direction: column;
    }
    
    .welcome-left-panel {
        flex: 1;
        padding-top: 0;
    }
    
    .welcome-right-panel {
        flex: 1;
    }
    
    .graph-placeholder {
        min-height: 300px;
    }
}

/* Ensure vertical scrollbar on welcome-panels below 1100px */
@media (max-width: 1100px) {
    .welcome-panels {
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .welcome-panels::-webkit-scrollbar {
        width: 8px;
    }
    
    .welcome-panels::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    
    .welcome-panels::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 4px;
    }
    
    .welcome-panels::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
}

/* Chat satellite image styles */
.chat-satellite-image {
    max-width: 240px;
    height: auto;
    cursor: pointer;
    border-radius: 8px;
    margin-top: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e0e0e0;
}

.chat-satellite-image:hover {
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Responsive styles for Page Header and Footer Images */
/* Ensure images maintain 100% width and flush edges across all screen sizes */
@media (max-width: 1024px) {
    .page-header-image,
    .page-footer-image {
        width: 100%;
        margin: 0;
        padding: 0;
    }
}

@media (max-width: 768px) {
    .page-header-image,
    .page-footer-image {
        width: 100%;
        margin: 0;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .page-header-image,
    .page-footer-image {
        width: 100%;
        margin: 0;
        padding: 0;
    }
}

/* Ensure images are flush with viewport edges */
@media (min-width: 1025px) {
    .page-header-image,
    .page-footer-image {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
        max-width: 100%;
    }
}