/* ============================================
   设备质保/维护系统 - 公共样式
   供 index.html / maintenance.html / print.html / upload.html 引用
   仅包含四页字节级一致的装饰与导航样式；各页面局差异保留在原页面内联样式中
   ============================================ */

/* 全局重置 */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* 兼容各深色页面：阻止移动端回弹（rubber-band）后露出的黑色画布空白。
   overscroll-behavior 停用回弹；html 兜底底色让旧版 iOS 边缘回弹也显示主题色而非纯黑 */
html {
    background: #0A0F24;
    overscroll-behavior-y: none;
}
body {
    overscroll-behavior-y: none;
}

/* 背景光晕脉动动画（被各页 body::after 引用，keyframes 为全局作用域） */
@keyframes pulse {
    0% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.5; transform: scale(1); }
}

/* 玻璃卡片渐变描边（纯装饰） */
.glass-card::before {
    content: '';
    position: absolute; inset: 0; padding: 1px; border-radius: inherit;
    background: linear-gradient(135deg, rgba(34,211,238,0.6), rgba(139,92,246,0.6), rgba(236,72,153,0.55));
    -webkit-mask: linear-gradient(#000,#000) content-box, linear-gradient(#000,#000);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}
.glass-card::after {
    content: '';
    position: absolute; left: 8%; right: 8%; top: 0; height: 3px;
    background: linear-gradient(90deg, #22d3ee, #8b5cf6, #ec4899);
    border-radius: 0 0 3px 3px;
    filter: drop-shadow(0 2px 4px rgba(139,92,246,0.4));
    z-index: 3;
}

/* 登出按钮（通用，供侧边栏使用） */
.logout-btn {
    margin-left: auto;
    padding: 10px 16px; border-radius: 40px; font-size: 0.8rem; font-weight: 700; cursor: pointer;
    background: linear-gradient(90deg, #f43f5e, #e11d48); color: #fff;
    border: none; box-shadow: 0 4px 12px rgba(244, 63, 94, 0.35); transition: all 0.2s;
    font-family: inherit;
}
.logout-btn:hover { background: linear-gradient(90deg, #e11d48, #be123c); color: #fff; box-shadow: 0 6px 16px rgba(244, 63, 94, 0.45); }

/* 移动端顶栏：仅汉堡按钮 + 标题（页面切换统一走侧边栏） */
.mobile-topbar {
    display: none;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    box-sizing: border-box;
    position: relative;
    z-index: 6;
}
.mobile-topbar-title {
    flex: 1; text-align: center;
    font-size: 0.95rem; font-weight: 700; letter-spacing: 0.5px;
    background: linear-gradient(120deg, #22d3ee, #818cf8 45%, #ec4899);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================
   侧边导航栏
   桌面端（≥900px）常驻左侧；移动端收起为汉堡抽屉
   ============================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 236px;
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
    background: rgba(248, 250, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 2px 0 28px rgba(15, 23, 42, 0.18);
    z-index: 1002;
    overflow-y: auto;
    gap: 6px;
}
.sidebar-brand {
    font-size: 1.05rem; font-weight: 800; letter-spacing: 0.5px;
    background: linear-gradient(120deg, #0891b2, #6366f1 45%, #db2777);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    padding: 10px 12px 18px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    margin-bottom: 10px;
    white-space: nowrap;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 14px; text-decoration: none;
    font-size: 0.9rem; font-weight: 700; color: #334155;
    border: 1px solid transparent; transition: all 0.2s; white-space: nowrap;
}
.sidebar-nav a:hover { background: rgba(99, 102, 241, 0.12); color: #1e293b; transform: translateX(2px); }
.sidebar-nav a.active {
    background: linear-gradient(90deg, #22d3ee, #818cf8);
    color: #fff; border-color: transparent;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}
.sidebar-footer {
    display: flex; flex-direction: column; gap: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.1); padding-top: 14px;
}
.sidebar-footer .lang-switch { justify-content: center; }
.sidebar .logout-btn { width: 100%; text-align: center; }

/* 汉堡按钮（仅移动端显示） */
.menu-toggle {
    display: none;
    width: auto; min-width: 0; padding: 8px 14px; font-size: 1.1rem; line-height: 1;
    background: rgba(248, 250, 255, 0.15); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 40px;
    cursor: pointer; transition: all 0.2s;
}
.menu-toggle:hover { background: rgba(248, 250, 255, 0.3); }

.sidebar-backdrop { display: none; }

/* 桌面端收起按钮（由 common.js 注入到侧边栏右上角） */
.sidebar-collapse {
    display: none;
    position: absolute; top: 18px; right: 12px;
    width: 30px; height: 30px; min-width: 0; padding: 0;
    align-items: center; justify-content: center;
    font-size: 0.85rem; line-height: 1; border-radius: 10px;
    background: rgba(99, 102, 241, 0.1); color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.2); cursor: pointer;
    transition: all 0.2s;
}
.sidebar-collapse:hover { background: rgba(99, 102, 241, 0.2); color: #4338ca; }

/* 桌面端侧边栏收起后，屏幕左缘的展开按钮（竖向胶囊 + 脉动提示，便于发现） */
.sidebar-expand {
    display: none;
    position: fixed; top: 50%; left: 0; transform: translateY(-50%);
    z-index: 1000;
    width: auto; height: 58px; min-width: 0; padding: 6px 12px;
    flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font-size: 1rem; line-height: 1; font-weight: 700;
    color: #fff;
    background: linear-gradient(180deg, #22d3ee, #818cf8);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0 18px 18px 0;
    box-shadow: 3px 0 18px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    animation: sidebarExpandPulse 2s ease-in-out infinite;
    transition: all 0.2s;
}
.sidebar-expand .expand-icon { font-size: 1.4rem; line-height: 1; text-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.sidebar-expand .expand-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 1px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.sidebar-expand:hover { background: linear-gradient(180deg, #22d3ee, #8b5cf6); color: #fff; transform: translateY(-50%) translateX(2px); }
@keyframes sidebarExpandPulse {
    0%, 100% { box-shadow: 3px 0 18px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(34, 211, 238, 0.55); }
    50% { box-shadow: 3px 0 18px rgba(0, 0, 0, 0.4), 0 0 0 10px rgba(34, 211, 238, 0); }
}

/* 桌面端：侧边栏常驻，内容区右移让位（利用原本的左右空白），移动顶栏隐藏 */
@media (min-width: 900px) {
    /* 用 html > body 提高优先级，避免被各页面内联 body { padding: 20px } 覆盖导致侧边栏遮挡内容 */
    html > body { padding-left: 252px; }
    html > body.sidebar-collapsed { padding-left: 0; }
    .mobile-topbar { display: none; }
    .sidebar { transition: transform 0.3s ease; }
    .sidebar-collapse { display: flex; }
    .sidebar.collapsed { transform: translateX(-100%); }
    .sidebar-expand { display: none; }
    .sidebar-expand.show { display: flex; }
}

/* 移动端：侧边栏收起为抽屉，仅显示汉堡顶栏 */
@media (max-width: 899px) {
    body { padding-left: 0; }
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; width: 240px; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        display: none; position: fixed; inset: 0;
        background: rgba(0, 0, 0, 0.45); z-index: 1001;
        backdrop-filter: blur(2px);
    }
    .sidebar-backdrop.show { display: block; }
    .menu-toggle { display: inline-flex; }
    .mobile-topbar { display: flex; }
    .sidebar-collapse, .sidebar-expand { display: none; }
}

/* 打印时隐藏侧边栏与顶栏，恢复内容区宽度 */
@media print {
    .sidebar, .sidebar-backdrop, .menu-toggle, .mobile-topbar { display: none !important; }
    body { padding-left: 0 !important; }
}