* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

.app-container {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
}

.filter-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.map-container {
    width: 100%;
    height: 100%;
    flex: 1;
}

.leaflet-container {
    background: #f5f5f5;
    font-family: inherit;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    border-radius: 8px !important;
    overflow: hidden;
    margin-top: 70px !important;
}

.leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    border: none !important;
    color: #666 !important;
}

.leaflet-control-zoom a:hover {
    background: #f0f0f0 !important;
    color: #667eea !important;
}

.legend {
    position: absolute;
    top: 72px;
    right: 12px;
    z-index: 999;
    background: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    min-width: 120px;
}

.legend-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 5px 0;
    font-size: 12px;
    color: #555;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.case-marker {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 32px;
    height: 40px;
    position: relative;
    transform-origin: center bottom;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0) translateY(-20px);
        opacity: 0;
    }
    60% {
        transform: scale(1.1) translateY(0);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.marker-pin svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.marker-pin.selected {
    transform: scale(1.2);
    z-index: 1000 !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    width: 260px !important;
}

.leaflet-popup-tip {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.popup-card {
    cursor: pointer;
}

.popup-card-image {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center;
}

.popup-card-body {
    padding: 12px 14px;
}

.popup-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-card-type {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    color: #fff;
    margin-bottom: 8px;
}

.popup-card-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.filter-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 340px;
    height: 100%;
    background: #fff;
    z-index: 2000;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
}

.filter-panel.open {
    right: 0;
}

.filter-panel::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.filter-panel.open::before {
    opacity: 1;
    pointer-events: auto;
    left: -100%;
    width: 100vw;
}

.filter-header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-shrink: 0;
}

.filter-header h3 {
    color: #fff;
    font-size: 17px;
    font-weight: 600;
}

.close-btn {
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.filter-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
}

.filter-group {
    margin-bottom: 24px;
}

.filter-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 14px;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.checkbox-item:active {
    background: #eef0f3;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    accent-color: #667eea;
    cursor: pointer;
}

.checkbox-item span {
    font-size: 14px;
    color: #444;
}

.apply-btn {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.apply-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.case-popup {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: #fff;
    z-index: 1500;
    border-radius: 20px 20px 0 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
}

.case-popup.show {
    opacity: 1;
    pointer-events: auto;
}

.case-popup.show {
    bottom: 0;
}

.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.popup-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: #222;
    flex: 1;
    padding-right: 12px;
}

.close-popup {
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.popup-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.case-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
}

.case-info {
    padding: 18px 20px;
}

.info-item {
    display: flex;
    padding: 8px 0;
    font-size: 14px;
}

.info-item label {
    color: #888;
    min-width: 50px;
    flex-shrink: 0;
}

.info-item span {
    color: #333;
    flex: 1;
}

.case-desc {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
    font-size: 14px;
    color: #555;
    line-height: 1.7;
}

.stats-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    gap: 12px;
    background: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

.stat-item {
    text-align: center;
    padding: 0 10px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

@media (max-width: 360px) {
    .legend {
        min-width: 100px;
        padding: 10px 12px;
    }
    
    .legend-title {
        font-size: 12px;
    }
    
    .legend-item {
        font-size: 11px;
    }
    
    .stats-bar {
        padding: 8px 16px;
        gap: 8px;
    }
    
    .stat-item {
        padding: 0 6px;
    }
    
    .stat-value {
        font-size: 16px;
    }
}

@media (min-width: 768px) {
    .case-popup {
        left: 50%;
        right: auto;
        transform: translate(-50%, 150%);
        width: 500px;
        border-radius: 20px;
        bottom: auto;
        top: auto;
        max-height: 80vh;
    }
    
    .case-popup.show {
        bottom: auto;
        top: 50%;
        transform: translate(-50%, -50%);
    }
}
