/* Hide default Leaflet popup completely */
.leaflet-popup {
    display: none !important;
}

.leaflet-popup-pane {
    display: none !important;
}

/* ========================================
   DARK THEME SUPPORT FOR MAP PAGE
   ======================================== */

[data-theme="dark"] #zipcode-modal {
    background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .modal-content {
    background: #1f2937;
    color: #f9fafb;
}

[data-theme="dark"] .stat-card {
    background: linear-gradient(145deg, #374151, #1f2937);
    border-color: #4b5563;
}

[data-theme="dark"] .stat-label {
    color: #9ca3af;
}

[data-theme="dark"] .stat-value {
    color: #f9fafb;
}

[data-theme="dark"] .modal-tabs {
    border-color: #374151;
}

[data-theme="dark"] .modal-tab {
    background: #374151;
    color: #9ca3af;
}

[data-theme="dark"] .modal-tab:hover {
    background: #4b5563;
    color: #e5e7eb;
}

[data-theme="dark"] .modal-section-title {
    color: #f9fafb;
    border-color: #374151;
}

[data-theme="dark"] .modal-actions {
    background: #111827;
    border-color: #374151;
}

[data-theme="dark"] .close-modal {
    background: rgba(55, 65, 81, 0.9);
    color: #f9fafb;
}

[data-theme="dark"] .close-modal:hover {
    background: rgba(75, 85, 99, 1);
}

[data-theme="dark"] .quick-stat-row {
    background: #374151;
    border-color: #4b5563;
}

[data-theme="dark"] .quick-stat-label {
    color: #9ca3af;
}

[data-theme="dark"] .quick-stat-value {
    color: #f9fafb;
}

[data-theme="dark"] .comparison-chip {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e3a8a 100%);
    border-color: #3b82f6;
    color: #93c5fd;
}

[data-theme="dark"] .recent-item,
[data-theme="dark"] .bookmark-item {
    background: #374151;
}

[data-theme="dark"] .recent-item:hover,
[data-theme="dark"] .bookmark-item:hover {
    background: rgba(249, 115, 22, 0.15);
}

[data-theme="dark"] .heatmap-btn {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

[data-theme="dark"] .heatmap-btn:hover {
    background: rgba(249, 115, 22, 0.15);
    border-color: #f97316;
    color: #fb923c;
}

[data-theme="dark"] .map-tool-btn {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

[data-theme="dark"] .map-tool-btn:hover {
    background: #4b5563;
    border-color: #6b7280;
}

[data-theme="dark"] #comparison-modal > div {
    background: #1f2937;
}

[data-theme="dark"] #comparison-modal .bg-gradient-to-r {
    background: linear-gradient(to right, #1e40af, #1d4ed8) !important;
}

[data-theme="dark"] .comparison-table {
    background: #1f2937;
}

[data-theme="dark"] .comparison-table th {
    background: linear-gradient(to right, #92400e, #b45309) !important;
    color: #fef3c7 !important;
    border-color: #4b5563;
}

[data-theme="dark"] .comparison-table th:first-child {
    background: linear-gradient(to right, #374151, #4b5563) !important;
    color: #e5e7eb !important;
}

[data-theme="dark"] .comparison-table td {
    color: #f9fafb;
    background: #1f2937;
    border-color: #374151;
}

[data-theme="dark"] .comparison-table td:first-child {
    background: linear-gradient(to right, #374151, #4b5563) !important;
    color: #f9fafb;
}

[data-theme="dark"] .comparison-table tr:nth-child(even) td {
    background: #111827;
}

[data-theme="dark"] .comparison-table tr:nth-child(even) td:first-child {
    background: linear-gradient(to right, #1f2937, #374151) !important;
}

[data-theme="dark"] .comparison-table tr:hover td {
    background: rgba(249, 115, 22, 0.15) !important;
}

[data-theme="dark"] .comparison-table tr:hover td:first-child {
    background: rgba(249, 115, 22, 0.25) !important;
}

[data-theme="dark"] .comparison-table .comparison-header {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%) !important;
    color: #f9fafb !important;
}

[data-theme="dark"] .comparison-table .best-value {
    background: rgba(22, 163, 74, 0.3) !important;
    color: #4ade80 !important;
    font-weight: 700;
}

[data-theme="dark"] .comparison-table .worst-value {
    background: rgba(220, 38, 38, 0.3) !important;
    color: #f87171 !important;
}

[data-theme="dark"] #heatmap-legend {
    background: #374151;
}

[data-theme="dark"] .manual-compare-section {
    background: linear-gradient(135deg, #1f2937, #374151);
    border-color: #4b5563;
}

[data-theme="dark"] .manual-zip-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

[data-theme="dark"] .manual-zip-input::placeholder {
    color: #9ca3af;
}

/* Full-screen modal styles - Mobile first approach */
#zipcode-modal {
    backdrop-filter: blur(8px);
    z-index: 99999;
    animation: fadeIn 0.4s ease-out;
    align-items: flex-start !important;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Desktop responsive styles */
@media (min-width: 768px) {
    #zipcode-modal {
        align-items: center !important;
        justify-content: center !important;
        padding: 1rem;
    }
}

#zipcode-modal.hidden {
    animation: fadeOut 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
    to {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
}

.modal-content {
    /* Mobile: Full screen with better spacing */
    height: 100vh;
    max-height: 100vh;
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative;
}

/* Desktop responsive modal sizing */
@media (min-width: 768px) {
    .modal-content {
        height: auto;
        max-height: 92vh;
        width: 95%;
        max-width: 1300px;
        border-radius: 1.5rem;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    }
}

@media (min-width: 1024px) {
    .modal-content {
        max-width: 1500px;
        width: 92%;
        max-height: 94vh;
    }
}

@media (min-width: 1440px) {
    .modal-content {
        max-width: 1600px;
        width: 90%;
        max-height: 95vh;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close button styling */
.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: #374151;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.15);
}

/* Tab styling */
.modal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 1rem;
}

.modal-tab {
    padding: 0.75rem 1rem;
    border: none;
    background: #f9fafb;
    color: #6b7280;
    border-radius: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    flex: 1;
    min-width: fit-content;
}

@media (min-width: 640px) {
    .modal-tab {
        flex: none;
        font-size: 1rem;
        padding: 1rem 1.5rem;
    }
}

.modal-tab:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-tab.active {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.3);
}

/* Tab panel styling */
.modal-tab-panel {
    display: none;
}

.modal-tab-panel.active {
    display: block;
}

/* Section styling */
.modal-section {
    margin-bottom: 2rem;
}

.modal-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f3f4f6;
}

@media (min-width: 640px) {
    .modal-section-title {
        font-size: 1.5rem;
        margin-bottom: 2rem;
    }
}

.modal-section-title span {
    font-size: 1.5rem;
}

/* Stats grid responsive design */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

/* Stat card enhanced styling */
.stat-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -6px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f97316, #ea580c);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

@media (min-width: 640px) {
    .stat-label {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
}

/* Original stat-value styling (reverted) */
.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
    word-break: break-word;
}

@media (min-width: 640px) {
    .stat-value {
        font-size: 1.5rem;
    }
}

@media (min-width: 768px) {
    .stat-value {
        font-size: 1.375rem;
    }
}

/* Action buttons */
.modal-actions {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    margin-top: auto;
}

.btn-primary {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -2px rgba(249, 115, 22, 0.4);
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #f97316;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

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


/* Focus States for Accessibility */
.modal-tab:focus,
.btn-primary:focus,
.close-modal:focus {
    outline: 3px solid rgba(249, 115, 22, 0.5);
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .stat-card {
        border: 2px solid #1e293b;
    }

    .modal-tab.active {
        border: 2px solid #ffffff;
    }
}

/* ========================================
   HEATMAP CONTROLS
   ======================================== */

.heatmap-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 2px solid #e5e7eb;
    background: #ffffff;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.heatmap-btn:hover {
    border-color: #f97316;
    background: #fff7ed;
    color: #ea580c;
}

.heatmap-btn.active {
    border-color: #f97316;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

#legend-gradient {
    background: linear-gradient(to right, #22c55e, #eab308, #ef4444);
}

#legend-gradient.income {
    background: linear-gradient(to right, #ef4444, #eab308, #22c55e);
}

#legend-gradient.crime {
    background: linear-gradient(to right, #22c55e, #eab308, #ef4444);
}

#legend-gradient.affordability {
    background: linear-gradient(to right, #22c55e, #84cc16, #eab308, #f97316, #ef4444);
}

/* ========================================
   QUICK STATS PANEL
   ======================================== */

.quick-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border-left: 3px solid #e5e7eb;
    transition: all 0.2s ease;
}

.quick-stat-row:hover {
    background: #fff7ed;
    border-left-color: #f97316;
}

.quick-stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.quick-stat-value {
    font-size: 0.8rem;
    color: #1f2937;
    font-weight: 700;
}

/* ========================================
   MAP TOOL BUTTONS
   ======================================== */

.map-tool-btn {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-tool-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* ========================================
   COMPARISON CHIPS
   ======================================== */

.comparison-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.625rem;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #93c5fd;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1e40af;
}

.comparison-chip .remove-btn {
    margin-left: 0.5rem;
    cursor: pointer;
    color: #3b82f6;
    font-weight: bold;
}

.comparison-chip .remove-btn:hover {
    color: #dc2626;
}

/* ========================================
   RECENT SEARCHES & BOOKMARKS
   ======================================== */

.recent-item, .bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.625rem;
    background: #f9fafb;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.recent-item:hover, .bookmark-item:hover {
    background: #fff7ed;
}

.recent-item .zipcode, .bookmark-item .zipcode {
    font-weight: 600;
    color: #f97316;
}

.recent-item .city, .bookmark-item .city {
    color: #6b7280;
    font-size: 0.7rem;
}

.bookmark-item .remove-bookmark {
    color: #9ca3af;
    cursor: pointer;
}

.bookmark-item .remove-bookmark:hover {
    color: #dc2626;
}

/* ========================================
   COMPARISON MODAL
   ======================================== */

#comparison-modal {
    backdrop-filter: blur(8px);
    z-index: 100000 !important;
}

#comparison-modal > div {
    z-index: 100001 !important;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.comparison-table th,
.comparison-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.comparison-table th {
    background: linear-gradient(to right, #fed7aa, #fdba74);
    font-weight: 600;
    color: #1f2937;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.comparison-table th:first-child {
    background: linear-gradient(to right, #f3f4f6, #e5e7eb);
    color: #374151;
}

.comparison-table td {
    font-size: 0.9rem;
    color: #111827;
    font-weight: 500;
}

.comparison-table td:first-child {
    background: linear-gradient(to right, #f9fafb, #f3f4f6);
    color: #1f2937;
    font-weight: 600;
}

.comparison-table tr:nth-child(even) td {
    background: #f9fafb;
}

.comparison-table tr:nth-child(even) td:first-child {
    background: linear-gradient(to right, #f3f4f6, #e5e7eb);
}

.comparison-table tr:hover td {
    background: #fff7ed;
}

.comparison-table tr:hover td:first-child {
    background: linear-gradient(to right, #fee2e2, #fecaca);
}

.comparison-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    color: white !important;
    font-weight: 700;
    text-align: center;
}

.best-value {
    background: linear-gradient(to right, #bbf7d0, #86efac) !important;
    color: #166534 !important;
    font-weight: 700;
}

.worst-value {
    background: linear-gradient(to right, #fecaca, #fca5a5) !important;
    color: #991b1b !important;
    font-weight: 600;
}

/* ========================================
   HEATMAP POLYGON STYLES
   ======================================== */

.leaflet-interactive.heatmap-polygon {
    transition: fill-opacity 0.3s ease;
}

.leaflet-interactive.heatmap-polygon:hover {
    fill-opacity: 0.9 !important;
}

/* ========================================
   FULLSCREEN MAP MODE
   ======================================== */

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

.fullscreen-exit-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

.fullscreen-exit-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* ========================================
   FILTER HIGHLIGHT
   ======================================== */

.zipcode-filtered-out {
    opacity: 0.2 !important;
}

.zipcode-filtered-in {
    stroke: #f97316 !important;
    stroke-width: 3 !important;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 1024px) {
    .quick-stat-row {
        padding: 0.375rem 0.5rem;
    }

    .quick-stat-label {
        font-size: 0.7rem;
    }

    .quick-stat-value {
        font-size: 0.75rem;
    }

    .heatmap-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }
}

/* ========================================
   MANUAL ZIP AUTOCOMPLETE DROPDOWN
   ======================================== */

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.autocomplete-dropdown.hidden {
    display: none;
}

.autocomplete-dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.8rem;
    transition: background 0.15s ease;
}

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

.autocomplete-dropdown-item:hover {
    background: #fff7ed;
}

/* Dark mode for autocomplete dropdown */
[data-theme="dark"] .autocomplete-dropdown {
    background: #1f2937;
    border-color: #374151;
}

[data-theme="dark"] .autocomplete-dropdown-item {
    border-color: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] .autocomplete-dropdown-item:hover {
    background: rgba(249, 115, 22, 0.15);
}

[data-theme="dark"] .autocomplete-dropdown-item .text-gray-500 {
    color: #9ca3af;
}

/* Manual compare inputs container fix */
.manual-compare-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 480px) {
    .manual-compare-inputs {
        flex-direction: row;
    }
}

.manual-compare-inputs .relative {
    position: relative;
}

/* ========================================
   MOBILE FIXES FOR ZIPCODE MODAL
   ======================================== */

/* Mobile-friendly modal content padding */
@media (max-width: 767px) {
    .modal-content {
        padding: 0;
    }

    .modal-content > .p-6 {
        padding: 1rem !important;
    }

    /* Fix modal header on mobile */
    .modal-content .bg-gradient-to-r.from-orange-400 {
        padding: 1rem !important;
    }

    .modal-content .bg-gradient-to-r.from-orange-400 h2 {
        font-size: 1.25rem !important;
    }

    .modal-content .bg-gradient-to-r.from-orange-400 p {
        font-size: 0.875rem !important;
    }

    /* Fix tabs on mobile - horizontal scroll */
    .modal-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
        gap: 0.375rem;
    }

    .modal-tabs::-webkit-scrollbar {
        display: none;
    }

    .modal-tab {
        flex: 0 0 auto;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Fix stats grid on mobile */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Fix stat cards on mobile */
    .stat-card {
        padding: 1rem;
    }

    .stat-label {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .stat-value {
        font-size: 1.1rem;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Fix section titles on mobile */
    .modal-section-title {
        font-size: 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-section-title span {
        font-size: 1.25rem;
    }

    /* Comparison table mobile fixes */
    .comparison-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.8rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem 0.625rem;
        min-width: 100px;
        white-space: nowrap;
    }

    .comparison-table td:first-child,
    .comparison-table th:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        min-width: 120px;
    }

    /* Modal actions on mobile */
    .modal-actions {
        padding: 1rem;
        position: sticky;
        bottom: 0;
        background: #f8fafc;
    }

    .btn-primary {
        width: 100%;
        padding: 0.875rem 1.5rem;
    }
}

/* ========================================
   IMPROVED COMPARISON MODAL STYLES
   ======================================== */

#comparison-modal {
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

#comparison-modal > div {
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Responsive grid for comparison cards */
@media (max-width: 767px) {
    #comparison-content .grid-cols-2,
    #comparison-content .grid-cols-3 {
        grid-template-columns: 1fr !important;
    }

    /* Show zipcode label on mobile in metrics */
    #comparison-content .text-xs.text-gray-400.md\:hidden {
        display: block !important;
    }
}

@media (min-width: 768px) {
    #comparison-content .md\:hidden {
        display: none !important;
    }
}

/* Comparison card hover effects */
#comparison-content .bg-gradient-to-br {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#comparison-content .bg-gradient-to-br:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(249, 115, 22, 0.3);
}

/* Metric card animations */
#comparison-content .rounded-lg {
    transition: all 0.2s ease;
}

#comparison-content .bg-gray-50:hover,
#comparison-content .bg-blue-50:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Winner badge pulse animation */
#comparison-content .ring-green-400 {
    animation: winnerPulse 2s ease-in-out infinite;
}

@keyframes winnerPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(74, 222, 128, 0);
    }
}

/* Sticky header for comparison modal */
#comparison-modal .sticky {
    backdrop-filter: blur(8px);
}

/* Full report button styling */
#full-comparison-link {
    transition: all 0.2s ease;
}

#full-comparison-link:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Dark mode for new comparison elements */
[data-theme="dark"] #comparison-content .bg-gray-50 {
    background: #374151;
}

[data-theme="dark"] #comparison-content .bg-white {
    background: #4b5563;
}

[data-theme="dark"] #comparison-content .bg-green-100 {
    background: rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] #comparison-content .bg-blue-50 {
    background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] #comparison-content .text-gray-500 {
    color: #9ca3af;
}

[data-theme="dark"] #comparison-content .text-gray-800 {
    color: #f9fafb;
}

[data-theme="dark"] #comparison-content .border-gray-200 {
    border-color: #4b5563;
}
