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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

header.minimized {
    padding: 10px 20px;
}

header.minimized .header-content {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
}

.header-content {
    transition: all 0.3s ease;
    opacity: 1;
    max-height: 500px;
}

header h1 {
    font-size: 24px;
    margin-bottom: 15px;
    font-weight: 600;
}

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

.controls-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.upload-section {
    display: flex;
    align-items: center;
}

.upload-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

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

.display-toggle-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.display-toggle-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.toggle-buttons {
    display: flex;
    gap: 10px;
}

.toggle-option {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.toggle-option:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.toggle-option.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 140px);
    background: #f5f5f5;
}

.empty-state-content {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 500px;
}

.empty-state-content h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 15px;
}

.empty-state-content p {
    font-size: 16px;
    color: #666;
    margin: 10px 0;
}

.empty-state-hint {
    font-size: 14px;
    color: #999;
    font-style: italic;
}

.stats-bar {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1000;
    gap: 15px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    font-size: 16px;
    color: #666;
}

#loading-progress {
    font-weight: 600;
    color: #667eea;
}

.map-container {
    flex: 1;
    position: relative;
    z-index: 1;
}

.sidebar {
    position: absolute;
    top: 140px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 180px);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sidebar.minimized {
    width: 50px;
    height: 50px;
}

.sidebar.minimized .sidebar-content {
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 1;
}

.sidebar h2 {
    padding: 20px;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.search-box {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

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

.sort-controls {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sort-controls label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sort-controls select {
    width: 100%;
    padding: 10px 35px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.sort-controls select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.sort-controls select:hover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

.sort-controls select option {
    padding: 10px;
    font-size: 14px;
}

.city-list {
    overflow-y: auto;
    flex: 1;
}

.city-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.city-item:hover {
    background-color: #f8f9fa;
}

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

.city-name {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 8px;
}

.city-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.city-clients {
    color: #666;
}

.city-amount {
    color: #667eea;
    font-weight: 600;
}

/* Popup styling */
.popup-content {
    min-width: 200px;
}

.popup-content h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
}

.popup-content p {
    margin: 5px 0;
    font-size: 14px;
    color: #666;
}

.popup-content strong {
    color: #333;
}

/* Print button */
.print-btn {
    position: absolute;
    top: 30px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
}

.print-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.print-btn svg {
    stroke: currentColor;
}

/* Print header (hidden by default, shown only when printing) */
.print-header {
    display: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

.print-header h2 {
    font-size: 18px;
    margin-bottom: 10px;
    font-weight: 600;
}

.print-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 14px;
}

.print-stats strong {
    font-weight: 700;
    margin-left: 5px;
}

/* Toggle buttons */
.toggle-btn {
    position: absolute;
    z-index: 10;
    background: transparent;
    border: none;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    transform: scale(1.2);
}

.toggle-btn svg {
    transition: transform 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.toggle-header-btn {
    top: -8px;
    right: 15px;
}

.toggle-header-btn svg {
    color: white;
}

.toggle-header-btn:hover svg {
    filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.5));
}

.toggle-sidebar-btn {
    top: 8px;
    right: 8px;
}

.toggle-sidebar-btn svg {
    color: #667eea;
    transform: rotate(180deg);
}

.toggle-sidebar-btn:hover svg {
    color: #764ba2;
}

header.minimized .toggle-header-btn svg {
    transform: rotate(180deg);
}

.sidebar.minimized .toggle-sidebar-btn svg {
    transform: rotate(0deg);
}

/* Responsive design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 100%;
        right: 0;
        top: auto;
        bottom: 0;
        max-height: 40vh;
        border-radius: 8px 8px 0 0;
    }
    
    .sidebar.minimized {
        width: 100%;
        max-height: 50px;
    }
    
    .toggle-sidebar-btn {
        top: 10px;
        right: 10px;
        left: auto;
    }
    
    .stats-bar {
        gap: 15px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    header h1 {
        font-size: 20px;
    }
}

/* Scrollbar styling */
.city-list::-webkit-scrollbar {
    width: 8px;
}

.city-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.city-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.city-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Marker cluster styling */
.custom-cluster-icon {
    background: transparent !important;
    border: none !important;
}

/* Cluster popup styling */
.popup-content details ul {
    list-style: none;
    padding-left: 0;
}

.popup-content details li {
    padding: 3px 0;
    border-bottom: 1px solid #eee;
}

.popup-content details li:last-child {
    border-bottom: none;
}

/* Notification animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Print styles */
@media print {
    /* Ensure all colors are preserved during print */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Hide regular header and show print header */
    header {
        display: none !important;
    }
    
    .print-header {
        display: block !important;
        page-break-after: avoid;
    }
    
    /* Hide sidebar, loading, empty state, and buttons */
    .sidebar,
    .loading,
    .empty-state,
    .toggle-btn,
    .print-btn {
        display: none !important;
    }
    
    /* Make container and map fill the page */
    .container {
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .map-container {
        flex: 1;
        height: auto !important;
        width: 100% !important;
        page-break-inside: avoid;
    }
    
    #map {
        height: calc(100vh - 80px) !important;
        width: 100% !important;
    }
    
    /* Ensure map markers and circles keep their colors */
    .leaflet-marker-icon,
    .leaflet-popup,
    .leaflet-div-icon,
    .custom-city-marker,
    .custom-cluster-icon {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Keep all background colors and images */
    .leaflet-tile,
    .leaflet-layer,
    .leaflet-control,
    .leaflet-container {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Remove box shadows for cleaner print */
    * {
        box-shadow: none !important;
    }
    
    /* Ensure print header gradient is visible */
    .print-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Hide all popups during print */
    .leaflet-popup {
        display: none !important;
    }
}

