.sidebar {
    width: 360px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-top: 10px;
}

.logo-icon {
    font-size: 32px;
    color: var(--accent-primary);
}

.tagline {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
    margin-top: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    width: 100%;
    padding: 16px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-light);
    color: var(--accent-secondary);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.credit-link {
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 0;
    transition: var(--transition);
    order: 1;
}

.credit-link:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

.theme-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.theme-btn:hover {
    background: var(--bg-primary);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
}

.main-content {
    flex: 1;
    height: 100vh;
    height: 100dvh;
    position: relative;
    min-width: 0;
}

.map-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.tab-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 2;
    overflow-y: auto;
    padding: 32px;
}

.tab-header {
    margin-bottom: 24px;
}

.tab-header h2 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
}

.floating-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 64px;
    height: 64px;
    border: none;
    background: var(--accent-primary);
    color: white;
    font-size: 24px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-btn:hover {
    background: var(--accent-secondary);
    transform: scale(1.1);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 480px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 18px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-content {
    padding: 24px;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    border: none;
    background: var(--accent-primary);
    color: white;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    background: var(--accent-secondary);
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-switch a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.history-container {
    max-width: 800px;
    margin: 0 auto;
}

.history-container h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}

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

.history-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.history-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.history-item-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-item-status {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.status-resolved {
    background: var(--accent-light);
    color: var(--accent-secondary);
}

.history-item-meta {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.stats-container {
    max-width: 1000px;
    margin: 0 auto;
}

.stats-container h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.stats-grid,
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.stat-card,
.chart-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-color);
    min-width: 0;
}

.stat-card h3,
.chart-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.stat-card canvas,
.chart-card canvas {
    max-height: 320px;
}

.profile-content,
.profile-container {
    max-width: 600px;
    margin: 0 auto;
}

.profile-info,
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    background: var(--accent-light);
    color: var(--accent-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.profile-info h2,
.profile-info h3 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-points,
.points {
    font-size: 18px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-points i,
.points i {
    color: var(--severity-medium);
}

.achievements-section h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.achievements-grid,
.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.achievement-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.achievement-item i {
    font-size: 36px;
    color: var(--severity-medium);
    margin-bottom: 10px;
}

.achievement-item p {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.empty-state {
    color: var(--text-secondary);
    font-size: 14px;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.leaflet-popup-tip {
    background: var(--bg-secondary);
}

.popup-content h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 16px;
}

.popup-content p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.popup-severity {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.popup-btn {
    width: 100%;
    padding: 10px;
    border: none;
    background: var(--accent-primary);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.popup-btn:hover {
    background: var(--accent-secondary);
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        bottom: 0;
        z-index: 100;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.12);
    }

    .sidebar-header {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

    .theme-btn {
        width: 42px;
        height: 42px;
        border-radius: var(--radius-full);
        background: var(--bg-secondary);
        box-shadow: var(--shadow-md);
    }

    .sidebar-nav {
        flex-direction: row;
        padding: 0;
        gap: 4px;
        width: 100%;
        justify-content: space-around;
    }

    .nav-item {
        flex-direction: column;
        flex: 1 1 0;
        min-width: 0;
        padding: 8px 4px;
        font-size: 11px;
        gap: 4px;
        border-radius: var(--radius-sm);
    }

    .nav-item i {
        font-size: 18px;
    }

    .nav-item span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .main-content {
        width: 100%;
        height: 100vh;
        height: 100dvh;
    }

    .floating-btn {
        bottom: calc(78px + env(safe-area-inset-bottom));
        right: max(16px, env(safe-area-inset-right));
        width: 54px;
        height: 54px;
        font-size: 20px;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 12px;
    }

    .modal {
        max-width: none;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .modal-content {
        padding: 16px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px;
        font-size: 14px;
    }

    .btn-primary {
        padding: 14px;
        font-size: 15px;
    }

    .tab-content {
        padding: 72px 16px calc(96px + env(safe-area-inset-bottom));
    }

    .tab-header {
        min-height: auto;
        padding-right: 0;
    }

    .tab-header h2 {
        font-size: 24px;
        line-height: 1.2;
    }

    .history-item {
        padding: 16px;
    }

    .history-item-title {
        font-size: 16px;
    }

    .stats-grid,
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-card,
    .chart-card {
        padding: 16px;
    }

    .stat-card h3,
    .chart-card h3 {
        font-size: 16px;
        margin-bottom: 16px;
    }

    .profile-info,
    .profile-header {
        padding: 20px;
        flex-direction: column;
        text-align: center;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
        font-size: 40px;
        margin-bottom: 12px;
    }

    .profile-info h2,
    .profile-info h3 {
        font-size: 20px;
    }

    .profile-points,
    .points {
        font-size: 16px;
        justify-content: center;
    }

    .achievements-grid,
    .achievements-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }

    .achievement-item {
        padding: 16px;
    }

    .achievement-item i {
        font-size: 28px;
    }

    .achievement-item p {
        font-size: 12px;
    }
}
