* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-height: 100vh;
    overflow: hidden;
}

.container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    position: relative;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: white;
}

.location-info {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.location-info:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Scrollable content area - wrapper for all content below header */
.container {
    position: relative;
}

@supports (overflow: overlay) {
    .container {
        overflow-y: overlay;
    }
}

/* Ensure body scrolls on mobile */
body {
    overflow: hidden;
}

/* Control Panel */
.control-panel {
    position: absolute;
    top: 80px;
    left: 24px;
    z-index: 90;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 20px;
    width: 260px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    transition: all 0.3s ease;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: white;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.9);
}

.brand-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.filter-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #764ba2;
    border-color: white;
}

.lang-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #764ba2;
}

.reset-btn {
    width: 100%;
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    border: none;
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: transform 0.2s;
}

.reset-btn:hover {
    transform: translateY(-2px);
}

/* Radar Wrapper - Positions radar and range buttons */
.radar-wrapper {
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Range Selector - Below radar */
.range-selector {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.range-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    font-weight: 600;
    color: white;
    min-width: 60px;
}

.range-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.range-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #764ba2;
    border-color: white;
}

/* Radar Container */
.radar-container {
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

/* Radar Rings */
.radar-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ring-1 { width: 200px; height: 200px; }
.ring-2 { width: 400px; height: 400px; }
.ring-3 { width: 600px; height: 600px; }

.ring-label {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(102, 126, 234, 0.8);
    padding: 2px 6px;
    border-radius: 10px;
}

/* Center Point (User) */
.user-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.6);
    z-index: 50;
    animation: center-pulse 2s infinite;
}

@keyframes center-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 30px rgba(255, 107, 107, 0.6); }
    50% { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 0 40px rgba(255, 107, 107, 0.8); }
}

/* Salesman Dots */
.salesman-dot {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.salesman-dot:hover {
    transform: scale(1.3);
    z-index: 60;
    box-shadow: 0 6px 25px rgba(78, 205, 196, 0.5);
}

.salesman-dot .initials {
    color: white;
    font-weight: 700;
    font-size: 11px;
}

/* Size classes based on distance */
.size-large { width: 55px; height: 55px; }
.size-large .initials { font-size: 14px; }

.size-medium { width: 45px; height: 45px; }
.size-medium .initials { font-size: 11px; }

.size-small { width: 38px; height: 38px; }
.size-small .initials { font-size: 10px; }

/* Pulse animations based on distance */
.pulse-fast { animation: dot-pulse 0.8s infinite; }
.pulse-medium { animation: dot-pulse 1.5s infinite; }
.pulse-slow { animation: dot-pulse 2.5s infinite; }

@keyframes dot-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(78, 205, 196, 0.4); }
    50% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 8px rgba(78, 205, 196, 0); }
}

/* Premium marker pulse animation */
@keyframes marker-pulse {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(78, 205, 196, 0.5);
    }
    50% { 
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 12px rgba(78, 205, 196, 0);
    }
}

.marker-premium {
    animation: marker-pulse 2s ease-in-out infinite !important;
}

/* Cluster badge */
.cluster-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff6b6b;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    padding: 0 4px;
}

/* Info Popup */
.info-popup {
    position: fixed;
    background: white;
    color: #333;
    padding: 16px;
    border-radius: 12px;
    font-size: 13px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
    min-width: 200px;
}

.info-popup.show {
    opacity: 1;
    transform: translateY(0);
}

.popup-name {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.popup-dealer {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.popup-info {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #555;
}

.popup-info span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Salesman List Popup */
.list-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    color: #333;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    z-index: 300;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: none;
}

.list-popup.show {
    display: block;
    animation: popup-in 0.3s ease;
}

@keyframes popup-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.list-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-title {
    font-size: 18px;
    font-weight: 700;
}

.list-subtitle {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
}

.close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #e0e0e0;
}

.list-content {
    max-height: 400px;
    overflow-y: auto;
}

.salesman-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.salesman-item:hover {
    background: #f8f8f8;
}

.salesman-info {
    flex: 1;
}

.salesman-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.salesman-lang {
    font-size: 12px;
    color: #888;
    margin-top: 3px;
}

.call-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.call-btn:hover {
    transform: scale(1.05);
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 250;
    display: none;
}

.overlay.show {
    display: block;
}

/* Stats Panel */
.stats-panel {
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border-radius: 0;
    padding: 16px 24px;
    z-index: 80;
    text-align: right;
}

.stats-row {
    display: flex;
    gap: 24px;
    font-size: 13px;
    justify-content: flex-end;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2px;
}

.no-results {
    padding: 40px;
    text-align: center;
    color: #888;
}

/* ZIP Code Modal */
.zip-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 32px;
    z-index: 400;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: none;
    text-align: center;
    min-width: 300px;
}

.zip-modal.show {
    display: block;
    animation: popup-in 0.3s ease;
}

.zip-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.zip-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.zip-gps-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.zip-gps-btn:hover {
    transform: translateY(-2px);
}

.zip-gps-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.zip-divider {
    font-size: 13px;
    color: #999;
    font-weight: 500;
    margin: 4px 0;
}

.zip-label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: left;
}

.zip-input {
    padding: 14px 20px;
    font-size: 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    font-weight: 600;
    letter-spacing: 2px;
}

.zip-input:focus {
    border-color: #667eea;
}

.zip-input.error {
    border-color: #ff6b6b;
}

.zip-error {
    color: #ff6b6b;
    font-size: 13px;
    font-weight: 500;
    min-height: 18px;
}

.zip-submit-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.zip-submit-btn:hover {
    transform: translateY(-2px);
}

.zip-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#locationOverlay.show {
    display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    .header {
        padding: 12px 16px;
        flex-shrink: 0;
    }

    .logo {
        font-size: 18px;
    }

    .location-info {
        font-size: 12px;
        padding: 6px 12px;
    }

    .stats-panel {
        position: relative !important;
        bottom: auto !important;
        right: auto !important;
        padding: 10px 16px;
        text-align: right;
        margin: 0;
        background: rgba(255, 255, 255, 0.12);
        border-radius: 0;
        order: 1;
        flex-shrink: 0;
    }

    .stat-value {
        font-size: 14px;
    }

    .stat-label {
        font-size: 9px;
    }

    .radar-wrapper {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100%;
        padding: 8px 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        order: 2;
        flex: 1;
        min-height: 0;
    }

    .radar-container {
        width: 260px;
        height: 260px;
        flex-shrink: 0;
    }

    .ring-1 { width: 93px; height: 93px; }
    .ring-2 { width: 187px; height: 187px; }
    .ring-3 { width: 280px; height: 280px; }

    .user-center {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .size-large { width: 40px; height: 40px; }
    .size-large .initials { font-size: 11px; }

    .size-medium { width: 32px; height: 32px; }
    .size-medium .initials { font-size: 9px; }

    .size-small { width: 26px; height: 26px; }
    .size-small .initials { font-size: 8px; }

    .range-selector {
        gap: 6px;
        order: 3;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .range-btn {
        padding: 5px 10px;
        font-size: 9px;
        min-width: 45px;
    }

    .control-panel {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        z-index: 10;
        width: 100%;
        border-radius: 0;
        max-height: none;
        overflow-y: visible;
        margin: 0;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.12);
        backdrop-filter: blur(15px);
        order: 4;
        flex-shrink: 0;
    }

    .panel-title {
        display: none;
    }

    .filter-section {
        margin-bottom: 12px;
    }

    .filter-label {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .brand-filters {
        gap: 6px;
        margin-bottom: 8px;
    }

    .filter-btn {
        padding: 8px 6px;
        font-size: 10px;
    }

    .lang-filters {
        gap: 5px;
        margin-bottom: 8px;
    }

    .lang-btn {
        padding: 5px 10px;
        font-size: 10px;
    }

    .reset-btn {
        padding: 10px;
        font-size: 12px;
        margin-top: 0;
    }

    .stat-label {
        font-size: 10px;
    }

    .list-popup {
        width: 95%;
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    .brand-filters {
        grid-template-columns: repeat(2, 1fr);
    }

    .radar-container {
        width: 280px;
        height: 280px;
    }

    .ring-1 { width: 93px; height: 93px; }
    .ring-2 { width: 186px; height: 186px; }
    .ring-3 { width: 280px; height: 280px; }
}
