:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-card: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --accent: #2196F3;
    --border-color: #e0e0e0;
    --panel-width: 320px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: var(--text-primary);
    height: 100vh;
    overflow: auto;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    height: 60px;
}

.navbar h1 { font-size: 1.5rem; font-weight: 300; }
.nav-actions { display: flex; gap: 1rem; align-items: center; }
.nav-form { margin: 0; }

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #1976D2; }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-color); }

.map-style-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    font-size: 0.9rem;
    cursor: pointer;
}

#map-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
}

.map-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
}

.map-view.active { display: block; }

/* 悬浮的足迹面板 */
#places-panel {
    position: fixed;
    right: 10px;
    top: 70px;
    bottom: 10px;
    width: var(--panel-width);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
    padding: 1rem;
    overflow-y: auto;
    z-index: 1000;
    transition: opacity 0.2s, transform 0.2s, right 0.2s;
}

#places-panel.hidden {
    opacity: 0;
    transform: translateX(20px);
    pointer-events: none;
}

/* 折叠按钮 - 固定在右边 */
.toggle-btn {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
    z-index: 1001;
}

.toggle-btn:hover { background: var(--bg-secondary); }

/* Cesium 3D 鼠标样式 */
#map3d {
    cursor: grab;
}

#map3d:active {
    cursor: grabbing;
}

/* 折叠按钮位置调整 - 当面板隐藏时 */
.toggle-btn.expanded {
    right: calc(10px + var(--panel-width));
    border-radius: 8px 0 0 8px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#places-panel h3 {
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
}

#places-list { list-style: none; }

#places-list li {
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border-color);
}

#places-list .place-name { font-weight: 500; margin-bottom: 0.25rem; padding-right: 56px; }
#places-list .place-date { font-size: 0.85rem; color: var(--text-secondary); }
#places-list .place-note { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.25rem; }

#places-list .edit-btn, #places-list .delete-btn {
    position: absolute;
    top: 0.5rem;
    color: #ccc;
    cursor: pointer;
    font-size: 1rem;
    width: 24px;
    height: 24px;
    text-align: center;
    border-radius: 4px;
}
#places-list .edit-btn { right: 26px; }
#places-list .delete-btn { right: 6px; }
#places-list .edit-btn:hover { color: #2196F3; }
#places-list .delete-btn:hover { color: #f44336; }

.add-place-container { max-width: 700px; margin: 2rem auto; padding: 2rem; padding-bottom: 4rem; background: var(--bg-secondary); border-radius: 12px; min-height: calc(100vh - 100px); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-secondary); font-weight: 500; }
.form-group input, .form-group textarea { width: 100%; padding: 0.75rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 6px; font-size: 1rem; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); }
#pick-map { height: 50vh; min-height: 300px; margin: 1rem 0; border-radius: 8px; }
.search-box { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.search-box input { flex: 1; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 6px; }
.search-box button { white-space: nowrap; }
#search-result { margin-bottom: 1rem; color: var(--text-secondary); font-size: 0.9rem; padding: 0.5rem 0.75rem; border-radius: 6px; }
.location-message { transition: all 0.2s; }
.location-message.info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.location-message.success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.location-message.error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

.login-container {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-form {
    width: 100%;
    max-width: 360px;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.login-form h2 {
    margin-bottom: 1.25rem;
    font-weight: 400;
}

.login-form .btn {
    width: 100%;
}

.login-error {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #fff3f3;
    border: 1px solid #ffc9c9;
    border-radius: 6px;
    color: #b00020;
    font-size: 0.9rem;
}

.login-form .form-group.remember-me label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
}

.login-form .form-group.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Collection selector */
.collection-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.collection-selector select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    font-size: 0.9rem;
}

.collection-selector button {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    cursor: pointer;
}

.collection-selector button:hover {
    background: var(--bg-secondary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    width: 450px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 1rem;
}

#collection-list {
    margin-bottom: 1rem;
}

.collection-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

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

.color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.collection-item .name {
    flex: 1;
}

.collection-item button {
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
}

.collection-item button:hover {
    color: var(--text-primary);
}

.collection-item input[type="color"] {
    width: 24px;
    height: 24px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.collection-item input[type="text"] {
    flex: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.collection-item .save-collection-btn {
    color: #4CAF50;
}

.add-collection {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.add-collection input[type="text"] {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.add-collection input[type="color"] {
    width: 40px;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

/* Place item with collection color */
#places-list li .collection-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: white;
    margin-bottom: 0.25rem;
}

.collection-public-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    white-space: nowrap;
    margin-left: 0.5rem;
}

.collection-public-label input[type="checkbox"] {
    cursor: pointer;
}

.add-collection input[type="color"] {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
