/* ============================================
   轮辐模具查询系统 - 公共基础样式
   所有页面共享：变量/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)}
/* 激光切割图标 - 光束样式 */
.icon-laser{width:16px;height:16px;border:2px solid currentColor;border-radius:50%;display:inline-block;position:relative}
.icon-laser::before{content:'';position:absolute;top:50%;left:50%;width:4px;height:4px;background:currentColor;border-radius:50%;transform:translate(-50%,-50%)}
.icon-laser::after{content:'';position:absolute;top:0;left:50%;width:2px;height:100%;background:currentColor;transform:translateX(-50%)}
/* 轮辋图标 - 环形齿轮样式 */
.icon-rim{width:16px;height:16px;border:2px solid currentColor;border-radius:50%;display:inline-block;position:relative}
.icon-rim::before{content:'';position:absolute;top:50%;left:50%;width:10px;height:10px;border:1.5px solid currentColor;border-radius:50%;transform:translate(-50%,-50%)}
.icon-rim::after{content:'';position:absolute;top:50%;left:50%;width:3px;height:3px;background:currentColor;border-radius:50%;transform:translate(-50%,-50%)}
/* 轮辐/圆盘图标 - 辐条样式 */
.icon-disc{width:16px;height:16px;border:2px solid currentColor;border-radius:50%;display:inline-block;position:relative}
.icon-disc::before{content:'';position:absolute;top:50%;left:50%;width:10px;height:10px;border:1.5px solid currentColor;border-radius:50%;transform:translate(-50%,-50%)}
.icon-disc::after{content:'';position:absolute;top:0;left:50%;width:1.5px;height:100%;background:currentColor;transform:translateX(-50%);box-shadow:0 0 0 currentColor}
/* 注意事项图标 - 感叹号样式 */
.icon-note{width:16px;height:16px;border:2px solid currentColor;border-radius:3px;display:inline-block;position:relative}
.icon-note::before{content:'!';position:absolute;top:50%;left:50%;font-size:11px;font-weight:700;line-height:1;color:currentColor;transform:translate(-50%,-55%)}
/* 模具图标 - 齿轮样式 */
.icon-mold{width:16px;height:16px;border:2px solid currentColor;border-radius:50%;display:inline-block;position:relative}
.icon-mold::before{content:'';position:absolute;top:50%;left:50%;width:5px;height:5px;background:currentColor;border-radius:50%;transform:translate(-50%,-50%);box-shadow:-5px 0 0 currentColor,5px 0 0 currentColor,0 -5px 0 currentColor,0 5px 0 currentColor}
.icon-mold::after{content:'';position:absolute;top:50%;left:50%;width:5px;height:5px;background:currentColor;border-radius:50%;transform:translate(-50%,-50%);box-shadow:-3.5px -3.5px 0 currentColor,3.5px -3.5px 0 currentColor,-3.5px 3.5px 0 currentColor,3.5px 3.5px 0 currentColor}
/* 考勤图标 - 时钟样式 */
.icon-attendance{width:16px;height:16px;border:2px solid currentColor;border-radius:50%;display:inline-block;position:relative}
.icon-attendance::before{content:'';position:absolute;top:50%;left:50%;width:2px;height:5px;background:currentColor;transform:translate(-50%,-100%)}
.icon-attendance::after{content:'';position:absolute;top:50%;left:50%;width:5px;height:2px;background:currentColor;transform:translate(0,-50%)}

/* ===== Submenu 子分类菜单 ===== */
.menu-group { }
/* 父级有子菜单激活时，去掉左侧竖杠避免和子项连成一条线 */
.menu-group.active .menu-parent { border-left-color: transparent !important; }
.menu-parent { cursor: pointer; position: relative; }
.sub-arrow {
    margin-left: auto; font-size: 10px;
    opacity: .5; transition: transform .3s ease;
    display: inline-block; flex-shrink: 0;
}
.menu-group.active .sub-arrow,
.menu-group.open .sub-arrow { transform: rotate(180deg); opacity: 1; }
.submenu {
    background: rgba(0,0,0,.1);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    transition: max-height .3s ease, opacity .28s ease, padding-top .3s ease, padding-bottom .3s ease;
}
.submenu.show {
    max-height: 300px;
    opacity: 1;
}
.menu-child {
    padding: 9px 18px 9px 46px !important;
    font-size: 13px !important;
    border-left-color: transparent !important;
    color: #94a3b8 !important;
    position: relative;
}
.menu-child::before {
    content: '';
    position: absolute; left: 32px; top: 50%;
    width: 5px; height: 1px;
    background: #4a5568;
}
.menu-child:hover { background: #282e44; color: #c8d1e4 !important; }
.menu-child.active {
    background: linear-gradient(90deg, #262c42, #1e2336);
    color: #fff !important;
    border-left-color: var(--accent) !important;
}
/* 页面加载时自动展开当前激活项的子菜单 —— 通过PHP输出.show类实现，不再依赖active */

/* ===== Main Content Area ===== */
.main {
    flex: 1;
    padding: 24px 28px 44px 28px;  /* bottom ≈ footer 高度，避免内容被遮 */
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}
/* 占位块：flex 纵向滚动时容器 padding-bottom 不生效，
   用一个不可收缩的 spacer 顶开底部，防止内容被固定 footer 遮挡 */
.main::after {
    content: '';
    display: block;
    flex: 0 0 0;  /* padding-bottom 已足够顶开 footer，不再需要额外 spacer */
    width: 100%;
}

.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;}
/* Lightbox 删除按钮 */
.lb-delete {
    position:absolute; bottom:-44px; right:0; width:36px; height:36px;
    background:transparent; border:1px solid rgba(239,68,68,.35); color:rgba(239,68,68,.7);
    cursor:pointer; display:flex; align-items:center; justify-content:center;
    border-radius:4px; transition:all .15s;
}
.lb-delete:hover { background:rgba(239,68,68,.15); color:#ef4444; border-color:#ef4444; }

/* 确认弹窗 */
.cfm-overlay {
    position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:99999;
    display:flex; align-items:center; justify-content:center;
    animation: cfmFadeIn .15s ease;
}
.cfm-box {
    background:#1e2130; border:1px solid #333; border-radius:10px;
    padding:28px 32px; max-width:400px; width:90%;
    box-shadow:0 20px 60px rgba(0,0,0,.5);
}
.cfm-msg { color:#cdd1de; font-size:15px; line-height:1.7; margin:0 0 22px; white-space:pre-wrap; }
.cfm-btns { display:flex; gap:12px; justify-content:flex-end; }
.cfm-btn {
    padding:8px 20px; border-radius:6px; font-size:14px; cursor:pointer;
    border:1px solid #444; transition:all .15s;
}
.cfm-btn-cancel { background:#2a2e3d; color:#aab0c0; }
.cfm-btn-cancel:hover { background:#363b4f; color:#fff; }
.cfm-btn-ok { background:#dc2626; color:#fff; border-color:#dc2626; }
.cfm-btn-ok:hover { background:#ef4444; }
@keyframes cfmFadeIn { from{opacity:0} to{opacity:1} }

/* 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; }

/* ===== 无权限页面（统一美观UI）===== */
.no-permission-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 58px - 80px); /* 顶栏+页脚 */
    padding: 40px 20px;
}
.np-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 56px 48px 44px;
    text-align: center;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 4px 24px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
    animation: npFadeIn .35s ease;
}
@keyframes npFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.np-icon {
    width: 72px; height: 72px;
    margin: 0 auto 28px;
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    border: 2px solid #fecaca;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc2626;
}
.np-icon svg {
    width: 36px; height: 36px;
}
.np-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 10px;
    letter-spacing: .3px;
}
.np-desc {
    font-size: 14.5px;
    color: var(--muted);
    margin: 0 0 32px;
    line-height: 1.6;
}
.np-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.np-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all .18s;
    font-family: inherit;
    border: 1.5px solid transparent;
    white-space: nowrap;
}
.np-btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(185,28,42,.25);
}
.np-btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(185,28,42,.35);
    transform: translateY(-1px);
}
.np-btn-outline {
    background: var(--card);
    color: var(--text);
    border-color: var(--border);
}
.np-btn-outline:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}
.np-hint {
    font-size: 12.5px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.5;
}
.np-hint strong {
    color: #64748b;
    font-weight: 600;
}

/* ===== 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; }
    .np-card { padding: 40px 24px 32px; }
    .np-icon { width: 60px; height: 60px; margin-bottom: 20px; }
    .np-icon svg { width: 30px; height: 30px; }
    .np-title { font-size: 17px; }
}
