/* ============================================
   轮辐模具查询系统 - 公共基础样式
   所有页面共享：变量/reset/布局/导航/组件
   山东晨华汽车部件有限公司
   ============================================ */

:root {
    --bg: #f2f3f7;
    --card: #ffffff;
    --border: #dde1e6;
    --dark: #161b2d;
    --accent: #b91c2a;
    --accent-hover: #9c1f2b;
    --text: #1e293b;
    --muted: #64748b;
    --sb-bg: #1e2336;
    --header-bg: #1a1e2d;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    height: 100dvh; /* 移动端修正：排除浏览器地址栏 */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ===== Top Bar ===== */
.topbar {
    background: var(--dark);
    color: #fff;
    height: 58px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 800;
    box-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.topbar::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
}
.logo-area {
    display: flex;
    align-items: center;
    gap: 13px;
    text-decoration: none;
    color: #fff;
}
.logo-icon {
    width: 34px; height: 34px;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.logo-text h1 {
    font-size: 16px;
    letter-spacing: 2px;
    font-weight: 600;
    white-space: nowrap;
}
.logo-text span {
    font-size: 10.5px;
    color: rgba(255,255,255,.5);
    display: block; margin-top: 1px;
}
/* 小屏：防止logo挤掉汉堡按钮 */
@media (max-width: 850px) {
    .logo-area { flex-shrink: 1; min-width: 0; }
    .logo-text h1 { font-size: 14px; }
    .logo-text span { display: none; } /* 隐藏副标题省空间 */
}
.top-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.breadcrumb {
    font-size: 12.5px;
    color: rgba(255,255,255,.45);
}
.breadcrumb a { color: rgba(255,255,255,.6); text-decoration: none; margin: 0 4px; }
.breadcrumb a:hover { color: #fff; }

/* hamburger menu */
.nav-toggle {
    display: flex;
    width: 38px; height: 38px;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border: 1.5px solid rgba(255,255,255,.35);
    background: rgba(255,255,255,.08);
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
    z-index: 1000;
}
.nav-toggle span { display: block; width: 18px; height: 2.5px; background: #fff; border-radius: 1px; transition: all .25s; }

/* 桌面端隐藏 */
@media (min-width: 851px) {
    .nav-toggle { display: none; }
}

/* 侧边栏遮罩层：手机端打开时点击空白关闭 */
.sb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 58px;
    background: rgba(0,0,0,.45);
    z-index: 899;
}
.sb-overlay.show { display: block; }

/* ===== Layout ===== */
.layout { display: flex; flex: 1; min-height: 0; overflow: hidden; }

/* ===== Sidebar ===== */
.sidebar {
    width: 220px;
    background: var(--sb-bg);
    color: #b8bfd0;
    flex-shrink: 0;
    padding: 12px 0;
    overflow-y: auto;
    height: 100%;
}
.sb-header {
    padding: 8px 18px 2px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #5a6378;
}
.menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 18px;
    color: #b8bfd0;
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.menu-item:hover { background: #282e44; color: #e8ecf4; }
.menu-item.active {
    background: linear-gradient(90deg, #262c42 0%, #1e2336 60%);
    color: #fff;
    border-left-color: var(--accent);
}

/* CSS icons */
.icon-home {
    width:16px;height:16px;border:1.8px solid currentColor;border-bottom:none;position:relative;display:inline-block
}
.icon-home::before{content:'';position:absolute;top:-6px;left:-3.5px;width:0;height:0;border-left:11.5px solid transparent;border-right:11.5px solid transparent;border-bottom:6px solid currentColor}
.icon-search{
    width:15px;height:15px;border:2px solid currentColor;border-radius:50%;position:relative;display:inline-block
}
.icon-search::after{content:'';position:absolute;bottom:-4.5px;right:-4.5px;width:4.5px;height:2px;background:currentcolor;transform:rotate(45deg)}
.icon-data{
    width:16px;height:16px;border:2px solid currentColor;display:inline-block;position:relative
}
.icon-data::before{content:'';position:absolute;top:50%;left:-2px;right:-2px;height:2px;background:currentColor;transform:translateY(-50%)}
.icon-data::after{content:'';position:absolute;left:50%;top:-2px;bottom:-2px;width:2px;background:currentColor;transform:translateX(-50%)}
.icon-table{width:17px;height:13px;border:1.8px solid currentColor;display:inline-block;position:relative}
.icon-table::before{content:'';position:absolute;top:30%;left:0;right:0;height:1px;background:currentcolor}
.icon-table::after{content:'';position:absolute;top:65%;left:0;right:0;height:1px;background:currentcolor}
.icon-calc{width:16px;height:16px;border:2px solid currentColor;border-radius:3px;display:inline-block;position:relative}
.icon-calc::before{content:'';position:absolute;top:3px;left:2px;right:2px;height:1.5px;background:currentcolor;box-shadow:0 4px 0 currentColor,0 8px 0 currentColor}
.icon-print{width:16px;height:16px;border:2px solid currentColor;border-radius:2px;display:inline-block;position:relative}
.icon-print::before{content:'';position:absolute;top:4px;left:50%;width:6px;height:1.5px;background:currentColor;margin-left:-3px;box-shadow:0 3px 0 currentColor,0 -5px 0 currentColor}
.icon-nejing{width:16px;height:16px;border:2px solid currentColor;border-radius:50%;display:inline-block;position:relative}
.icon-nejing::before{content:'';position:absolute;top:50%;left:50%;width:8px;height:8px;border:1.5px solid currentColor;transform:translate(-50%,-50%);border-radius:50%}
.icon-unit{width:16px;height:16px;border:1.5px solid currentColor;border-radius:2px;display:inline-block;position:relative}
.icon-unit::before{content:'⇆';position:absolute;top:-4px;left:-3px;font-size:9px;line-height:1;color:currentColor}
.icon-cad{width:16px;height:16px;border:2px solid currentColor;border-radius:3px;display:inline-block;position:relative}
.icon-cad::before{content:'';position:absolute;top:50%;left:2px;width:10px;height:1.5px;background:currentColor;margin-top:-.75px;box-shadow:0 3px 0 currentColor,0 -3px 0 currentColor}
.icon-cad::after{content:'';position:absolute;left:3px;top:3px;width:8px;height:7px;border:1px solid currentColor;border-bottom:none;border-radius:3px 3px 0 0}
.icon-user{width:16px;height:16px;border:2px solid currentColor;border-radius:50%;display:inline-block;position:relative}
.icon-user::before{content:'';position:absolute;top:2px;left:50%;width:6px;height:5px;border:1.5px solid currentColor;border-bottom:none;border-radius:50% 50% 0 0;transform:translateX(-50%)}
.icon-user::after{content:'';position:absolute;bottom:2px;left:50%;width:8px;height:4px;background:currentColor;border-radius:50% 50% 0 0;transform:translateX(-50%) translateY(1px)}

/* ===== Main Content Area ===== */
.main {
    flex: 1;
    padding: 24px 28px 50px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.page-title {
    font-size: 19px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-title::before {
    content: '';
    width: 4px; height: 20px;
    background: var(--accent);
    display: inline-block;
    flex-shrink: 0;
}

/* info chips */
.info-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.info-chip {
    display: inline-flex;
    align-items: center; gap: 6px;
    padding: 7px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}
.info-chip strong { color: var(--dark); font-weight: 600; }

/* empty state */
.empty-msg {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 16px;
}

/* upload form hidden input */
.upload-input { display: none; }

/* footer - 始终固定在视口底部 */
.site-footer {
    padding: 14px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    background: var(--bg);
    position: fixed;
    bottom: 0;
    left: 220px;
    right: 0;
    z-index: 10;
}
/* 主内容区底部留空，防止被fixed footer遮挡 */

/* lightbox overlay */
.lb-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,17,27,.95);
    z-index: 9999;
}
.lb-overlay.active { display: flex; align-items: center; justify-content: center; }
.lb-box { position: relative; max-width: 96vw; max-height:92vh; }
.lb-box img { max-width:96vw; max-height:82vh; display:block; border:1px solid #333; }
.lb-caption { color:#aab0c0; text-align:center; padding:12px 0; font-size:14px; background:#12151f; border-top:1px solid #222; }
.lb-close {
    position:absolute; top:-40px; right:0; width:36px; height:36px; line-height:34px;
    text-align:center; color:#ccc; font-size:26px; cursor:pointer;
    background:#2a2e3d; border:1px solid #444; transition:background .15s;
}
.lb-close:hover { background:var(--accent); color:#fff; border-color:var(--accent); }
.lb-nav-arrow {
    position:absolute; top:50%; width:48px;height:48px;margin-top:-24px;
    background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);
    color:#ccc;font-size:24px;cursor:pointer;display:flex;align-items:center;
    justify-content:center;z-index:2;
}
.lb-nav-arrow:hover{background:rgba(255,255,255,.15);color:#fff;}
.lb-prev{left:-60px;} .lb-next{right:-60px;}

/* toast notification */
.toast-wrap {
    position: fixed;
    top: 72px; right: 20px;
    z-index: 10000;
}
.toast-item {
    padding: 10px 20px;
    margin-bottom: 8px;
    font-size: 13.5px;
    color: #fff;
    animation: toastIn .25s ease;
    max-width: 340px;
}
.toast-ok { background: #15803d; }
.toast-err { background: #b91c2a; }
.toast-info { background: #1d4ed8; }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ===== User Dropdown ===== */
.user-area {
    position: relative;
    margin-left: auto;
}
.user-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.75);
    padding: 5px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: border-color .15s, color .15s;
}
.user-btn:hover { border-color: rgba(255,255,255,.4); color: #fff; }
.user-name { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-arrow { font-size: 10px; opacity: .6; }

.user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 180px;
    background: #fff;
    border: 1px solid var(--border);
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.user-menu.show { display: block; }
.user-menu-info {
    padding: 12px 14px;
    background: #f7f8fa;
}
.user-menu-label {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 2px;
}
.user-menu-info strong {
    font-size: 14px;
    color: #1a1e2d;
}
.user-menu-divider {
    height: 1px;
    background: var(--border);
}
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: #dc2626;
    text-decoration: none;
    font-size: 13px;
    transition: background .12s;
}
.user-menu-item:hover { background: #fef2f2; }
.user-menu-item-normal {
    color: #334155;
}
.user-menu-item-normal:hover { background: #f1f5f9; }

/* 移动端用户区：只显示图标 */
@media (max-width: 850px) {
    .user-name { display: none; }
    .user-arrow { display: none; }
    .user-btn { padding: 6px 9px; }
}
.top-login-btn {
    font-size: 13px;
    color: #fff;
    background: #b91c2a;
    text-decoration: none;
    padding: 5px 16px;
    margin-left: auto;
    border: 0;
    transition: background .15s;
}
.top-login-btn:hover { background: #991b1b; }

/* ===== Responsive (公共) ===== */
@media (max-width: 850px) {
    .breadcrumb { display: none; }
    .sidebar {
        position: fixed;
        left: -240px; top: 58px; bottom: 0;
        z-index: 900;
        transition: left .25s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,.3);
    }
    .sidebar.open { left: 0; }
    .main { padding: 18px 14px 50px; }
    .site-footer { left: 0; }
}
