/* 上海公园地图 - 样式文件 */

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

:root {
    --primary-color: #2e7d32;
    --primary-light: #4caf50;
    --primary-dark: #1b5e20;
    --secondary-color: #81c784;
    --accent-color: #ff9800;
    --bg-color: #f5f5f5;
    --text-color: #333;
    --text-light: #666;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

/* 主布局 */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* 侧边栏 */
.sidebar {
    width: 380px;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

/* 侧边栏头部 */
.sidebar-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 20px;
    position: relative;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h1::before {
    content: "🌳";
    font-size: 1.8rem;
}

.sidebar-header .park-count {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 5px;
}

/* 搜索框 */
.search-container {
    padding: 15px 20px;
    background: var(--white);
    border-bottom: 1px solid #eee;
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.search-box button {
    padding: 12px 20px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.search-box button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* 搜索结果 */
.search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
    border-radius: var(--border-radius);
    background: #fafafa;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: var(--transition);
}

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

.search-result-item:hover {
    background: #f0f0f0;
}

.search-result-item .park-name {
    font-weight: 500;
    color: var(--text-color);
}

.search-result-item .park-district {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* 打卡记录 */
.checkin-records {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

.records-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.records-header h3 {
    font-size: 1rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.records-header h3::before {
    content: "📍";
}

.clear-records-btn {
    padding: 6px 12px;
    background: #ffebee;
    color: #c62828;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.clear-records-btn:hover {
    background: #ffcdd2;
}

/* 打卡记录卡片 */
.record-card {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.record-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
}

.record-card .park-name {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 8px;
    font-size: 1rem;
}

.record-card .checkin-time {
    font-size: 0.85rem;
    color: var(--text-light);
}

.record-card .checkin-date {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.record-card .delete-record {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: rgba(198, 40, 40, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #c62828;
    font-size: 0.9rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.record-card .delete-record:hover {
    background: #ffcdd2;
}

/* 空状态 */
.empty-records {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-records .icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.empty-records p {
    font-size: 0.95rem;
}

/* 地图容器 */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* 切换侧边栏按钮 */
.toggle-sidebar {
    position: absolute;
    top: 80px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: var(--white);
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
}

.toggle-sidebar:hover {
    transform: scale(1.1);
}

/* 地图信息面板 */
.map-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.9rem;
}

.map-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Leaflet 自定义样式 */
.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    margin: 0;
    min-width: 250px;
}

.popup-content {
    padding: 20px;
}

.popup-content h3 {
    color: var(--primary-dark);
    font-size: 1.1rem;
    margin-bottom: 8px;
    padding-right: 30px;
}

.popup-content .district-badge {
    display: inline-block;
    background: var(--secondary-color);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-bottom: 10px;
}

.popup-content .description {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.popup-content .checkin-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.popup-content .checkin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.popup-content .checkin-btn.checked {
    background: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
}

.popup-content .checkin-btn.checked:hover {
    transform: none;
    box-shadow: none;
}

/* 自定义标记 */
.custom-marker {
    background: var(--primary-color);
    border: 3px solid var(--white);
    border-radius: 50%;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.custom-marker:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-lg);
}

.custom-marker.checked {
    background: var(--accent-color);
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--primary-color);
    color: var(--white);
    padding: 15px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--primary-color);
}

.toast.error {
    background: #c62828;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 75%;
        max-width: 280px;
    }

    .sidebar-header {
        padding: 12px 15px;
    }

    .sidebar-header h1 {
        font-size: 1.1rem;
    }

    .sidebar-header h1::before {
        font-size: 1.3rem;
    }

    .search-container {
        padding: 10px 15px;
    }

    .search-box input {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .search-box button {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .checkin-records {
        padding: 10px 15px;
    }

    .records-header {
        margin-bottom: 10px;
    }

    .records-header h3 {
        font-size: 0.9rem;
    }

    .clear-records-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 100%;
    }

    .map-info {
        left: 20px;
        right: 20px;
        transform: none;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 动画 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 0.6s ease;
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: "";
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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