/* ════════════════════════════════════════
   群华通讯报价系统 - Shell 布局样式
   左侧竖向导航栏 + 右侧顶部标签栏
════════════════════════════════════════ */

* { margin:0; padding:0; box-sizing:border-box; }
body.shell-body {
  font-family: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: #f8fafc;
}

/* ════════════════════════════════════════
   左侧竖向导航栏
════════════════════════════════════════ */
.sidebar {
  width: 210px;
  min-width: 210px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  z-index: 200;
  transition: margin-left 0.25s ease, opacity 0.2s ease;
  position: relative;
}
/* 自动隐藏状态 */
.sidebar.collapsed {
  margin-left: -210px;
}
/* 悬停触发区域 */
.sidebar-hover-zone {
  position: fixed;
  left: 0;
  top: 0;
  width: 8px;
  height: 100vh;
  z-index: 201;
  cursor: pointer;
}
/* 非隐藏时不需要触发区 */
.sidebar:not(.collapsed) + .sidebar-hover-zone,
.sidebar.collapsed:hover + .sidebar-hover-zone {
  pointer-events: none;
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar-logo-text {
  font-size: 14px; font-weight: 700;
  line-height: 1.3;
}
.sidebar-logo-sub {
  font-size: 10px; color: #94a3b8;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.nav-group {
  margin-bottom: 2px;
}
.nav-group-title {
  padding: 8px 16px 4px;
  font-size: 10px;
  color: #64748b;
  letter-spacing: 1px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.nav-group-title:hover {
  color: #94a3b8;
}
.group-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
  line-height: 1;
}
.nav-group.collapsed .group-arrow {
  transform: rotate(-90deg);
}
.nav-group.collapsed .nav-item {
  display: none;
}

.nav-item {
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #cbd5e1;
  transition: all 0.15s ease;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(14,165,233,0.2), rgba(14,165,233,0.05));
  color: #38bdf8;
  border-left: 3px solid #0ea5e9;
  margin-left: 5px;
}
.nav-item .nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: #64748b;
  text-align: center;
}
.sidebar-footer .staff-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: default;
}
.sidebar-footer .staff-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.sidebar-footer .staff-info { flex: 1; text-align: left; }
.sidebar-footer .staff-name { color: #e2e8f0; font-size: 12px; font-weight: 600; }
.sidebar-footer .staff-role { color: #64748b; font-size: 10px; }
.sidebar-footer .logout-link {
  color: #64748b;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s;
}
.sidebar-footer .logout-link:hover {
  color: #ef4444;
}

/* ════════════════════════════════════════
   右侧主区域
════════════════════════════════════════ */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ════════════════════════════════════════
   顶部标签栏
════════════════════════════════════════ */
.tab-bar {
  height: 42px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tab-scroll {
  flex: 1;
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tab-scroll::-webkit-scrollbar { display: none; }

.tab {
  padding: 0 12px 0 14px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-right: 1px solid #f1f5f9;
  font-size: 12.5px;
  color: #64748b;
  background: #f8fafc;
  white-space: nowrap;
  transition: all 0.15s;
  position: relative;
}
.tab:hover { background: #f1f5f9; }
.tab.active {
  background: #fff;
  color: #0f172a;
  font-weight: 600;
  border-bottom: 2px solid #0ea5e9;
}
.tab.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #0ea5e9;
}
.tab .tab-icon { font-size: 14px; }
.tab .tab-close {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px;
  font-size: 14px;
  line-height: 1;
  color: #94a3b8;
  margin-left: 4px;
}
.tab .tab-close:hover {
  background: #e2e8f0;
  color: #ef4444;
}

.tab-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border-left: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.tab-action-btn {
  padding: 5px 10px;
  font-size: 11px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-action-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.tab-action-btn.danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

/* ════════════════════════════════════════
   内容区域（iframe）
════════════════════════════════════════ */
.content-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #f1f5f9;
}
.content-frame {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
  background: #fff;
  display: none;
}
.content-frame.active {
  display: block;
}

/* 空状态提示 */
.empty-state {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #94a3b8;
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; }

/* ════════════════════════════════════════
   移动端侧边栏遮罩
════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}
.sidebar-overlay.show {
  display: block;
}

/* ════════════════════════════════════════
   打印样式：隐藏 shell 元素
════════════════════════════════════════ */
@media print {
  .sidebar, .tab-bar, .sidebar-toggle, .sidebar-overlay { display: none !important; }
  .main-area { margin-left: 0 !important; }
  .content-area { position: static !important; }
  .content-frame { position: static !important; width: 100% !important; height: auto !important; }
}

/* ════════════════════════════════════════
   响应式：移动端侧边栏收起
════════════════════════════════════════ */
/* ════════════════════════════════════════
   侧边栏切换按钮（桌面端 + 移动端通用）
════════════════════════════════════════ */
.sidebar-toggle {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 300;
  width: 36px; height: 36px;
  background: #1e293b; color: #fff;
  border: none; border-radius: 6px;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: opacity 0.2s, left 0.25s;
  opacity: 0.5;
}
.sidebar-toggle:hover { opacity: 1; }
/* 侧边栏展开时隐藏按钮 */
.sidebar-toggle.sidebar-open { opacity: 0; pointer-events: none; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: -210px; top: 0; bottom: 0;
    transition: left 0.3s;
    z-index: 300;
    margin-left: 0 !important;
  }
  .sidebar.collapsed { margin-left: 0; }
  .sidebar.open { left: 0; }
  .sidebar-toggle { opacity: 0.7; }
  .sidebar-toggle.sidebar-open { opacity: 0; pointer-events: none; }
  .main-area { margin-left: 0; }
  .sidebar-hover-zone { display: none; }
}
@media (min-width: 769px) {
  .sidebar-toggle { display: none; }
}
