/**
 * Map Styles - Custom styling for Leaflet map integration
 */

/* Map Container */
#map-container {
    background-color: #0f172a;
}

/* Compact Toolbar Layer Buttons */
.map-layer-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #64748b;
    transition: all 0.15s ease;
    cursor: pointer;
}

.map-layer-btn:hover {
    background: #334155;
    color: #e2e8f0;
}

.map-layer-btn.active {
    background: color-mix(in srgb, var(--layer-color) 20%, #1e293b);
    border-color: var(--layer-color);
    color: var(--layer-color);
}

.map-layer-btn.active:hover {
    background: color-mix(in srgb, var(--layer-color) 30%, #1e293b);
}

/* Tooltip for layer buttons */
.map-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 6px;
    padding: 4px 8px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 4px;
    font-size: 10px;
    color: #e2e8f0;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 100;
    pointer-events: none;
}

.map-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: #475569;
}

.map-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 3px solid transparent;
    border-bottom-color: #1e293b;
}

.group:hover .map-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Compact Action Buttons */
.map-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    transition: all 0.15s ease;
    cursor: pointer;
}

.map-action-btn:hover {
    background: #334155;
    color: #e2e8f0;
}

.map-action-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* Timeline Slider */
#map-timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#map-timeline-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Timeline Chart Bars */
#timeline-chart .timeline-bar {
    flex: 1;
    min-width: 3px;
    max-width: 12px;
    background: linear-gradient(to top, #3b82f6, #60a5fa);
    border-radius: 2px 2px 0 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

#timeline-chart .timeline-bar:hover {
    background: linear-gradient(to top, #2563eb, #3b82f6);
    transform: scaleY(1.1);
}

#timeline-chart .timeline-bar.inactive {
    background: #334155;
    opacity: 0.5;
}

/* Region Stats */
#map-region-stats .region-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

#map-region-stats .region-bar {
    flex: 1;
    height: 4px;
    background: #334155;
    border-radius: 2px;
    overflow: hidden;
}

#map-region-stats .region-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Quick Stats Cards (Maptive style) */
.map-stat-card {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 70px;
    text-align: center;
    transition: all 0.2s ease;
}

.map-stat-card:hover {
    border-color: var(--accent, #3b82f6);
    transform: translateY(-1px);
}

.map-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent, #3b82f6);
    line-height: 1.2;
}

.map-stat-label {
    font-size: 9px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Radius Chips */
.radius-chip {
    padding: 4px 10px;
    font-size: 11px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.radius-chip:hover {
    background: #334155;
    color: #e2e8f0;
}

.radius-chip.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* ============================================
   FLOATING DATA PANEL STYLES
   ============================================ */

/* Floating Data Panel Container */
.map-data-panel-floating {
    position: absolute;
    bottom: 16px;
    left: 16px;
    width: 360px;
    max-height: 400px;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 16px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: panelSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-data-panel-floating.expanded {
    width: 480px;
    max-height: 60vh;
}

.map-data-panel-floating.hidden {
    display: none;
}

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

/* Panel Header */
.map-data-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(30, 41, 59, 0.5);
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
}

.data-panel-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.data-panel-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(51, 65, 85, 0.4);
    border: 1px solid rgba(71, 85, 105, 0.3);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.data-panel-btn:hover {
    background: rgba(71, 85, 105, 0.5);
    color: #e2e8f0;
    transform: scale(1.05);
}

/* Panel Search Area */
.map-data-panel-search {
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.3);
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.data-panel-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.data-panel-filter-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 500;
    background: rgba(51, 65, 85, 0.4);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 20px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.data-panel-filter-chip:hover {
    background: rgba(71, 85, 105, 0.5);
    color: #e2e8f0;
}

.data-panel-filter-chip.active {
    background: var(--chip-color, rgba(59, 130, 246, 0.2));
    border-color: var(--chip-color, #3b82f6);
    color: var(--chip-color, #60a5fa);
}

.data-panel-filter-chip .chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.data-panel-filter-chip .chip-count {
    opacity: 0.7;
}

/* Panel Content */
.map-data-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(71, 85, 105, 0.5) transparent;
}

.map-data-panel-content::-webkit-scrollbar {
    width: 6px;
}

.map-data-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.map-data-panel-content::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.5);
    border-radius: 3px;
}

.map-data-panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.6);
}

/* Panel Footer */
.map-data-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(30, 41, 59, 0.4);
    border-top: 1px solid rgba(51, 65, 85, 0.3);
}

/* Data Panel Rows */
.data-panel-row {
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.data-panel-row:hover {
    background: rgba(59, 130, 246, 0.08);
    border-left-color: rgba(59, 130, 246, 0.5);
}

.data-panel-row.selected,
.data-panel-row.highlighted {
    background: rgba(59, 130, 246, 0.15);
    border-left-color: #3b82f6;
}

.data-panel-row.highlighted::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    animation: highlightPulse 1.5s ease-out infinite;
}

@keyframes highlightPulse {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.5; transform: translateY(-50%) scale(1.5); }
}

.data-panel-row .row-name {
    font-size: 13px;
    font-weight: 500;
    color: #e2e8f0;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.data-panel-row .row-type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.data-panel-row .row-address {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 4px;
    padding-left: 14px;
}

.data-panel-row .row-meta {
    display: flex;
    gap: 12px;
    font-size: 10px;
    padding-left: 14px;
}

.data-panel-row .row-meta span {
    color: #94a3b8;
}

.data-panel-row .row-meta .value {
    color: #22c55e;
    font-weight: 600;
}

/* Empty state */
.data-panel-empty {
    padding: 32px 16px;
    text-align: center;
    color: #64748b;
}

.data-panel-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.data-panel-empty p {
    font-size: 13px;
}

/* Loading state */
.data-panel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    color: #94a3b8;
}

.data-panel-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .map-data-panel-floating {
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-height: 50vh;
    }

    .map-data-panel-floating.expanded {
        width: auto;
        max-height: 70vh;
    }
}

/* Lasso Drawing Cursor */
.leaflet-container.lasso-mode {
    cursor: crosshair !important;
}

/* Radius Circle Styling */
.radius-circle {
    fill: rgba(59, 130, 246, 0.15);
    stroke: #3b82f6;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

/* Heat map legend */
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #94a3b8;
}

.heatmap-legend .gradient-bar {
    width: 60px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #3b82f6, #22c55e, #f59e0b, #ef4444);
}

/* Dynamic Marker Sizing */
.map-marker.size-sm { width: 24px; height: 24px; }
.map-marker.size-md { width: 32px; height: 32px; }
.map-marker.size-lg { width: 40px; height: 40px; }
.map-marker.size-xl { width: 48px; height: 48px; }

.map-marker.size-sm i { font-size: 10px; }
.map-marker.size-md i { font-size: 12px; }
.map-marker.size-lg i { font-size: 14px; }
.map-marker.size-xl i { font-size: 16px; }

/* Custom Marker Styles */
.custom-marker {
    background: none;
    border: none;
}

.map-marker {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.map-marker i {
    transform: rotate(45deg);
    color: white;
    font-size: 12px;
}

/* Cluster Marker Styles */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
}

.marker-cluster div {
    width: 36px;
    height: 36px;
    margin-left: 2px;
    margin-top: 2px;
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster span {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.marker-cluster-small {
    background-color: rgba(0, 0, 0, 0.2);
}

.marker-cluster-small div {
    width: 30px;
    height: 30px;
}

.marker-cluster-medium {
    background-color: rgba(0, 0, 0, 0.3);
}

.marker-cluster-large {
    background-color: rgba(0, 0, 0, 0.4);
}

.marker-cluster-large div {
    width: 44px;
    height: 44px;
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border: 1px solid #334155;
    max-width: 360px;
    overflow: hidden;
}

/* Product Image in Popup */
.map-popup img {
    transition: opacity 0.2s ease;
}

.map-popup img:hover {
    opacity: 0.9;
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
}

.leaflet-popup-tip {
    background: #1e293b;
    border: 1px solid #334155;
}

.map-popup {
    padding: 12px;
    min-width: 200px;
    max-width: 280px;
}

/* Enhanced Popup Styles */
.map-popup-enhanced {
    padding: 16px;
    min-width: 280px;
    max-width: 320px;
    position: relative;
    overflow: hidden;
}

.map-popup-enhanced img {
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.map-popup-enhanced img:hover {
    transform: scale(1.02);
}

/* Gallery thumbnail hover effects */
.map-popup-enhanced .gallery-thumb {
    transition: all 0.2s ease;
}

.map-popup-enhanced .gallery-thumb:hover {
    transform: scale(1.1);
    z-index: 1;
}

/* Price badge animation */
.map-popup-enhanced .price-badge {
    animation: priceSlideIn 0.3s ease-out;
}

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

/* Button hover effects */
.map-popup-enhanced button,
.map-popup-enhanced a {
    transition: all 0.2s ease;
}

.map-popup-enhanced button:hover {
    transform: translateY(-1px);
}

/* Gradient type badges */
.map-popup-enhanced .type-badge {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Address card subtle animation */
.map-popup-enhanced .address-card {
    transition: background-color 0.2s ease;
}

.map-popup-enhanced .address-card:hover {
    background-color: rgba(51, 65, 85, 0.5);
}

/* Shimmer effect for loading images */
.map-popup-enhanced .image-loading {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Details section fade in */
.map-popup-enhanced .details-section {
    animation: detailsFadeIn 0.3s ease-out 0.1s both;
}

@keyframes detailsFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.leaflet-popup-close-button {
    color: #94a3b8 !important;
    font-size: 18px;
    padding: 8px 10px !important;
}

.leaflet-popup-close-button:hover {
    color: #f1f5f9 !important;
}

/* Control Styles */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-control-zoom a {
    background-color: rgba(15, 23, 42, 0.9) !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
    background-color: #1e293b !important;
    color: white !important;
}

.leaflet-control-zoom-in {
    border-radius: 8px 8px 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 8px 8px !important;
}

/* Attribution */
.leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.8) !important;
    color: #64748b !important;
    font-size: 10px;
    padding: 2px 8px !important;
    border-radius: 4px 0 0 0;
}

.leaflet-control-attribution a {
    color: #60a5fa !important;
}

/* Mobile Sidebar Overlay */
@media (max-width: 768px) {
    #map-sidebar {
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }

    #map-sidebar.translate-x-0 {
        transform: translateX(0) !important;
    }

    /* Bottom sheet style for mobile results */
    #map-stats-bar {
        left: 8px;
        right: 8px;
        bottom: 8px;
    }
}

/* Search Results Hover Effect */
#map-results-list > div:hover {
    transform: translateX(4px);
}

/* Layer Toggle Checkboxes */
#map-layers input[type="checkbox"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

/* Geocoding Progress Bar Animation */
#map-geocode-bar {
    transition: width 0.3s ease-out;
}

/* Map Controls Hover Effects */
#map-controls button {
    transition: all 0.2s ease;
}

#map-controls button:hover {
    transform: scale(1.05);
}

/* Loading State - Map Being Sketched Animation */
.map-loading {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow: hidden;
}

.map-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(34, 197, 94, 0.1) 0%, transparent 50%);
    animation: ambientGlow 4s ease-in-out infinite;
}

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

/* Sketch Container */
.map-sketch-container {
    position: relative;
    width: 200px;
    height: 140px;
    margin-bottom: 24px;
}

/* Map outline being drawn */
.map-sketch-outline {
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: linear-gradient(#1e293b, #1e293b) padding-box,
                linear-gradient(90deg, #3b82f6, #22c55e, #f59e0b, #ef4444) border-box;
    background-size: 400% 100%;
    animation: borderDraw 2s ease-in-out infinite;
}

@keyframes borderDraw {
    0% { background-position: 0% 0%; clip-path: inset(0 100% 0 0); }
    25% { clip-path: inset(0 0 100% 0); }
    50% { background-position: 100% 0%; clip-path: inset(0 0 0 100%); }
    75% { clip-path: inset(100% 0 0 0); }
    100% { background-position: 200% 0%; clip-path: inset(0 100% 0 0); }
}

/* Grid lines being sketched */
.map-sketch-grid {
    position: absolute;
    inset: 8px;
    overflow: hidden;
}

.map-sketch-grid::before,
.map-sketch-grid::after {
    content: '';
    position: absolute;
    background: linear-gradient(90deg, transparent, #334155, transparent);
}

.map-sketch-grid::before {
    top: 33%;
    left: 0;
    right: 0;
    height: 1px;
    animation: sketchLineH 1.5s ease-out infinite;
    animation-delay: 0.3s;
}

.map-sketch-grid::after {
    top: 66%;
    left: 0;
    right: 0;
    height: 1px;
    animation: sketchLineH 1.5s ease-out infinite;
    animation-delay: 0.6s;
}

.map-sketch-vlines {
    position: absolute;
    inset: 0;
}

.map-sketch-vlines::before,
.map-sketch-vlines::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, #334155, transparent);
}

.map-sketch-vlines::before {
    left: 33%;
    animation: sketchLineV 1.5s ease-out infinite;
    animation-delay: 0.9s;
}

.map-sketch-vlines::after {
    left: 66%;
    animation: sketchLineV 1.5s ease-out infinite;
    animation-delay: 1.2s;
}

@keyframes sketchLineH {
    0% { transform: scaleX(0); opacity: 0; }
    50% { transform: scaleX(1); opacity: 1; }
    100% { transform: scaleX(1); opacity: 0.3; }
}

@keyframes sketchLineV {
    0% { transform: scaleY(0); opacity: 0; }
    50% { transform: scaleY(1); opacity: 1; }
    100% { transform: scaleY(1); opacity: 0.3; }
}

/* Map pins being placed */
.map-sketch-pins {
    position: absolute;
    inset: 0;
}

.map-sketch-pin {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pinDrop 2s ease-out infinite;
}

.map-sketch-pin:nth-child(1) {
    top: 25%;
    left: 20%;
    background: #22c55e;
    animation-delay: 0s;
}

.map-sketch-pin:nth-child(2) {
    top: 40%;
    left: 55%;
    background: #3b82f6;
    animation-delay: 0.3s;
}

.map-sketch-pin:nth-child(3) {
    top: 60%;
    left: 35%;
    background: #f59e0b;
    animation-delay: 0.6s;
}

.map-sketch-pin:nth-child(4) {
    top: 30%;
    left: 75%;
    background: #8b5cf6;
    animation-delay: 0.9s;
}

.map-sketch-pin:nth-child(5) {
    top: 70%;
    left: 70%;
    background: #ef4444;
    animation-delay: 1.2s;
}

.map-sketch-pin::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid currentColor;
    opacity: 0;
    animation: pinPulse 2s ease-out infinite;
    animation-delay: inherit;
}

@keyframes pinDrop {
    0% { transform: translateY(-20px) scale(0); opacity: 0; }
    20% { transform: translateY(0) scale(1.2); opacity: 1; }
    30% { transform: translateY(0) scale(1); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes pinPulse {
    0%, 20% { transform: scale(1); opacity: 0; }
    40% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Connecting lines being drawn */
.map-sketch-lines {
    position: absolute;
    inset: 0;
}

.map-sketch-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
    transform-origin: left center;
    animation: lineSketch 3s ease-in-out infinite;
}

.map-sketch-line:nth-child(1) {
    top: 30%;
    left: 24%;
    width: 35%;
    transform: rotate(10deg);
    animation-delay: 1.5s;
}

.map-sketch-line:nth-child(2) {
    top: 50%;
    left: 39%;
    width: 20%;
    transform: rotate(-20deg);
    animation-delay: 1.8s;
}

.map-sketch-line:nth-child(3) {
    top: 35%;
    left: 59%;
    width: 20%;
    transform: rotate(45deg);
    animation-delay: 2.1s;
}

@keyframes lineSketch {
    0%, 40% { clip-path: inset(0 100% 0 0); opacity: 0; }
    50% { clip-path: inset(0 0 0 0); opacity: 1; }
    90%, 100% { clip-path: inset(0 0 0 0); opacity: 0.2; }
}

/* Loading text with typewriter effect */
.map-loading-text {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
}

.map-loading-text::after {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 16px;
    background: #3b82f6;
    animation: cursorBlink 0.8s steps(1) infinite;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Progress dots */
.map-loading-dots {
    display: flex;
    gap: 6px;
    margin-top: 16px;
}

.map-loading-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #334155;
    animation: dotPulse 1.5s ease-in-out infinite;
}

.map-loading-dot:nth-child(1) { animation-delay: 0s; }
.map-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.map-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 100% { background: #334155; transform: scale(1); }
    50% { background: #3b82f6; transform: scale(1.3); }
}

/* Fade out animation when loading completes */
.map-loading.fade-out {
    animation: loadingFadeOut 0.5s ease-out forwards;
}

@keyframes loadingFadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Entity Modal Styles */
#map-entity-modal .bg-slate-900 {
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Dark tile filter for OSM - optional, can make map darker */
/*
.leaflet-tile-pane {
    filter: brightness(0.7) saturate(0.8) contrast(1.1);
}
*/

/* Pulse animation for current location marker */
.location-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Geocode Modal Styles */
.geocode-modal-content {
    animation: modalSlideIn 0.2s ease-out;
}

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

#geocode-modal input[type="checkbox"] {
    accent-color: #3b82f6;
}

#geocode-log::-webkit-scrollbar {
    width: 6px;
}

#geocode-log::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 3px;
}

#geocode-log::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

#geocode-log::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Minimized geocode indicator pulse */
#geocode-minimized {
    animation: minimizedPulse 2s infinite;
}

@keyframes minimizedPulse {
    0%, 100% {
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.3);
    }
}

/* ============================================
   ANALYTICS MAP STYLES
   ============================================ */

/* Analytics Map Container */
#analytics-map {
    background-color: #0f172a;
    border-radius: 0.75rem;
}

/* Analytics Marker */
.analytics-marker {
    background: none !important;
    border: none !important;
}

/* Pulsing marker animation */
.analytics-marker .marker-pulse {
    animation: markerPulse 2s ease-out infinite;
}

@keyframes markerPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.4;
    }
    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

/* Analytics Tooltip */
.analytics-tooltip {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 8px !important;
    color: #e2e8f0 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 8px 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

.analytics-tooltip::before {
    border-top-color: #334155 !important;
}

/* Leaflet overrides for analytics map */
#analytics-map .leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

#analytics-map .leaflet-control-zoom a {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border: 1px solid #334155 !important;
    width: 28px !important;
    height: 28px !important;
    line-height: 26px !important;
    font-size: 14px !important;
}

#analytics-map .leaflet-control-zoom a:hover {
    background: #334155 !important;
    color: #e2e8f0 !important;
}

#analytics-map .leaflet-control-zoom-in {
    border-radius: 6px 6px 0 0 !important;
}

#analytics-map .leaflet-control-zoom-out {
    border-radius: 0 0 6px 6px !important;
}

/* Hide attribution in analytics map for cleaner look */
#analytics-map .leaflet-control-attribution {
    display: none;
}

/* Analytics Timeline Styles */
#analytics-timeline {
    gap: 2px;
}

#analytics-timeline > div {
    transition: all 0.2s ease;
}

#analytics-timeline > div:hover > div {
    filter: brightness(1.2);
    transform: scaleY(1.1);
}

/* Tooltip for timeline bars */
#analytics-timeline > div::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 4px;
    font-size: 10px;
    color: #e2e8f0;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 10;
    pointer-events: none;
}

#analytics-timeline > div:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Analytics Row Styling */
.analytics-row {
    padding: 8px 10px;
    margin: 0 -6px;
    border-radius: 8px;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.analytics-row:hover {
    background-color: rgba(255, 255, 255, 0.04);
    transform: translateX(2px);
}

/* Animated progress bars */
.analytics-bar {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animated spike bars (vertical) */
.spike-bar {
    transition: height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Stagger animation for rows */
.analytics-row {
    opacity: 0;
    animation: fadeSlideIn 0.4s ease forwards;
}

#analytics-pages .analytics-row:nth-child(1),
#analytics-sources .analytics-row:nth-child(1),
#analytics-events .analytics-row:nth-child(1),
#analytics-visitors .analytics-row:nth-child(1),
#analytics-countries .analytics-row:nth-child(1) { animation-delay: 0ms; }

#analytics-pages .analytics-row:nth-child(2),
#analytics-sources .analytics-row:nth-child(2),
#analytics-events .analytics-row:nth-child(2),
#analytics-visitors .analytics-row:nth-child(2),
#analytics-countries .analytics-row:nth-child(2) { animation-delay: 50ms; }

#analytics-pages .analytics-row:nth-child(3),
#analytics-sources .analytics-row:nth-child(3),
#analytics-events .analytics-row:nth-child(3),
#analytics-visitors .analytics-row:nth-child(3),
#analytics-countries .analytics-row:nth-child(3) { animation-delay: 100ms; }

#analytics-pages .analytics-row:nth-child(4),
#analytics-sources .analytics-row:nth-child(4),
#analytics-events .analytics-row:nth-child(4),
#analytics-visitors .analytics-row:nth-child(4),
#analytics-countries .analytics-row:nth-child(4) { animation-delay: 150ms; }

#analytics-pages .analytics-row:nth-child(5),
#analytics-sources .analytics-row:nth-child(5),
#analytics-events .analytics-row:nth-child(5),
#analytics-visitors .analytics-row:nth-child(5),
#analytics-countries .analytics-row:nth-child(5) { animation-delay: 200ms; }

#analytics-pages .analytics-row:nth-child(6),
#analytics-sources .analytics-row:nth-child(6),
#analytics-events .analytics-row:nth-child(6),
#analytics-visitors .analytics-row:nth-child(6),
#analytics-countries .analytics-row:nth-child(6) { animation-delay: 250ms; }

#analytics-countries .analytics-row:nth-child(7) { animation-delay: 300ms; }
#analytics-countries .analytics-row:nth-child(8) { animation-delay: 350ms; }

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling for analytics cards */
#analytics-pages::-webkit-scrollbar,
#analytics-sources::-webkit-scrollbar,
#analytics-events::-webkit-scrollbar,
#analytics-visitors::-webkit-scrollbar,
#analytics-countries::-webkit-scrollbar {
    width: 4px;
}

#analytics-pages::-webkit-scrollbar-track,
#analytics-sources::-webkit-scrollbar-track,
#analytics-events::-webkit-scrollbar-track,
#analytics-visitors::-webkit-scrollbar-track,
#analytics-countries::-webkit-scrollbar-track {
    background: transparent;
}

#analytics-pages::-webkit-scrollbar-thumb,
#analytics-sources::-webkit-scrollbar-thumb,
#analytics-events::-webkit-scrollbar-thumb,
#analytics-visitors::-webkit-scrollbar-thumb,
#analytics-countries::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 2px;
}

#analytics-pages::-webkit-scrollbar-thumb:hover,
#analytics-sources::-webkit-scrollbar-thumb:hover,
#analytics-events::-webkit-scrollbar-thumb:hover,
#analytics-visitors::-webkit-scrollbar-thumb:hover,
#analytics-countries::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Light mode analytics map */
body.light #analytics-map {
    background-color: #f8fafc;
}

body.light .analytics-tooltip {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

body.light #analytics-map .leaflet-control-zoom a {
    background: #ffffff !important;
    color: #64748b !important;
    border-color: #e2e8f0 !important;
}

body.light #analytics-map .leaflet-control-zoom a:hover {
    background: #f1f5f9 !important;
    color: #1e293b !important;
}

/* Live indicator pulse */
@keyframes livePulse {
    0%, 100% {
        opacity: 0.75;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(1.5);
    }
}

.analytics-live-pulse {
    animation: livePulse 2s ease-in-out infinite;
}
