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

html, body {
    width: 100%;
    height: 100%;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.map-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    padding: 10px;
    width: 44px;
    height: 44px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.map-btn:hover {
    background-color: #1d4ed8;
}

.lang-toggle-btn {
    top: 10px;
    background-color: #475569;
    font-weight: bold;
}

.lang-toggle-btn:hover {
    background-color: #334155;
}

.lang-text {
    font-size: 14px;
    font-weight: bold;
}

/* Language modal */
.lang-modal-content {
    background: linear-gradient(135deg, rgba(15, 25, 45, 0.9), rgba(10, 15, 30, 0.95));
    border-radius: 16px;
    padding: 25px;
    min-width: 280px;
    text-align: center;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
}

.lang-modal-content h3 {
    color: #fff;
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
}

.lang-modal-content .modal-select {
    margin-bottom: 20px;
}

.lang-modal-content .modal-buttons {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.layer-toggle-btn {
    top: 60px;
    background-color: #0891b2;
}

.layer-toggle-btn:hover {
    background-color: #0e7490;
}

.upload-btn {
    top: 110px;
}

.download-btn {
    top: 160px;
    background-color: #059669;
}

.download-btn:hover {
    background-color: #047857;
}

.toggle-btn {
    top: 210px;
    background-color: #7c3aed;
}

.toggle-btn:hover {
    background-color: #6d28d9;
}

.clear-btn {
    top: 260px;
    background-color: #dc2626;
}

.clear-btn:hover {
    background-color: #b91c1c;
}

.legend-toggle-btn {
    top: 310px;
    background-color: #6366f1;
}

.legend-toggle-btn:hover {
    background-color: #4f46e5;
}

.btn-icon {
    width: 24px;
    height: 24px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.4);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, rgba(15, 25, 45, 0.75), rgba(10, 15, 30, 0.8));
    border-radius: 16px;
    padding: 30px;
    min-width: 420px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(37, 99, 235, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
}

.modal-content h2 {
    color: #fff;
    margin: 0 0 25px 0;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(37, 99, 235, 0.4);
    padding-bottom: 15px;
    text-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.column-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.column-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.column-name {
    color: #fff;
    font-weight: bold;
}

.column-row select {
    padding: 8px 12px;
    border-radius: 5px;
    border: none;
    background-color: #333;
    color: #fff;
    cursor: pointer;
    min-width: 150px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(37, 99, 235, 0.3);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-confirm {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-confirm:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);
    transform: translateY(-1px);
}

/* Confirm modal */
.confirm-modal-content {
    background: linear-gradient(135deg, rgba(15, 25, 45, 0.9), rgba(10, 15, 30, 0.95));
    border-radius: 16px;
    padding: 30px;
    min-width: 300px;
    text-align: center;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
}

.confirm-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: rgba(220, 38, 38, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-icon svg {
    width: 32px;
    height: 32px;
    color: #ef4444;
}

.confirm-text {
    color: #fff;
    font-size: 16px;
    margin-bottom: 25px;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Error modal */
.error-modal-content {
    background: linear-gradient(135deg, rgba(15, 25, 45, 0.9), rgba(10, 15, 30, 0.95));
    border-radius: 16px;
    padding: 30px;
    min-width: 300px;
    max-width: 400px;
    text-align: center;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
}

.error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: rgba(234, 179, 8, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-icon svg {
    width: 32px;
    height: 32px;
    color: #eab308;
}

.error-text {
    color: #fff;
    font-size: 16px;
    margin-bottom: 25px;
    line-height: 1.5;
}

.error-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Modal sections */
.modal-section {
    margin-bottom: 20px;
}

.section-label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-bottom: 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-select {
    width: 100%;
    padding: 12px 15px;
    padding-right: 35px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23ffffff' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
}

.modal-select:hover {
    border-color: rgba(37, 99, 235, 0.5);
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.3);
    background-color: rgba(0, 0, 0, 0.5);
}

/* Dropdown styles */
.dropdown-container {
    position: relative;
}

.dropdown-btn {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    transition: all 0.3s ease;
}

.dropdown-btn:hover {
    border-color: rgba(37, 99, 235, 0.5);
    background: rgba(0, 0, 0, 0.5);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.dropdown-container.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: rgba(15, 20, 35, 0.95);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.dropdown-container.open .dropdown-menu {
    display: block;
}

/* Checkbox rows */
.column-row {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    cursor: pointer;
}

.column-row:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.column-row input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.column-name {
    color: #fff;
    font-size: 14px;
}

/* Loading indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(37, 99, 235, 0.1);
    border-radius: 8px;
    margin-top: 10px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* File loading overlay */
.file-loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 30, 0.5);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.file-loading-overlay.active {
    display: flex;
}

.file-loading-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: #3b82f6;
}

/* Legend styles */
.legend {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(40, 40, 40, 0.95);
    padding: 10px 20px 15px 20px;
    border-radius: 10px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    width: 50%;
    min-width: 200px;
    max-width: 90%;
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
}

.legend.dragging {
    opacity: 0.9;
    cursor: grabbing;
}

.legend-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    cursor: grab;
    padding: 5px 0 10px 0;
    margin: 0 -5px 10px -5px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    user-select: none;
}

.legend-header:active {
    cursor: grabbing;
}

.legend-close-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255,255,255,0.6);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.legend-close-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.legend-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.3) 50%);
    border-radius: 0 0 10px 0;
}

.legend-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.5) 50%);
}

.legend-title {
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: center;
}

/* Heatmap legend */
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 10px;
}

.heatmap-gradient {
    flex: 1;
    min-width: 300px;
    height: 20px;
    background: linear-gradient(to right, #00ff00, #ffff00, #ff0000);
    border-radius: 4px;
}

.heatmap-labels {
    display: flex;
    justify-content: space-between;
    color: #fff;
    font-size: 11px;
    margin-top: 4px;
}

.heatmap-label {
    color: #ccc;
    font-size: 11px;
}

/* Category legend */
.category-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 30px;
    justify-content: flex-start;
    align-items: flex-start;
    max-height: 200px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.category-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

.category-label {
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
}

.category-item {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.category-item:hover {
    opacity: 0.8;
}

.category-item.hidden-category {
    opacity: 0.4;
}

.category-item.hidden-category .category-label {
    text-decoration: line-through;
}

.category-item.hidden-category .category-color {
    opacity: 0.5;
}

/* Tooltip styles */
.tooltip {
    position: absolute;
    background: linear-gradient(135deg, rgba(15, 25, 45, 0.7), rgba(10, 15, 30, 0.75));
    color: #fff;
    padding: 15px 18px;
    border-radius: 10px;
    font-size: 13px;
    pointer-events: auto;
    z-index: 2000;
    display: none;
    max-width: 400px;
    box-shadow:
        0 8px 25px rgba(0,0,0,0.3),
        0 0 30px rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(12px);
}

.tooltip-address {
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
}

.tooltip-count {
    color: #aaa;
    font-size: 12px;
}

.tooltip-data {
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.tooltip-row {
    padding: 3px 0;
    font-size: 12px;
}

.tooltip-label {
    color: #aaa;
}

.tooltip-value {
    color: #fff;
    margin-left: 5px;
}

.tooltip-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin: 8px 0;
}

.tooltip-group {
    padding: 5px 0;
}

.tooltip-group-title {
    font-weight: bold;
    color: #3b82f6;
    font-size: 13px;
    margin-bottom: 4px;
}

/* Logo styles */
.logo {
    position: fixed;
    bottom: 45px;
    z-index: 1000;
}

.logo img {
    display: block;
    height: 40px;
    width: auto;
}

.logo-left {
    left: 15px;
}

.logo-right {
    right: 15px;
    cursor: pointer;
}

.version-tooltip {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(15, 25, 45, 0.95);
    color: #fff;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.version-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 15px;
    border: 6px solid transparent;
    border-top-color: rgba(15, 25, 45, 0.95);
}

.logo-right:hover .version-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Footer styles */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(15, 25, 45, 0.9);
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 20px;
    font-size: 12px;
    text-align: center;
    backdrop-filter: blur(8px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}
