* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: 'Urbanist', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}
#app {
    display: flex;
    height: 100vh;
    position: relative;
}
#sidebar {
    width: 400px;
    background: #151515;
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    transition: transform 0.3s ease;
}
.sidebar-hidden {
    transform: translateX(-100%);
}
#map {
    flex: 1;
    background: #111;
}
.header {
    padding: 20px 24px;
    border-bottom: 1px solid #2a2a2a;
    background: linear-gradient(135deg, #1a1a1a 0%, #151515 100%);
    position: relative;
}
.header h1 {
    font-size: 1.6rem;
    margin-bottom: 4px;
    color: #fff;
    font-weight: 700;
}
.header p {
    color: #888;
    font-size: 0.85rem;
}
.nav-tabs {
    display: flex;
    border-bottom: 1px solid #2a2a2a;
    background: #1a1a1a;
}
.nav-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border: none;
    background: none;
    color: #888;
    font-size: 0.85rem;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}
.nav-tab:hover {
    background: #222;
    color: #fff;
}
.nav-tab.active {
    color: #4a9eff;
    border-bottom-color: #4a9eff;
    background: #1e1e1e;
}
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}
.tab-content.active {
    display: flex;
    flex-direction: column;
}
.search-box {
    padding: 16px 20px;
    border-bottom: 1px solid #2a2a2a;
}
#citySearch {
    width: 100%;
    padding: 10px 14px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
}
#citySearch:focus {
    outline: none;
    border-color: #4a9eff;
}
.city-details {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.city-card {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    border-left: 4px solid #4a9eff;
}
.city-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}
.city-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
}
.city-country {
    font-size: 0.95rem;
    color: #888;
    margin-top: 4px;
}
.systems-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.system-box {
    background: #222;
    border-radius: 8px;
    padding: 14px;
    border-left: 3px solid;
}
.system-title {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.system-stats {
    font-size: 0.9rem;
    color: #fff;
    line-height: 1.5;
}
.total-box {
    background: #252525;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    border: 1px solid #333;
}
.total-title {
    font-size: 0.95rem;
    color: #4a9eff;
    margin-bottom: 12px;
    font-weight: 600;
}
.total-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.stat-item {
    background: #1a1a1a;
    padding: 10px;
    border-radius: 6px;
}
.stat-label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 1rem;
    color: #fff;
    font-weight: 600;
}
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 0.95rem;
}

.preset-filters {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #2a2a2a;
}

.preset-group {
    margin-bottom: 12px;
}

.preset-group label {
    display: block;
    margin-bottom: 6px;
    color: #ccc;
    font-size: 0.85rem;
    font-weight: 500;
}

.preset-select {
    width: 100%;
    padding: 8px 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
}

.preset-select:focus {
    outline: none;
    border-color: #4a9eff;
}

.checkbox-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    cursor: pointer;
}

.checkbox-filter input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4a9eff;
}

.checkbox-filter label {
    margin: 0;
    color: #ccc;
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-group select.preset-select option {
    background: #1a1a1a;
    color: #fff;
    padding: 8px;
}

.filter-group select.preset-select option:checked {
    background: #4a9eff;
    color: #fff;
}

.system-box[data-system="Metro"] { border-left-color: #ff4757; }
.system-box[data-system="Tram"] { border-left-color: #2ed573; }
.system-box[data-system="Light Rail"] { border-left-color: #1e90ff; }
.system-box[data-system="Monorail"] { border-left-color: #ffa502; }
.system-box[data-system="Maglev"] { border-left-color: #9c88ff; }
/* .system-box[data-system="Train"] { border-left-color: #ff6b81; } */
.system-box[data-system="People Mover"] { border-left-color: #00d2d3; }
.system-box[data-system="Airport Shuttle"] { border-left-color: #54a0ff; }
.system-box[data-system="Amusement Park"] { border-left-color: #f368e0; }
.system-box[data-system="Heritage Tram"] { border-left-color: #8395a7; }
.system-box[data-system="Tram Train"] { border-left-color: #00cec9; }
.system-box[data-system="Interurban"] { border-left-color: #a29bfe; }
.system-box[data-system="Special"] { border-left-color: #fd79a8; }
.system-box[data-system="Streetcar"] { border-left-color: #74b9ff; }
.leaflet-control-zoom {
    border: none !important;
    background: #1a1a1a !important;
}
.leaflet-control-zoom a {
    background: #2a2a2a !important;
    color: #fff !important;
    border: none !important;
}
.leaflet-control-zoom a:hover {
    background: #333 !important;
}
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #1a1a1a;
}
::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #444;
}
.filters {
    padding: 16px 20px;
    border-bottom: 1px solid #2a2a2a;
    background: #1a1a1a;
}
.filter-group {
    margin-bottom: 14px;
}
.filter-group label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 0.85rem;
    font-weight: 500;
}
.filter-checks {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
}
.filter-checks label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #aaa;
    margin: 0;
    cursor: pointer;
}
.filter-checks input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #4a9eff;
}
.range-input {
    width: 100%;
    margin-top: 8px;
}
.range-value {
    display: inline-block;
    margin-left: 10px;
    color: #4a9eff;
    font-weight: 600;
    font-size: 0.85rem;
}
.stats-bar {
    display: flex;
    padding: 12px 20px;
    border-bottom: 1px solid #2a2a2a;
    background: #1a1a1a;
    gap: 16px;
}
.stat {
    flex: 1;
    text-align: center;
}
.stat-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: #4a9eff;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ranking-list {
    padding: 20px;
}
.ranking-item {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-left: 3px solid #4a9eff;
    cursor: pointer;
}
.ranking-item:hover {
    background: #222;
}
.ranking-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: #4a9eff;
    min-width: 40px;
}
.ranking-info {
    flex: 1;
}
.ranking-city {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}
.ranking-country {
    font-size: 0.8rem;
    color: #888;
}
.ranking-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a9eff;
}
.dashboard {
    padding: 20px;
}
.chart-container {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 16px;
}
.compare-container {
    padding: 20px;
}
.compare-selector {
    margin-bottom: 20px;
}
.compare-selector select {
    width: 100%;
    padding: 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.compare-table {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
}
.compare-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-bottom: 1px solid #2a2a2a;
}
.compare-cell {
    padding: 14px;
    font-size: 0.9rem;
}
.compare-cell:first-child {
    background: #222;
    font-weight: 600;
    color: #4a9eff;
}
.compare-cell:not(:first-child) {
    text-align: center;
    color: #fff;
}
.export-btn {
    background: #4a9eff;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    width: 100%;
    margin-top: 10px;
}
.export-btn:hover {
    background: #3a8eef;
}
.marker-cluster-small {
    background-color: rgba(74, 158, 255, 0.6);
}
.marker-cluster-small div {
    background-color: rgba(74, 158, 255, 0.8);
}
.marker-cluster-medium {
    background-color: rgba(255, 107, 129, 0.6);
}
.marker-cluster-medium div {
    background-color: rgba(255, 107, 129, 0.8);
}
.marker-cluster-large {
    background-color: rgba(255, 71, 87, 0.6);
}
.marker-cluster-large div {
    background-color: rgba(255, 71, 87, 0.8);
}
.leaflet-popup-content-wrapper {
    background: #1a1a1a;
    color: #fff;
}
.leaflet-popup-content {
    margin: 14px;
}
.leaflet-popup-tip {
    background: #1a1a1a;
}
.popup-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.popup-stats {
    font-size: 0.85rem;
    color: #ccc;
    line-height: 1.6;
}
.popup-btn {
    background: #4a9eff;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 10px;
    width: 100%;
}
.toggle-sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid #2a2a2a;
    color: #fff;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    z-index: 1002;
    display: none;
}
.toggle-sidebar:hover {
    background: #2a2a2a;
}
.city-card-popup {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 380px;
    max-height: 85vh;
    background: #151515;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
    overflow: hidden;
    border: 1px solid #2a2a2a;
    animation: slideIn 0.3s ease;
}
.city-card-popup.active {
    display: block;
}
.city-card-header {
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
    background: linear-gradient(135deg, #1a1a1a 0%, #151515 100%);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    cursor: move;
}
.city-card-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}
.city-card-country {
    font-size: 0.95rem;
    color: #888;
}
.close-popup {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
.close-popup:hover {
    background: #2a2a2a;
    color: #fff;
}
.city-card-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}
.compare-btn {
    background: #2ed573;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 10px;
    width: 100%;
}
.compare-btn:hover {
    background: #25c063;
}
.compare-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.compare-modal.active {
    display: flex;
}
.compare-modal-content {
    background: #151515;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    border: 1px solid #2a2a2a;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
}
.compare-modal h3 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.2rem;
}
.compare-modal select {
    width: 100%;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 15px;
}
.modal-actions {
    display: flex;
    gap: 10px;
}
.modal-btn {
    flex: 1;
    padding: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}
.modal-btn.primary {
    background: #4a9eff;
    color: #fff;
}
.modal-btn.secondary {
    background: #2a2a2a;
    color: #ccc;
}
.map-overlay-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid #2a2a2a;
    color: #fff;
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    backdrop-filter: blur(4px);
}
.map-overlay-btn:hover {
    background: #2a2a2a;
}
#viewStatsBtn {
    top: 70px;
}
#viewRankingBtn {
    top: 120px;
}
.overlay-chart {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(21, 21, 21, 0.95);
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    z-index: 2000;
    border: 1px solid #2a2a2a;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    cursor: move;
}
.overlay-chart.active {
    display: block;
}
.close-chart {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2001;
}
.close-chart:hover {
    color: #fff;
}
.chart-header {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-weight: 600;
    padding-right: 30px;
}
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f0f0f;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #2a2a2a;
    border-top: 3px solid #4a9eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 400px;
    padding: 10px 20px;
    background: #151515;
    border-top: 1px solid #2a2a2a;
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    z-index: 1000;
}
.footer a {
    color: #4a9eff;
    text-decoration: none;
}
.footer a:hover {
    text-decoration: underline;
}
.creator {
    padding: 8px 24px;
    color: #666;
    font-size: 0.8rem;
    text-align: center;
}
.creator a {
    color: #4a9eff;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        position: absolute;
        height: 100%;
    }
    .filter-checks {
        grid-template-columns: repeat(2, 1fr);
    }
    .city-card-popup {
        width: 90%;
        right: 5%;
    }
    .map-overlay-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    #viewStatsBtn {
        top: 60px;
    }
    #viewRankingBtn {
        top: 110px;
    }
    .toggle-sidebar {
        display: block;
    }
    .footer {
        width: 100%;
        left: 0;
    }
}