/**
 * FastQuote 寰宇货代 - 公共布局样式
 * 所有页面通过 HTML注入中间件自动引入
 */

/* ==================== 字体（本地引入，不依赖 Google CDN） ==================== */
/* Material Symbols Outlined 字体通过 material-symbols.css 本地引入 */
/* Noto Sans SC / Plus Jakarta Sans fallback 到系统 sans-serif */

/* ==================== 基础重置 ==================== */
html {
  width: 100% !important;
  height: auto !important;
  overflow-x: hidden !important;
  position: relative;
}

body {
  margin: 0;
  font-family: 'Noto Sans SC', sans-serif;
  background: #f7f9fb;
  -webkit-font-smoothing: antialiased;
}

/* ==================== Material Symbols ==================== */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  transition: font-variation-settings 0.2s ease;
}

.nav-item:hover .material-symbols-outlined,
.active-nav-item .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ==================== 侧边栏滚动条 ==================== */
.custom-scrollbar::-webkit-scrollbar,
.sidebar-scroll::-webkit-scrollbar {
  width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track,
.sidebar-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}
.custom-scrollbar::-webkit-scrollbar-thumb,
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* ==================== 玻璃边框 ==================== */
.glass-border {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==================== 中台侧边栏 active 状态 ==================== */
.active-nav-item {
  position: relative;
}
.active-nav-item .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

/* ==================== 前台侧边栏 active 状态 ==================== */
.nav-item-active {
  background-color: rgba(178, 247, 70, 0.1);
  color: #b2f746 !important;
  border-left: 4px solid #A3E635;
}
.nav-item-active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ==================== 顶部栏角标 ==================== */
.active-icon-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background-color: #ba1a1a;
  border-radius: 50%;
  border: 2px solid white;
}

/* ==================== 内容区布局（统一强制，覆盖各页面自定义样式） ==================== */
/* 登录页使用 .login-main 类，不受全局 main 规则影响 */
main:not(.login-main) {
  margin-left: 260px !important;
  padding-top: 64px !important;
  padding-bottom: 80px !important;
  min-height: 100vh !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  overflow: visible !important;
  flex: none !important;
  display: block !important;
}

/* page-header 标题栏：和内容区域同宽，靠 px-gutter 对齐 */
.page-header-component {
  border-radius: 0 !important;
}

/* ==================== 通用卡片样式 ==================== */
.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(6, 38, 27, 0.04);
}

.stat-num {
  font-size: 32px;
  font-weight: 700;
  color: #06261b;
}

.stat-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

/* ==================== 表格通用样式 ==================== */
.fq-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(6, 38, 27, 0.04);
}
.fq-table th {
  background: #f2f4f6;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.fq-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: #1A2E28;
  border-top: 1px solid #e5e7eb;
}
.fq-table tr:hover td {
  background: #f9fafb;
}

/* ==================== 按钮通用样式 ==================== */
.fq-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.fq-btn-primary {
  background: #06261b;
  color: #fff;
}
.fq-btn-primary:hover {
  opacity: 0.9;
}
.fq-btn-secondary {
  background: #f2f4f6;
  color: #1A2E28;
}
.fq-btn-secondary:hover {
  background: #e6e8ea;
}
.fq-btn-danger {
  background: #ba1a1a;
  color: #fff;
}
.fq-btn-danger:hover {
  opacity: 0.9;
}

/* ==================== 状态标签 ==================== */
.fq-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}
.fq-badge-success { background: rgba(0, 169, 122, 0.1); color: #00A97A; }
.fq-badge-warning { background: rgba(255, 107, 61, 0.1); color: #FF6B3D; }
.fq-badge-error { background: rgba(186, 26, 26, 0.1); color: #ba1a1a; }
.fq-badge-info { background: rgba(70, 101, 87, 0.1); color: #466557; }
.fq-badge-default { background: #f2f4f6; color: #64748b; }

/* ==================== 输入框通用样式 ==================== */
.fq-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #c1c8c3;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.fq-input:focus {
  border-color: #00A97A;
  box-shadow: 0 0 0 2px rgba(0, 169, 122, 0.1);
}

/* ==================== 分页样式 ==================== */
.fq-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
}
.fq-pagination button {
  padding: 6px 12px;
  border: 1px solid #c1c8c3;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: #1A2E28;
}
.fq-pagination button:hover {
  background: #f2f4f6;
}
.fq-pagination button.active {
  background: #06261b;
  color: #fff;
  border-color: #06261b;
}
.fq-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==================== 弹窗样式 ==================== */
.fq-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.fq-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.fq-modal h3 {
  font-size: 18px;
  font-weight: 700;
  color: #06261b;
  margin: 0 0 16px;
}

/* ==================== Toast 通知 ==================== */
.fq-toast {
  position: fixed;
  top: 80px;
  right: 24px;
  padding: 12px 24px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  z-index: 99999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: fq-toast-in 0.3s ease;
}
@keyframes fq-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 768px) {
  aside {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  aside.show {
    transform: translateX(0);
  }
}

/* ========================================================================
   FQ 表格系统 v2 — 统一列宽自适应 + 图标操作按钮 + 统一分页
   使用方式：给 <table> 加 class="fq-tbl" 即可启用全部能力
   ======================================================================== */

/* ---- 列宽自适应：table-layout:fixed + colgroup 比例分配 ---- */
.fq-tbl {
  width: 100% !important;
  border-collapse: collapse;
  table-layout: fixed;             /* 关键：启用固定布局，列宽由 colgroup 控制 */
  background: #fff;
  display: table !important;       /* 显式声明 display:table，防止被其他 CSS 覆盖为 block 导致竖向排列 */
}
.fq-tbl thead { display: table-header-group !important; }
.fq-tbl tbody { display: table-row-group !important; }
.fq-tbl tr { display: table-row !important; }
.fq-tbl td { display: table-cell !important; }
.fq-tbl th {
  background: #f2f4f6;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 对齐修正：.fq-tbl th 的 text-align:left 优先级高于页面上的 text-center/text-right，
   需按类名显式放行，否则表头永远左对齐、与列内容错位 */
.fq-tbl th.text-center { text-align: center; }
.fq-tbl th.text-right  { text-align: right; }
.fq-tbl th.text-left   { text-align: left; }
.fq-tbl td {
  padding: 14px 16px;
  font-size: 14px;
  color: #1A2E28;
  border-top: 1px solid #e5e7eb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;   /* 垂直居中：修复表头与内容、图标按钮与同行文字不在一条水平线 */
}
.fq-tbl tr:hover td {
  background: #f9fafb;
}
/* 允许某些列内容换行/完整展示（加 .fq-cell-wrap 到 td 上） */
.fq-tbl td.fq-cell-wrap {
  white-space: normal;
  word-break: break-word;
  overflow: visible;    /* 覆盖 td 默认 overflow:hidden，防按钮等内容被裁剪 */
}
/* 空行/暂无数据行（带 colspan 的 td）自动居中 */
.fq-tbl td[colspan] {
  text-align: center !important;
}

/* ---- 筛选区统一图标按钮（重置/刷新等，纯图标方钮） ----
   使用方式：<button class="fq-icon-btn" title="重置"><span class="material-symbols-outlined text-[18px]">restart_alt</span></button>
*/
.fq-icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c1c8c3; /* outline-variant */
  border-radius: 0.5rem;
  background: #fff;
  color: #475556; /* text-text-secondary */
  cursor: pointer;
  flex: none;
  transition: background-color 0.2s, color 0.2s;
}
.fq-icon-btn:hover {
  background: #f0f2f1; /* surface-container-low */
  color: #06261b; /* text-primary */
}
.fq-icon-btn .material-symbols-outlined {
  font-size: 18px;
}

/* ---- 邮箱导出按钮（公共导出组件，配合 FQ.showSendDataModal 使用） ----
   使用方式：<button class="fq-export-btn" onclick="exportList()"><span class="material-symbols-outlined text-[18px]">outgoing_mail</span>邮箱导出</button>
*/
.fq-export-btn {
  height: 2.5rem;
  padding: 0 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #c1c8c3; /* outline-variant */
  border-radius: 0.5rem;
  background: #fff;
  color: #06261b; /* text-primary */
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex: none;
  transition: background-color 0.2s;
}
.fq-export-btn:hover {
  background: #f0f2f1; /* surface-container-low */
}
.fq-export-btn .material-symbols-outlined {
  font-size: 18px;
}

/* ---- 图标操作按钮组 ---- */
.fq-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}
.fq-actions .fq-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  position: relative;
}
.fq-actions .fq-act .material-symbols-outlined {
  font-size: 20px;
}
.fq-actions .fq-act:hover {
  background: #f2f4f6;
  color: #06261b;
}
.fq-actions .fq-act.fq-act-primary:hover { background: rgba(0,169,122,0.1); color: #00A97A; }
.fq-actions .fq-act.fq-act-danger:hover  { background: rgba(186,26,26,0.1); color: #ba1a1a; }
.fq-actions .fq-act.fq-act-warn:hover   { background: rgba(255,107,61,0.1); color: #FF6B3D; }

/* "更多"下拉触发按钮 */
.fq-actions .fq-act-more {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.fq-actions .fq-act-more:hover {
  background: #f2f4f6;
  color: #06261b;
}
.fq-actions .fq-act-more .material-symbols-outlined {
  font-size: 20px;
}

/* 下拉菜单容器 */
.fq-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  padding: 4px 0;
  min-width: 160px;
  z-index: 100;
  display: none;
}
.fq-dropdown.open { display: block; }
.fq-dropdown .fq-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: #1A2E28;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease;
}
.fq-dropdown .fq-dropdown-item:hover {
  background: #f2f4f6;
}
.fq-dropdown .fq-dropdown-item .material-symbols-outlined {
  font-size: 18px;
  color: #64748b;
}
.fq-dropdown .fq-dropdown-item.danger { color: #ba1a1a; }
.fq-dropdown .fq-dropdown-item.danger .material-symbols-outlined { color: #ba1a1a; }

/* 操作列宽度固定 */
.fq-tbl .fq-col-actions {
  width: 140px;       /* 默认操作列宽度，页面可按按钮数量微调 */
  text-align: right;
}

/* 操作列：允许 tooltip 浮出，不受 td overflow:hidden 裁剪 */
.fq-tbl td.fq-col-actions,
.fq-tbl td:has(.fq-actions) {
  overflow: visible;
}

/* ---- 统一分页 ---- */
.fq-pager,
.fq-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid #e5e7eb;
  background: #fafbfc;
}
.fq-pager-info,
.fq-pg-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #64748b;
}
/* 每页条数选择器容器 */
.fq-pg-sizer-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #64748b;
  order: 2;                     /* 条数选择器在分页按钮左侧 */
  margin-left: auto;            /* 吸收剩余空间，和分页按钮一起靠右 */
}
/* 每页条数选择器 */
.fq-pg-size {
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  color: #1A2E28;
  background: #fff;
  cursor: pointer;
  outline: none;
}
.fq-pg-size:focus {
  border-color: #00A97A;
}
.fq-pager-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  order: 3;                     /* 分页按钮在条数选择器右侧 */
  margin-left: 12px;            /* 紧挨条数选择器右侧 */
}
.fq-pager-btns button {
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #1A2E28;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fq-pager-btns button:hover:not(.active):not(:disabled) {
  background: #f2f4f6;
  border-color: #c1c8c3;
}
.fq-pager-btns button.active {
  background: #06261b;
  color: #fff;
  border-color: #06261b;
  font-weight: 600;
}
.fq-pager-btns button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.fq-pager-btns button .material-symbols-outlined {
  font-size: 20px;
}

/* ---- 操作按钮 tooltip 功能提示 ---- */
.fq-actions .fq-act[data-tip]::after,
.fq-actions .fq-act-more[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #06261b;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  line-height: 1.4;
}
.fq-actions .fq-act[data-tip]::before,
.fq-actions .fq-act-more[data-tip]::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #06261b;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 200;
}
.fq-actions .fq-act[data-tip]:hover::after,
.fq-actions .fq-act[data-tip]:hover::before,
.fq-actions .fq-act-more[data-tip]:hover::after,
.fq-actions .fq-act-more[data-tip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.fq-actions .fq-act[data-tip]:hover::after {
  transform: translateX(-50%) translateY(-2px);
}

/* ========================================================================
   FQ 表格 — 鼠标悬停复制按钮
   使用方式：在 renderRow 中调用 FQTable.copyable(text, displayHtml)
   ======================================================================== */
.fq-copy-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
}
.fq-copy-cell .fq-copy-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fq-copy-btn {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  padding: 0;
}
.fq-copy-cell:hover .fq-copy-btn {
  opacity: 1;
}
.fq-copy-btn:hover {
  background: #e6e8ea;
  color: #06261b;
}
.fq-copy-btn .material-symbols-outlined {
  font-size: 13px;
  line-height: 1;
}
.fq-copy-btn.copied {
  color: #00A97A;
  opacity: 1;
}
.fq-copy-btn.copied .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

/* ==================== page-header 间距修正 ==================== */
/* 确保 page-header 紧贴顶部导航栏，无额外间距 */
.page-header-component {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
