:root {
    --primary-green: #7ED321;
    --secondary-green: #9FE870;
    --accent-yellow: #F5D544;
    --dark-gray: #2C3E50;
    --light-gray: #F8F9FA;
    --text-color: #4b6b5c;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(160deg, #f0f7ee 0%, #e6f3e7 100%);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* 地图容器 */
#map-container {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* 侧边栏 (磨玻璃) */
.sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 320px;
    height: calc(100vh - 40px);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: all 0.3s ease;
    overflow: hidden;
}

/* 折叠状态 */
.sidebar.collapsed {
    width: 60px;
    padding: 12px;
}

.sidebar.collapsed .sidebar-content {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
}

/* 侧边栏内容容器 */
.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    overflow: hidden;
    position: relative;
}

/* 折叠按钮 - 位于内容区域左上角 */
.sidebar-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    background: var(--primary-green);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(126, 211, 33, 0.3);
}

.sidebar-toggle:hover {
    background: var(--secondary-green);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(126, 211, 33, 0.4);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* 展开按钮 - 折叠状态下显示在侧边栏外部 */
.sidebar-expand-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    background: var(--primary-green);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 12;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(126, 211, 33, 0.3);
}

.sidebar.collapsed .sidebar-expand-btn {
    display: flex;
}

.sidebar-expand-btn:hover {
    background: var(--secondary-green);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(126, 211, 33, 0.4);
}

.sidebar-expand-btn:active {
    transform: scale(0.95);
}

/* 折叠按钮图标 */
.toggle-icon, .expand-icon {
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

/* 调整header的padding，为折叠按钮留出空间 */
.sidebar-content .header {
    margin-top: 50px;
    margin-bottom: 30px;
    text-align: center;
}

.header {
    margin-bottom: 30px;
    text-align: center;
}

.header h1 {
    font-size: 24px;
    color: var(--dark-gray);
    margin-bottom: 8px;
}

.header p {
    font-size: 14px;
    color: #7a938b;
}

/* 上传按钮 */
.control-group {
    margin-bottom: 24px;
}

.upload-btn, .download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #7ED321, #5a9f73);
    color: white;
    border-radius: 50px; /* 椭圆风格 */
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(126, 211, 33, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    font-size: 14px;
    margin-bottom: 12px;
}

.download-btn {
    background: linear-gradient(135deg, #F5D544, #e6c441);
    box-shadow: 0 4px 15px rgba(245, 213, 68, 0.4);
    display: none; /* 默认隐藏，处理完成后显示 */
}

.upload-btn:hover, .download-btn:hover {
    transform: translateY(-2px);
}

.upload-btn:hover {
    box-shadow: 0 6px 20px rgba(126, 211, 33, 0.6);
}

.download-btn:hover {
    box-shadow: 0 6px 20px rgba(245, 213, 68, 0.6);
}

.upload-btn .icon, .download-btn .icon {
    margin-right: 8px;
    font-size: 18px;
}

/* 统计面板 */
.stats-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
}

.stat-item .label {
    font-size: 12px;
    color: #7a938b;
    margin-bottom: 4px;
}

.stat-item .value {
    font-size: 20px;
    font-weight: bold;
    color: var(--dark-gray);
}

/* 获取标记点按钮 */
.get-markers-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(126, 211, 33, 0.3);
    white-space: nowrap;
    min-width: 140px;
}

.get-markers-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(126, 211, 33, 0.4);
}

.get-markers-btn:active {
    transform: translateY(0);
}

.get-markers-btn.info-style {
    background: linear-gradient(135deg, var(--accent-yellow), #e6c441);
    box-shadow: 0 2px 8px rgba(245, 213, 68, 0.3);
    margin-top: 8px;
    width: 100%;
}

.get-markers-btn.info-style:hover {
    box-shadow: 0 4px 12px rgba(245, 213, 68, 0.4);
}

.get-markers-btn .icon {
    font-size: 12px;
}

/* 信息面板 */
.info-panel {
    margin-bottom: 24px;
    background: rgba(245, 213, 68, 0.2);
    padding: 12px;
    border-radius: 12px;
    border-left: 4px solid var(--accent-yellow);
}

.info-text {
    font-size: 12px;
    color: #8b7a00;
    margin: 0;
    text-align: center;
}

/* 数据列表 */
.data-list-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.data-list-container h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--dark-gray);
}

.scroll-view {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

/* 滚动条美化 */
.scroll-view::-webkit-scrollbar {
    width: 4px;
}
.scroll-view::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

#data-list li {
    list-style: none;
    padding: 10px;
    background: rgba(255, 255, 255, 0.4);
    margin-bottom: 8px;
    border-radius: 12px;
    font-size: 14px;
    color: #2f4b3c;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#data-list li.success {
    border-left: 4px solid var(--primary-green);
}
#data-list li.fail {
    border-left: 4px solid #ff6b6b;
}

.empty-tip {
    text-align: center;
    color: #aaa;
    padding: 20px 0;
}

.amap-logo, .amap-copyright {
    display: none !important;
}
/* 用户信息栏样式 */
.user-bar {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-width: 300px;
    border-radius: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7ED321, #9FE870);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.user-name {
    font-weight: 600;
    color: #2C3E50;
}

.user-limit {
    font-size: 12px;
    color: #64748B;
    background: rgba(126, 211, 33, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
}

.btn-logout {
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* 登录提示面板样式 */
.login-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border-radius: 20px;
}

.login-content h2 {
    color: #2C3E50;
    margin-bottom: 16px;
    font-size: 24px;
}

.login-content p {
    color: #64748B;
    margin-bottom: 24px;
    font-size: 16px;
}

.login-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, #7ED321, #9FE870);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(126, 211, 33, 0.3);
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.1);
    color: #64748B;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn-secondary:hover {
    background: rgba(148, 163, 184, 0.2);
}

/* 隐藏主要内容当未登录时 */
.app-hidden .sidebar,
.app-hidden #map-container {
    display: none;
}

/* 图片模态框样式 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: all 0.3s ease;
}

.image-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.image-modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.image-modal .card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 24px;
}

.image-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    min-height: 200px;
}

.image-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: #e74c3c;
}

.image-error button {
    margin-top: 10px;
    padding: 8px 16px;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.image-error button:hover {
    background: #5cb85c;
}

#contact-image {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 2px solid var(--primary-green);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
}

#contact-image.loading {
    opacity: 0.5;
}

.image-description {
    font-size: 14px;
    color: var(--dark-gray);
    font-weight: 600;
    margin: 0;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(126, 211, 33, 0.2);
}

.card-title-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
}

.image-info {
    text-align: center;
    margin-bottom: 20px;
}

.image-info p {
    font-size: 14px;
    color: #64748B;
    margin: 4px 0;
}

.close-image-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.close-image-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 移动端侧边栏样式 */
    .sidebar {
        width: 280px;
        top: 10px;
        left: 10px;
        height: calc(100vh - 20px);
        padding: 16px;
    }
    
    /* 移动端默认折叠 */
    .sidebar.mobile-collapsed {
        width: 50px;
        padding: 8px;
    }
    
    .sidebar.mobile-collapsed .sidebar-content {
        opacity: 0;
        visibility: hidden;
        transform: translateX(-20px);
    }
    
    .sidebar.mobile-collapsed .sidebar-expand-btn {
        display: flex;
    }
    
    /* 移动端折叠按钮调整 */
    .sidebar-toggle {
        top: 12px;
        left: 12px;
        width: 32px;
        height: 32px;
        font-size: 12px;
        /* 增加触摸区域 */
        padding: 2px;
        min-width: 44px;
        min-height: 44px;
        margin: -6px;
    }
    
    /* 移动端header字体调整 */
    .sidebar .header h1 {
        font-size: 20px;
        margin-bottom: 6px;
    }
    
    .sidebar .header p {
        font-size: 12px;
    }
    
    /* 图片模态框移动端样式 */
    .image-modal-content {
        width: 95%;
        max-width: 350px;
    }
    
    .image-modal .card {
        padding: 20px;
    }
    
    #contact-image {
        max-height: 250px;
    }
}