/* ============================================================
 * 永嘉美食地图 - 样式表
 * 文件名：style.css
 * 说明：包含所有页面样式，使用CSS变量统一管理主题色彩
 * ============================================================ */

/* ---------- CSS变量定义（主题色系统）---------- */
:root {
    --primary-color: #d64541;
    --primary-light: #e86e68;
    --primary-dark: #b53934;
    --secondary-color: #2c3e50;
    --accent-orange: #e67e22;
    --accent-green: #27ae60;
    --accent-blue: #3498db;
    --accent-purple: #9b59b6;
    --bg-panel: rgba(255, 255, 255, 0.95);
    --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.15);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 全局基础样式 ---------- */
body, html {
    margin: 0; padding: 0;
    height: 100%; width: 100%;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #fef5f5 0%, #fff8f0 100%);
}

#container { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }

/* ---------- 顶部导航栏 ---------- */
.top-nav {
    position: absolute; top: 0; left: 0; right: 0;
    z-index: 200;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.nav-brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 18px; font-weight: 700;
    color: var(--secondary-color);
    text-decoration: none;
}

.nav-links { display: flex; gap: 8px; }

.nav-link {
    padding: 8px 18px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px; color: #555;
    cursor: pointer; text-decoration: none;
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    background: var(--primary-color); color: white;
    border-color: var(--primary-color);
}

/* ---------- 左侧控制面板 ---------- */
.control-panel {
    position: absolute; top: 70px; left: 20px;
    z-index: 100;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    width: 330px;
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 面板滚动条 */
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-track { background: rgba(0,0,0,0.04); border-radius: 3px; }
.control-panel::-webkit-scrollbar-thumb { background: rgba(214,69,65,0.3); border-radius: 3px; }

/* ---------- 头部区域 ---------- */
.header {
    display: flex; align-items: center;
    margin-bottom: 16px; padding-bottom: 14px;
    border-bottom: 2px solid #f0f0f0; position: relative;
}
.header::after {
    content: ''; position: absolute; bottom: -2px; left: 0;
    width: 40px; height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-orange));
}
.header-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-right: 12px;
    box-shadow: 0 8px 20px rgba(214, 69, 65, 0.3);
}
.header-content h1 { margin: 0; font-size: 19px; font-weight: 600; color: var(--secondary-color); }
.header-content p { margin: 3px 0 0 0; font-size: 11px; color: #888; }

/* ---------- 用户状态区 ---------- */
.user-status {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px;
    background: linear-gradient(145deg, #fff8f5, #fff0f0);
    border-radius: var(--radius-md); margin-bottom: 16px;
}
.user-info { display: flex; align-items: center; gap: 8px; }
.user-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 600; font-size: 13px;
}
.user-details h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--secondary-color); }
.user-details p { margin: 1px 0 0 0; font-size: 10px; color: #888; }

.btn-logout {
    padding: 7px 12px; background: transparent; border: 1px solid #ddd;
    border-radius: var(--radius-sm); font-size: 11px; color: #666; cursor: pointer;
    transition: var(--transition);
}
.btn-logout:hover { border-color: var(--primary-color); color: var(--primary-color); }

.btn-login {
    width: 100%; padding: 11px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white; border: none; border-radius: var(--radius-md);
    font-size: 13px; font-weight: 500; cursor: pointer; transition: var(--transition);
    box-shadow: 0 6px 16px rgba(214, 69, 65, 0.3); margin-bottom: 16px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(214, 69, 65, 0.4); }

/* ---------- 统计栏 ---------- */
.stats-bar {
    display: flex; justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(145deg, #fff8f5, #fff0f0);
    border-radius: var(--radius-md); margin-bottom: 14px;
}
.stat-item { text-align: center; }
.stat-item .number { display: block; font-size: 22px; font-weight: 700; color: var(--primary-color); }
.stat-item .label { font-size: 10px; color: #888; margin-top: 2px; }

/* ---------- 控制分组 ---------- */
.control-group { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px dashed #eee; }
.control-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.control-group h4 {
    margin: 0 0 12px 0; font-size: 12px; font-weight: 600; color: #555;
    letter-spacing: 1px; display: flex; align-items: center;
}
.control-group h4::before {
    content: ''; width: 7px; height: 7px;
    background: var(--primary-color); border-radius: 50%; margin-right: 7px;
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.8)} }

/* ---------- 表单元素 ---------- */
.input-group { margin-bottom: 10px; }
.input-group label { display: block; font-size: 11px; margin-bottom: 5px; color: #666; font-weight: 500; }
.input-group input, .input-group select, .input-group textarea {
    width: 100%; padding: 9px 12px; box-sizing: border-box;
    border: 2px solid #e8e8e8; border-radius: var(--radius-md);
    font-size: 12px; background: #fff; transition: var(--transition);
    outline: none; font-family: inherit;
}
.input-group textarea { resize: vertical; min-height: 55px; line-height: 1.5; }
.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(214, 69, 65, 0.1);
}

/* ---------- 按钮系统 ---------- */
.btn-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }

.action-btn {
    padding: 9px 5px; cursor: pointer;
    background: linear-gradient(145deg, #f8f8f8, #fff);
    border: 1px solid #e0e0e0; border-radius: var(--radius-sm);
    font-size: 11px; font-weight: 500; color: #555;
    transition: var(--transition); text-align: center;
    display: flex; align-items: center; justify-content: center; gap: 3px;
}
.action-btn:hover {
    background: linear-gradient(145deg, #fff, #fef5f5);
    border-color: var(--primary-color); color: var(--primary-color);
    transform: translateY(-2px); box-shadow: 0 4px 12px rgba(214, 69, 65, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white; border: none; padding: 11px 16px;
    font-size: 12px; font-weight: 600; border-radius: var(--radius-md);
    box-shadow: 0 6px 16px rgba(214, 69, 65, 0.3);
    transition: var(--transition); width: 100%;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(214, 69, 65, 0.4); }

.btn-secondary {
    background: transparent; color: var(--secondary-color);
    border: 1px solid #ddd; padding: 9px 14px;
    font-size: 11px; font-weight: 500; border-radius: var(--radius-md);
    transition: var(--transition); width: 100%; margin-top: 6px;
}
.btn-secondary:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

.category-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; cursor: pointer;
}

/* ---------- 列表项 ---------- */
.food-list, .saved-locations, .nav-history { max-height: 140px; overflow-y: auto; padding-right: 3px; }

.food-item, .location-item, .history-item {
    padding: 10px; border-radius: var(--radius-md);
    background: linear-gradient(145deg, #fff, #fafafa);
    margin-bottom: 6px; cursor: pointer; transition: var(--transition);
    border: 1px solid transparent; box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.food-item:hover, .location-item:hover, .history-item:hover {
    background: linear-gradient(145deg, #fff, #fff8f0);
    border-color: rgba(214, 69, 65, 0.25); transform: translateX(3px);
}
.food-item.active { border-color: var(--primary-color); background: linear-gradient(145deg, #fff8f5, #fff0f0); }

.food-item-header, .location-header, .history-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px;
}
.food-item-header h5, .location-header h5, .history-header h5 {
    margin: 0; font-size: 13px; color: var(--secondary-color); font-weight: 600;
}
.rating { display: flex; align-items: center; gap: 2px; color: var(--accent-orange); font-size: 11px; font-weight: 600; }

.tags { display: flex; gap: 4px; margin-bottom: 5px; }
.tag { font-size: 10px; padding: 2px 7px; border-radius: 10px; background: rgba(52,152,219,0.1); color: var(--accent-blue); font-weight: 500; }
.tag.hot { background: rgba(214,69,65,0.1); color: var(--primary-color); }
.tag.recommend { background: rgba(39,174,96,0.1); color: var(--accent-green); }

.food-item p, .location-item p, .history-item p { margin: 2px 0; font-size: 11px; color: #777; }
.comment { font-size: 10px; color: #999; line-height: 1.4; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 图例 ---------- */
.legend { display: flex; align-items: center; margin-bottom: 6px; font-size: 11px; color: #666; transition: var(--transition); cursor: default; }
.legend:hover { color: var(--secondary-color); transform: translateX(3px); }
.legend .dot { width: 13px; height: 13px; border-radius: 50%; margin-right: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.dot.hot { background: linear-gradient(135deg, var(--primary-color), #ec7063); }
.dot.normal { background: linear-gradient(135deg, var(--accent-blue), #5dade2); }
.dot.recommend { background: linear-gradient(135deg, var(--accent-green), #58d68d); }
.dot.saved { background: linear-gradient(135deg, var(--accent-purple), #bb77dd); }

/* ---------- 开关控件 ---------- */
.toggle-switch {
    position: relative; width: 38px; height: 21px;
    background: linear-gradient(145deg, #e0e0e0, #d0d0d0);
    border-radius: 20px; transition: all 0.3s; cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}
.toggle-switch::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 17px; height: 17px; background: white; border-radius: 50%;
    transition: all 0.3s; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.toggle-switch.active { background: linear-gradient(135deg, var(--primary-color), var(--primary-light)); box-shadow: 0 2px 12px rgba(214,69,65,0.4); }
.toggle-switch.active::after { transform: translateX(17px); box-shadow: 0 2px 8px rgba(0,0,0,0.25); }

.checkbox-item { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--secondary-color); font-weight: 500; }
.checkbox-row { display: flex; gap: 12px; margin-top: 5px; }
.checkbox-row label { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #666; cursor: pointer; }
.checkbox-row input[type="checkbox"] {
    appearance: none; width: 15px; height: 15px;
    border: 2px solid #ddd; border-radius: 4px; cursor: pointer; position: relative;
}
.checkbox-row input[type="checkbox"]:checked { background: var(--primary-color); border-color: var(--primary-color); }
.checkbox-row input[type="checkbox"]:checked::after {
    content: '✓'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); color: white; font-size: 9px; font-weight: bold;
}

/* ---------- 搜索框 ---------- */
.search-box { position: relative; margin-bottom: 12px; }
.search-box input { padding-left: 36px !important; }
.search-box::before { content: '🔍'; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; color: #999; }

/* ---------- 导航输入组 ---------- */
.nav-input-group { display: flex; gap: 6px; margin-bottom: 8px; }
.nav-input-group input { flex: 1; padding: 9px 10px !important; }
.btn-nav-start { background: linear-gradient(135deg, var(--accent-green), #2ecc71) !important; box-shadow: 0 6px 16px rgba(39,174,96,0.3) !important; }
.btn-nav-start:hover { background: linear-gradient(135deg, #2ecc71, #27ae60) !important; }

.delete-btn {
    background: rgba(231,76,60,0.1); color: #e74c3c; border: none;
    padding: 3px 7px; border-radius: 4px; font-size: 9px; cursor: pointer; opacity: 0; transition: opacity 0.2s;
}
.location-item:hover .delete-btn, .history-item:hover .delete-btn { opacity: 1; }
.delete-btn:hover { background: rgba(231,76,60,0.2); }

/* ---------- 绘图工具栏 ---------- */
.draw-toolbar {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px;
}
.draw-btn {
    padding: 8px 4px; cursor: pointer;
    background: linear-gradient(145deg, #f8f8f8, #fff);
    border: 2px solid #e0e0e0; border-radius: var(--radius-sm);
    font-size: 11px; font-weight: 600; color: #555;
    transition: var(--transition); text-align: center;
}
.draw-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); transform: translateY(-1px); }
.draw-btn.active { background: var(--accent-blue); color: white; border-color: var(--accent-blue); }

/* ---------- Toast提示 ---------- */
.toast {
    position: fixed; bottom: 35px; left: 50%; transform: translateX(-50%);
    padding: 12px 24px; border-radius: 28px; font-size: 13px; font-weight: 500;
    z-index: 1000; animation: slideUp 0.4s ease-out;
}
.toast.success { background: linear-gradient(135deg, #27ae60, #2ecc71); color: white; box-shadow: 0 8px 24px rgba(39,174,96,0.4); }
.toast.error { background: linear-gradient(135deg, #e74c3c, #ec7063); color: white; box-shadow: 0 8px 24px rgba(231,76,60,0.4); }

@keyframes slideUp { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes slideDown { from { opacity: 1; transform: translateX(-50%) translateY(0); } to { opacity: 0; transform: translateX(-50%) translateY(20px); } }

/* ---------- 观测数据面板 ---------- */
.observation-panel { max-height: 150px; overflow-y: auto; padding-right: 3px; }
.obs-item {
    padding: 8px 10px; border-radius: var(--radius-sm);
    background: linear-gradient(145deg, #f0f8ff, #fafcff);
    margin-bottom: 5px; border-left: 3px solid var(--accent-blue);
    font-size: 11px; color: #444;
}
.obs-item .obs-type { font-weight: 600; color: var(--accent-blue); margin-right: 6px; }
.obs-item .obs-coords { color: #888; font-size: 10px; }

/* ---------- 图片轮播组件 ---------- */
.carousel-slides { position: relative; width: 100%; height: 170px; }
.carousel-slide { display: none; }
.carousel-slide.active { display: block; animation: fadeIn 0.3s ease; }
.carousel-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,0.5); color: white; border: none;
    width: 28px; height: 28px; border-radius: 50%;
    cursor: pointer; z-index: 2; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.carousel-btn:hover { background: rgba(0,0,0,0.75); }
.carousel-prev { left: 6px; }
.carousel-next { right: 6px; }
.carousel-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: rgba(255,255,255,0.45); cursor: pointer;
    transition: all 0.25s ease; border: 1px solid rgba(255,255,255,0.6);
}
.carousel-dot.active { background: #fff; transform: scale(1.25); border-color: #fff; box-shadow: 0 0 6px rgba(255,255,255,0.5); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
