/* ========== 全局重置与基础布局 ==========
   盘前村智慧水务 · 基础样式层 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'JetBrains Mono', 'PingFang SC', sans-serif;
}

:root {
    --bg-obsidian: #07080A;
    --bg-charcoal: #0E1015;
    --bg-glass: rgba(22, 25, 34, 0.72);
    --color-cyan: #00F0FF;
    --color-blue: #3B82F6;
    --color-green: #10B981;
    --color-amber: #F59E0B;
    --color-red: #EF4444;
    --text-primary: #F4F4F5;
    --text-secondary: #A1A1AA;
    --text-tertiary: #52525B;
    --border-light: 1px solid rgba(255, 255, 255, 0.08);
    --border-highlight: 1px solid rgba(255, 255, 255, 0.22);
    --bg-gradient: radial-gradient(circle at 50% 0%, rgba(0, 240, 255, 0.07), rgba(59, 130, 246, 0.04) 40%, transparent 75%);
}

html, body {
    height: 100%;
    background: var(--bg-obsidian);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
}

/* ========== 全局暗黑金属滚动条美化 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(7, 8, 10, 0.6);
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.28);
    border-radius: 4px;
    transition: background 0.28s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.5);
}

::-webkit-scrollbar-corner {
    background: rgba(7, 8, 10, 0.6);
}

.login-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    overflow: hidden;
    background: var(--bg-obsidian);
}

.login-visual {
    position: relative;
    flex: 0 0 58%;
    background-color: var(--bg-charcoal);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

/* 底层：高山红番茄实景（单独调明度/饱和度）；上层：双层曜石黑电影感蒙版 */
.login-visual::before,
.login-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.login-visual::before {
    background: url("../photo/real-tomato-vine.jpg") center 40% / cover no-repeat;
    filter: brightness(0.82) saturate(1.18) contrast(1.06);
}

.login-visual::after {
    background-image: linear-gradient(180deg, rgba(7, 8, 10, 0.35) 0%, rgba(7, 8, 10, 0.65) 55%, rgba(7, 8, 10, 0.94) 100%), linear-gradient(90deg, rgba(7, 8, 10, 0.82) 0%, rgba(7, 8, 10, 0.25) 65%, rgba(7, 8, 10, 0.75) 100%);
}

.login-visual > .visual-inner {
    position: relative;
    z-index: 1;
}

.visual-inner {
    padding: 0 clamp(56px, 6vw, 96px) clamp(56px, 7.5vh, 84px);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.visual-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    letter-spacing: 3.5px;
    color: rgba(255, 255, 255, 0.58);
    text-transform: uppercase;
}

.visual-brand::before {
    content: '';
    display: inline-block;
    width: 36px;
    height: 1px;
    background: rgba(255, 255, 255, 0.32);
}

.visual-title {
    font-size: clamp(40px, 3.8vw, 56px);
    font-weight: 700;
    line-height: 1.22;
    color: #FFFFFF;
    text-shadow: 0 8px 24px rgba(0, 0, 0, 0.48);
}

.visual-desc {
    max-width: 640px;
    font-size: 16px;
    line-height: 1.9;
    color: rgba(244, 244, 245, 0.84);
}

.visual-points {
    list-style: none;
    padding-top: 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 36px;
}

.visual-points li {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.visual-points strong {
    font-size: 24px;
    font-weight: 700;
    color: #FFFFFF;
}

.visual-points li span {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.68);
}

.login-panel {
    flex: 1;
    min-width: 460px;
    background: var(--bg-charcoal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px clamp(32px, 4vw, 64px);
    overflow-y: auto;
}

.login-box {
    width: 90%;
    max-width: 460px;
    background: var(--bg-glass);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    border: var(--border-light);
    border-top: var(--border-highlight);
    border-radius: 20px;
    padding: 52px 46px;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.22), 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 32px rgba(0, 240, 255, 0.08);
    transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.login-box:hover {
    border-color: rgba(0, 240, 255, 0.32);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.28), 0 28px 72px rgba(0, 0, 0, 0.55), 0 0 48px rgba(0, 240, 255, 0.12);
}

.login-title {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #FFFFFF;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    line-height: 1.7;
    color: #A1A1AA;
    margin-bottom: 32px;
}

.login-item {
    margin-bottom: 22px;
}

.login-item label {
    display: block;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px; display: flex; align-items: center;
    color: #E4E4E7;
}

.login-item input {
    width: 100%;
    height: 52px;
    padding: 0 18px;
    font-size: 16px;
    color: #F4F4F5;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.28s ease, box-shadow 0.28s ease, background-color 0.28s ease;
}

.login-item input::placeholder {
    color: rgba(255, 255, 255, 0.36);
}

.login-item input:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.08);
}

.login-item input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #06B6D4;
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.16), 0 0 16px rgba(6, 182, 212, 0.24);
}

#loginBtn {
    width: 100%;
    height: 54px;
    margin-top: 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffffff;
    background: linear-gradient(90deg, #2563EB 0%, #06B6D4 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(37, 99, 235, 0.3), inset 0 1px 0 0 rgba(255, 255, 255, 0.24);
    transition: transform 0.25s ease, box-shadow 0.3s ease, filter 0.25s ease;
}

#loginBtn:hover {
    transform: translateY(-2px);
    filter: brightness(1.12);
    box-shadow: 0 16px 38px rgba(6, 182, 212, 0.42), inset 0 1px 0 0 rgba(255, 255, 255, 0.32), 0 0 24px rgba(6, 182, 212, 0.28);
}

#loginBtn:active {
    transform: translateY(0);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.34), inset 0 1px 0 0 rgba(255, 255, 255, 0.16);
}

.err-tip {
    margin-top: 14px;
    font-size: 13px;
    text-align: center;
    color: #f87171;
    display: none;
}

.login-foot {
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 13px;
    line-height: 1.8;
    color: #94A3B8;
}

/* ========== 主平台容器（深色科技大屏底座） ==========
   注意：JS 登录成功时执行 mainSys.style.display = "flex" */

.main-system {
    display: none;
    /* 锁定一屏高度：侧栏常驻，仅 .content-wrap 内部纵向滚动 */
    /* 从视口 top:0 流式排布；整体锁一屏、禁止文档级滚动，杜绝顶栏被滚出视口切顶 */
    position: relative; top: 0; margin: 0;
    height: 100vh;
    overflow: hidden;
    flex-direction: row;
    background: var(--bg-gradient), var(--bg-obsidian);
    font-variant-numeric: tabular-nums;
}

.sidebar {
    width: 268px; flex: 0 0 268px;
    background: var(--bg-charcoal);
    border-right: var(--border-light);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
    color: #ffffff;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 22px 18px;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #F4F4F5;
    text-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-menu li {
    list-style: none;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #D4D4D8;
    text-decoration: none;
    padding: 0 14px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px; white-space: nowrap;
    height: 50px;
    border-radius: 10px;
    margin: 0 12px 6px;
    border-left: 4px solid transparent;
    transition: background-color 0.28s ease, color 0.28s ease,
                border-left-color 0.28s ease, box-shadow 0.28s ease;
}

.sidebar-menu a svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.28s ease, filter 0.28s ease;
    flex-shrink: 0;
}

.sidebar-menu a.active,
.sidebar-menu a:hover {
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.18) 0%, rgba(59, 130, 246, 0.06) 100%);
    border-left-color: var(--color-cyan);
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.24);
}

.sidebar-menu a.active svg,
.sidebar-menu a:hover svg {
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.6));
}

.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%; overflow: hidden;
    /* 允许 flex 子项收缩，防止宽表格撑破右侧内容区 */
    min-width: 0;
}

.top-bar {
    min-height: 58px; height: auto; position: relative; top: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: var(--border-light);
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.22);
    line-height: 1.4;
    padding: 10px 20px;
    font-size: 16px;
    color: #F4F4F5;
    letter-spacing: 0.5px; display: flex; align-items: center;
    flex-shrink: 0;
}

.top-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between; flex-wrap: nowrap; gap: 10px; width: 100%;
    height: 100%;
}

#breadcrumb {
    font-weight: 600; white-space: nowrap; flex-shrink: 0;
    color: #F4F4F5;
}

#breadcrumb::before {
    content: '当前位置：';
    color: rgba(255, 255, 255, 0.52);
    font-weight: 500;
    margin-right: 8px;
}

.content-wrap {
    flex: 1;
    padding: 20px;
    background: transparent;
    overflow-y: auto;
}

/* ========== 视图切换：非激活页强制隐藏，杜绝跨模块串图 ========== */

.content-wrap > .page:not(.active) {
    display: none !important;
}

.content-wrap > .page.active {
    display: block !important;
}

#page-cockpit.active {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
}

/* ========== 退出按钮 ========== */

.logout-btn {
    margin-left: auto; flex-shrink: 0; white-space: nowrap;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.5);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background-color 0.28s ease, border-color 0.28s ease,
                color 0.28s ease, box-shadow 0.3s ease;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.85);
    color: #fecaca;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}

/* ========== 全局状态栏与导航徽章 ========== */
.global-status-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: nowrap; flex: 1; min-width: 0; margin: 0 4px 0 12px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 12px; line-height: 1.2; border-radius: 12px; flex-shrink: 0; white-space: nowrap; transition: all 0.28s ease; }
.iot-badge { background: rgba(0, 240, 255, 0.12); color: #00F0FF; border: 1px solid rgba(0, 240, 255, 0.4); }
.cap-badge { background: rgba(0, 240, 255, 0.12); color: #00F0FF; border: 1px solid rgba(0, 240, 255, 0.4); }
.tier-badge { background: rgba(16, 185, 129, 0.12); color: #10B981; border: 1px solid rgba(16, 185, 129, 0.4); }
.dot-pulse { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #00F0FF; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.badge { display: inline-block; white-space: nowrap; flex-shrink: 0; line-height: 1.3; margin-left: auto; padding: 2px 6px; font-size: 11px; background: rgba(0, 240, 255, 0.2); color: #00F0FF; border-radius: 3px; }
.badge.live { background: rgba(239, 68, 68, 0.2); color: #f87171; animation: breathLive 1.2s ease-in-out infinite; }
@keyframes breathLive { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

/* ========== 顶栏路演开关：⚡ 模拟异常/爆管演练（胶囊 Switch） ========== */
.drill-switch { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 4px 10px 4px 5px; font-size: 12px; font-weight: 500; line-height: 1; color: var(--color-amber); background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.35); border-radius: 999px; box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.12); cursor: pointer; white-space: nowrap; transition: all 0.28s ease; }
.drill-switch:hover { background: rgba(245, 158, 11, 0.16); box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.18), 0 0 14px rgba(245, 158, 11, 0.25); }
.drill-switch-track { position: relative; width: 30px; height: 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: var(--border-light); transition: background 0.28s ease; }
.drill-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-secondary); transition: transform 0.28s ease, background 0.28s ease; }
.drill-switch.active { color: #FCA5A5; background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.55); animation: drillGlow 1.4s ease-in-out infinite; }
.drill-switch.active .drill-switch-track { background: rgba(239, 68, 68, 0.45); }
.drill-switch.active .drill-switch-track::after { transform: translateX(14px); background: #FFFFFF; }
@keyframes drillGlow { 0%, 100% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.25); } 50% { box-shadow: 0 0 18px rgba(239, 68, 68, 0.6); } }
/* ========== 响应式断点 ========== */
/* 1366×768 / 1280×720 投影仪 */
@media (max-width: 1366px) { .sidebar-header { padding: 18px 14px; font-size: 16px; } .top-bar { padding: 0 18px; font-size: 15px; } .tier-badge { display: none; } .content-wrap { padding: 16px; } }
@media (max-width: 1024px) { .sidebar { width: 236px; flex-basis: 236px; } .sidebar-header { font-size: 15px; } .sidebar-menu a { padding: 0 12px; font-size: 14px; } .top-bar { padding: 0 14px; font-size: 14px; } .content-wrap { padding: 12px; } }
@media (max-width: 960px) { .login-wrap { flex-direction: column; height: auto; min-height: 100%; overflow: visible; } .login-visual { flex: none; min-height: 46vh; } .visual-inner { padding: 48px 32px; } .login-panel { min-width: 0; padding: 48px 24px; } }
