/* === 全局重置 === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', 'PingFang SC', Roboto, 'Helvetica Neue', sans-serif;
    background: #f0f4f8;
    color: #2d3748;
    overflow: hidden;
    height: 100vh;
}

/* ===== 登录覆盖层（用于 login.html 和 register.html） ===== */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 54, 93, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    backdrop-filter: blur(4px);
}
#login-box {
    background: #fff;
    border-radius: 24px;
    padding: 40px 36px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}
.login-logo {
    font-size: 28px;
    font-weight: 700;
    color: #1a365d;
}
.login-logo i {
    color: #f6e05e;
    margin-right: 8px;
}
.login-subtitle {
    font-size: 14px;
    color: #718096;
    margin-bottom: 30px;
}
.login-field {
    display: flex;
    align-items: center;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 6px 14px;
    margin-bottom: 16px;
}
.login-field i {
    color: #a0aec0;
    margin-right: 12px;
    width: 18px;
}
.login-field input {
    border: none;
    background: transparent;
    padding: 12px 0;
    width: 100%;
    outline: none;
    font-size: 16px;
}
.login-field input[type="file"] {
    padding: 8px 0;
    font-size: 14px;
}
.login-error {
    color: #e53e3e;
    font-size: 14px;
    min-height: 24px;
    margin-bottom: 8px;
}
#login-submit-btn {
    width: 100%;
    padding: 14px;
    background: #2b6cb0;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
#login-submit-btn:hover {
    background: #1a365d;
}
.login-toggle {
    margin-top: 16px;
    font-size: 14px;
}
.login-toggle a {
    color: #2b6cb0;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}
.login-toggle a:hover {
    text-decoration: underline;
}

/* ===== 顶部导航（用于 index.html） ===== */
header {
    background: linear-gradient(135deg, #1a365d, #2b6cb0);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
    position: relative;
}
.logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
}
.logo i {
    margin-right: 8px;
    color: #f6e05e;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}
#user-display i {
    margin-right: 4px;
}
.logout-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 4px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
}
.logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== 主布局（面板 + 地图） ===== */
.container {
    display: flex;
    height: calc(100vh - 70px);
    width: 100%;
}
.panel {
    width: 340px;
    min-width: 340px;
    background: #fff;
    padding: 16px 12px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 5;
}
#map-container {
    flex: 1;
    height: 100%;
}

/* === 筛选按钮 === */
.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}
.filter-btn {
    flex: 1 0 auto;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
    color: #4a5568;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.filter-btn i {
    font-size: 14px;
}
.filter-btn.active {
    background: #2b6cb0;
    color: #fff;
    border-color: #2b6cb0;
}
.filter-btn:hover {
    background: #edf2f7;
}
.filter-btn.active:hover {
    background: #2b6cb0;
}

/* === 路径规划 === */
.route-planner {
    background: #f7fafc;
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.input-group {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 4px 10px;
}
.input-group i {
    color: #718096;
    margin-right: 8px;
}
.input-group input {
    border: none;
    padding: 8px 0;
    width: 100%;
    outline: none;
    font-size: 14px;
}
.route-planner button {
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: #2b6cb0;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.route-planner button:hover {
    background: #1a365d;
}
#clear-route-btn {
    background: #e53e3e;
}
#clear-route-btn:hover {
    background: #c53030;
}

/* === 节点列表 === */
.node-list {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid #edf2f7;
    padding-top: 10px;
}
.node-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid #f0f4f8;
    cursor: pointer;
    transition: 0.15s;
}
.node-item:hover {
    background: #f7fafc;
}
.node-item .name {
    font-weight: 600;
    font-size: 14px;
}
.node-item .type {
    font-size: 12px;
    color: #718096;
    background: #edf2f7;
    padding: 2px 8px;
    border-radius: 12px;
}
.node-item .stock {
    font-size: 12px;
    color: #38a169;
}
.list-loading {
    text-align: center;
    color: #a0aec0;
    padding: 20px;
}

/* === 扫码模拟 === */
.scan-section {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ebf8ff;
    padding: 10px 14px;
    border-radius: 12px;
    border-left: 4px solid #2b6cb0;
}
#scan-btn {
    background: #2b6cb0;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}
#scan-btn:hover {
    background: #1a365d;
}
#scan-result {
    font-size: 14px;
    color: #2d3748;
}

/* === 红旅标签 === */
.red-tour {
    font-size: 13px;
    color: #e53e3e;
    background: #fff5f5;
    padding: 8px 12px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid #fed7d7;
}

/* === 响应式 === */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: calc(100vh - 60px);
    }
    .panel {
        width: 100%;
        min-width: unset;
        height: 45vh;
        overflow-y: auto;
        padding: 12px;
        box-shadow: none;
        border-bottom: 1px solid #e2e8f0;
        order: 2;
    }
    #map-container {
        height: 55vh;
        order: 1;
    }
    header .logo {
        font-size: 16px;
    }
    .header-right {
        font-size: 12px;
        gap: 8px;
    }
    .filter-btn {
        font-size: 11px;
        padding: 4px 8px;
    }
    #login-box {
        padding: 30px 20px;
    }
}