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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Views */
.view {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease;
}

.view.hidden {
    display: none;
    opacity: 0;
}

.view.active {
    display: block;
    opacity: 1;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    color: #666;
    cursor: pointer;
    transition: color 0.3s ease;
}

.nav-item.active {
    color: #2481cc;
}

.nav-item svg {
    margin-bottom: 2px;
}

.nav-item span {
    font-size: 12px;
}

/* Map View */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.control-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.control-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.control-button:active {
    transform: scale(0.95);
}

/* Toponim Search */
.toponim-search {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 80px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.toponim-search.hidden {
    display: none;
}

#toponim-input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
}

#toponim-results {
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid #e0e0e0;
}

.toponim-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.toponim-item:hover {
    background: #f5f5f5;
}

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

/* Container */
.container {
    padding: 20px;
    padding-bottom: 80px;
    max-width: 600px;
    margin: 0 auto;
}

.container h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.container h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 30px 0 15px 0;
    color: #666;
}

/* Leaderboard */
.user-item {
    background: white;
    padding: 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-rank {
    font-size: 18px;
    font-weight: 600;
    color: #2481cc;
    min-width: 30px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    flex: 1;
    font-weight: 500;
}

.user-scores {
    text-align: right;
    font-size: 14px;
    color: #666;
}

/* Profile */
.profile-header {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.avatar svg {
    width: 48px;
    height: 48px;
}

.user-info h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-info p {
    color: #666;
    font-size: 14px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-card p {
    font-size: 32px;
    font-weight: 600;
    color: #2481cc;
}

/* Week Filter */
#week-filter {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 16px;
    background: white;
    outline: none;
}

/* Leaflet Custom Markers */
.leaflet-marker-icon {
    border-radius: 50%;
    background: white;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.leaflet-marker-icon.gibdd {
    background: #4CAF50;
}

.leaflet-marker-icon.camera {
    background: #2196F3;
}

.leaflet-marker-icon.accident {
    background: #f44336;
}

/* Event Popup */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 12px;
    min-width: 200px;
}

.event-type {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.event-type.gibdd {
    color: #4CAF50;
}

.event-type.camera {
    color: #2196F3;
}

.event-type.accident {
    color: #f44336;
}

.event-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.event-timer {
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
}

.vote-button {
    width: 100%;
    padding: 10px;
    background: #2481cc;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.vote-button:hover {
    background: #1a6bb5;
}

.vote-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.error {
    text-align: center;
    padding: 40px;
    color: #f44336;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }

    .profile-header {
        padding: 16px;
    }

    .stats {
        grid-template-columns: 1fr;
    }
}
