/* style.css - 全局样式 */

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

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

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

/* 地图区域 */
#map {
    flex: 1;
    height: 100%;
    z-index: 1;
}

/* 侧边栏 */
.sidebar {
    width: 320px;
    min-width: 280px;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
}

.sidebar-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: #fff;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.85;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* 距离计算面板 */
.distance-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid #e8e8e8;
}

.distance-panel h3 {
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.distance-selects {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.distance-selects select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #333;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.distance-selects select:focus {
    border-color: #2196F3;
}

.distance-btn {
    width: 100%;
    padding: 9px;
    background: #2196F3;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

.distance-btn:hover {
    background: #1976D2;
}

.distance-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.distance-result {
    margin-top: 10px;
    padding: 10px;
    background: #E3F2FD;
    border-radius: 6px;
    font-size: 14px;
    color: #1565C0;
    text-align: center;
    font-weight: 500;
    display: none;
}

.distance-result.show {
    display: block;
}

/* 标记列表 */
.marker-list-section h3 {
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
    padding: 0 4px;
}

.marker-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.marker-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.marker-list-item:hover {
    border-color: #2196F3;
    background: #f5f9ff;
    box-shadow: 0 1px 4px rgba(33, 150, 243, 0.15);
}

.marker-list-item.selected {
    border-color: #2196F3;
    background: #E3F2FD;
}

.marker-item-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.marker-item-info {
    flex: 1;
    min-width: 0;
}

.marker-item-name {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.marker-item-category {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.marker-item-check {
    width: 18px;
    height: 18px;
    accent-color: #2196F3;
    flex-shrink: 0;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
}

/* 添加标记表单弹窗 */
.add-marker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.add-marker-modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    width: 360px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #333;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.form-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-cancel {
    background: #f0f0f0;
    color: #555;
}

.btn-cancel:hover {
    background: #e0e0e0;
}

.btn-submit {
    background: #2196F3;
    color: #fff;
}

.btn-submit:hover {
    background: #1976D2;
}

/* 自定义标记图标样式 */
.custom-marker-icon {
    background: transparent !important;
    border: none !important;
}

.marker-pin {
    width: 36px;
    height: 36px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    border: 2.5px solid #fff;
}

.marker-emoji {
    transform: rotate(45deg);
    font-size: 16px;
}

.marker-shadow {
    width: 12px;
    height: 6px;
    border-radius: 50%;
    margin: 2px auto 0;
    opacity: 0.3;
    filter: blur(2px);
}

/* Popup 样式 */
.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

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

.custom-popup .leaflet-popup-tip {
    display: none;
}

.popup-content {
    padding: 16px;
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.popup-header h3 {
    font-size: 16px;
    color: #333;
    flex: 1;
}

.popup-category {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.cat-attraction { background: #FCE4EC; color: #C2185B; }
.cat-hotel { background: #E3F2FD; color: #1565C0; }
.cat-restaurant { background: #FFF3E0; color: #E65100; }
.cat-transport { background: #E8F5E9; color: #2E7D32; }

.popup-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 10px;
    word-break: break-word;
}

.popup-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #888;
}

.popup-coords,
.popup-time {
    display: flex;
    align-items: center;
    gap: 5px;
}

.popup-actions {
    display: flex;
    gap: 8px;
}

.popup-btn {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    background: #fff;
    transition: all 0.2s;
    text-align: center;
}

.popup-btn:hover {
    background: #f5f5f5;
}

.popup-btn-delete:hover {
    border-color: #ef5350;
    color: #d32f2f;
    background: #FFEBEE;
}

.popup-btn-distance:hover {
    border-color: #2196F3;
    color: #1565C0;
    background: #E3F2FD;
}

/* PWA 安装提示 */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #2196F3;
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.4);
    z-index: 3000;
    display: none;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s;
}

.pwa-install-banner.show {
    display: flex;
}

.pwa-install-banner:hover {
    transform: translateX(-50%) scale(1.02);
}

.pwa-install-banner .install-btn {
    background: #fff;
    color: #2196F3;
    border: none;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        right: -320px;
        top: 0;
        transition: right 0.3s ease;
        width: 280px;
    }

    .sidebar.open {
        right: 0;
    }

    .sidebar-toggle {
        display: flex !important;
    }
}

.sidebar-toggle {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1001;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Leaflet 默认样式覆盖 */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 18px !important;
    color: #333 !important;
}

.leaflet-control-attribution {
    font-size: 10px !important;
    background: rgba(255, 255, 255, 0.8) !important;
}
