/* ============================================================
   张力弧垂计算 - 样式
   ============================================================ */

/* 主容器 */
.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px;
}

.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 20px;
  margin-bottom: 16px;
}

/* Tab导航 */
/* 标签导航（对齐 yijiyice_backup .tabs 样式）*/
.tabs {
  display: flex;
  background: #fff;
  border-bottom: 2px solid #cfd8dc;
  padding: 0 20px;
  overflow-x: auto;
  height: 42px;
  align-items: stretch;
}
/* 隐藏水平滚动条（保留滑动功能）*/
.tabs::-webkit-scrollbar {
  display: none;
}
.tabs {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tab {
  padding: 11px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #546e7a;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab:hover {
  color: #1565c0;
  background: #e3f2fd;
}

.tab.on {
  color: #1565c0;
  border-bottom-color: #1565c0;
}

/* 工程下拉菜单（对齐 yijiyice .dropdown）
   注意：.tabs 有 overflow-x:auto，会裁剪 position:absolute 的子元素，
   故菜单必须用 position:fixed（与 yijiyice 一致），
   top/left 由 app.js toggleDropdown 按 .dropdown 实际 rect 动态计算。*/
.dropdown {
  position: static;
}
.dropdown .tab {
  line-height: 42px;
  padding-top: 0;
  padding-bottom: 0;
}
.dropdown .tab:hover {
  background: #e3f2fd !important;
}
.dropdown-menu {
  display: none;
  position: fixed;
  top: 116px;
  left: 20px;
  background: #fff;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  z-index: 100;
  min-width: 140px;
  overflow: hidden;
}
.dropdown-menu.open {
  display: block;
}
.dropdown-menu a {
  display: block;
  padding: 10px 18px;
  color: #263238;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.1s;
  white-space: nowrap;
}
.dropdown-menu a:hover {
  background: #e3f2fd;
  color: #1565c0;
}

/* 工程名标签（对齐 yijiyice .project-badge：深蓝底白字）*/
.project-badge {
  margin-left: 8px;
  font-size: 12px;
  color: #fff;
  background: #1565c0;
  border-radius: 4px;
  padding: 5px 12px;
  align-self: center;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Tab面板（直接位于 .wrap 内，无 .card 包裹，自带内边距）*/
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 20px;
  margin-bottom: 16px;
}

/* 面板头部 */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.wrap h2 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.wrap h3 {
  margin: 0;
  font-size: 16px;
  color: #555;
  margin-bottom:10px;
}

/* 按钮 */
.btn-primary {
  padding: 8px 18px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #357abd;
}

.btn-del {
  padding: 4px 12px;
  background: #ff5252;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.btn-del:hover {
  background: #d32f2f;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
}

.table-scroll {
  max-height: 600px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  text-align: center;
  white-space: nowrap;
}

th {
  background: #f5f7fa;
  font-weight: 600;
  color: #333;
  position: sticky;
  top: 0;
  z-index: 1;
}

.result-table th {
  background: #e8f0fe;
  color: #4a90d9;
}

/* 条件名列 */
.cond-name {
  text-align: left;
  font-weight: 500;
  background: #fafafa;
  min-width: 120px;
}

/* 张力行和弧垂行 */
.row-force td {
  background: #fff8e1;
}

.row-sag td {
  background: #e8f5e9;
}

/* 定位系数行 */
.row-dingwei td {
  background: #f3e5f5;
}

/* 张力特性与放线表 */
.row-control td { background: #e3f2fd; }
.row-span td { background: #dce8f8; font-weight: 600; }
.row-slash td { background: #f5f5f5; color: #666; }
.row-colhint td { background: #eceff1; font-weight: 600; text-align: center; }
.row-stringing td { background: #ffffff; }

/* 张力特性与放线表：文字不加粗（代表档距行除外）/ 单元格居中 / 列宽收紧 */
#wrap-charstr {
  max-height: none;    /* 取消 600px 高度上限：分段后所有行、列完整展示 */
}

#wrap-charstr > table {
  width: auto;
  table-layout: auto;
}

#wrap-charstr > table + table {
  margin-top: 4px;     /* 分段之间的细分隔 */
}

#wrap-charstr th,
#wrap-charstr td {
  padding: 3px 6px;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
}

#wrap-charstr .cond-name {
  min-width: 0;
  width: 1%;
  text-align: center;
  font-weight: 400;
}

#wrap-charstr .row-span td,
#wrap-charstr .row-control td,
#wrap-charstr .row-colhint td,
#wrap-charstr .row-force td,
#wrap-charstr .row-dingwei td,
#wrap-charstr .row-slash td,
#wrap-charstr .row-stringing td {
  font-weight: 400;
  text-align: center;
}

/* 代表档距行加粗 */
#wrap-charstr .row-span td {
  font-weight: 700;
}

/* ============ 导线型号可搜索下拉（1-导线选择） ============ */
.hc-picker {
  position: relative;
  min-width: 150px;
}
.hc-picker > input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 12px;
  box-sizing: border-box;
}
.hc-picker > input:focus {
  border-color: #4a90d9;
  outline: none;
}
/* 原 select 保留数据与事件，仅隐藏 */
.hc-picker > select { display: none; }
.hc-picker-list {
  /* 挂到 body 的浮层：fixed + JS 动态定位，规避表格 overflow 裁剪 */
  position: fixed;
  z-index: 3000;
  min-width: 200px;
  max-width: 460px;
  max-height: 260px;
  overflow-y: auto;
  /* 滚到边界时不要把整个页面一起滚走 */
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid #cfd8dc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.16);
  text-align: left;
}
.hc-picker-opt {
  padding: 6px 10px;
  font-size: 12px;
  color: #37474f;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
}
.hc-picker-opt:last-child { border-bottom: none; }
.hc-picker-opt:hover { background: #e3f2fd; color: #1565c0; }
.hc-picker-opt.on { background: #e8f0fe; font-weight: 600; }
.hc-picker-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: #90a4ae;
}

/* 导线库/气象库编辑表格 */
.lib-input, .wx-input {
  width: 100%;
  padding: 3px 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 12px;
  min-width: 60px;
  box-sizing: border-box;
}

.lib-input:focus, .wx-input:focus {
  border-color: #4a90d9;
  outline: none;
}

/* 7-气象库：前 6 列（气象名称~区号）居中 + 固定 100px；说明列居左 */
#tbl-weather-lib th.wx-col,
#tbl-weather-lib td.wx-num {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
  text-align: center;
}
#tbl-weather-lib th.wx-col {
  box-sizing: border-box;
}
#tbl-weather-lib td.wx-num {
  box-sizing: border-box;
  padding: 3px 4px;
}
#tbl-weather-lib td.wx-num .wx-input {
  text-align: center;
  padding: 3px 2px;
  min-width: 0;
}
#tbl-weather-lib td.wx-num select.wx-input {
  text-align: center;
  text-align-last: center;
}
#tbl-weather-lib td.wx-num input[type="number"] {
  text-align: center;
}
#tbl-weather-lib th.wx-desc-col,
#tbl-weather-lib td.wx-desc {
  text-align: left;
}
/* 窄屏下略微收窄，避免横向溢出 */
@media (max-width: 768px) {
  #tbl-weather-lib th.wx-col,
  #tbl-weather-lib td.wx-num {
    width: 68px;
    min-width: 68px;
    max-width: 68px;
  }
}

/* 气象库「说明」列：长文案换行显示 */
.wx-desc {
  min-width: 260px;
  max-width: 460px;
  font-size: 12px;
  line-height: 1.6;
  color: #555;
  white-space: normal;
  word-break: break-word;
  padding: 3px 6px;
}

@media (max-width: 768px) {
  .wx-desc { min-width: 160px; font-size: 11px; }
}

.btn-secondary {
  padding: 8px 18px;
  background: #43a047;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #2e7d32;
}

/* 导线选择表 */
#tbl-wire-select select,
#tbl-wire-select input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  box-sizing: border-box;
  max-width: 100%;
}

#tbl-wire-select select {
  min-width: 120px;
}

#tbl-wire-select input[type="number"] {
  width: 80px;
  min-width: 60px;
}

#tbl-wire-select th {
  white-space: nowrap;
}

#tbl-wire-select td {
  max-width: 200px;
}

/* 收窄「平均高度 / 地面粗糙度 / 保证率 / 降温补偿」4 列：内容都很短
   （15/20/25、A~D类、1/0.95、0~25），统一 min-width:120 会把表撑到 1393px
   导致 .table-wrap 出现横向滚动条。让这 4 列 th 允许换行、select 收到 64px、
   td/th padding 收紧到 4px 6px（默认 8px 12px）。 */
#tbl-wire-select th:nth-child(4),
#tbl-wire-select th:nth-child(5),
#tbl-wire-select th:nth-child(8),
#tbl-wire-select th:nth-child(10) {
  white-space: normal;
  line-height: 1.2;
  padding: 4px 4px;
  text-wrap: balance;
}
#tbl-wire-select td:nth-child(4) select,
#tbl-wire-select td:nth-child(5) select,
#tbl-wire-select td:nth-child(8) select,
#tbl-wire-select td:nth-child(10) select {
  width: 60px;
  min-width: 52px;
  padding-left: 4px;
  padding-right: 4px;
}
#tbl-wire-select td:nth-child(4),
#tbl-wire-select td:nth-child(5),
#tbl-wire-select td:nth-child(8),
#tbl-wire-select td:nth-child(10) {
  padding: 4px 4px;
}

/* 导线详情 */
.wire-detail {
  margin-top: 16px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
}

/* 每根导线一个详情分组（标题「线缆N参数详情」）*/
.wire-detail-group {
  margin-bottom: 16px;
}

.wire-detail-group:last-child {
  margin-bottom: 0;
}

.wire-detail-group h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #555;
}

/* 参数网格：固定 6 列 → 12 项字段正好 2 行 */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 10px;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #eee;
  min-width: 0;              /* 允许网格子项收缩，避免长字段撑破格子 */
}

.detail-label {
  color: #666;
  font-size: 13px;
  white-space: nowrap;       /* 标签不折行 */
  flex: 0 0 auto;
}

.detail-value {
  font-weight: 600;
  color: #333;
  font-size: 13px;
  min-width: 0;
  text-align: right;
  word-break: break-word;    /* 长型号名允许在任意处断行 */
}

/* 控制栏 */
.char-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.char-controls label {
  font-weight: 500;
  color: #555;
  white-space: nowrap;
}

.char-controls select,
.char-controls input {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

/* 张力特性与放线表 控制条：数字输入框统一窄宽度 45px */
.char-controls input[type="number"] {
  width: 45px;
  min-width: 45px;
}

/* 比载表 - 不适用项灰色显示 */
.cell-muted {
  color: #ccc;
  background: #fafafa;
}

/* 比载表 - 高亮项 */
.cell-highlight {
  font-weight: 600;
  color: #1565c0;
  background: #e3f2fd;
}

/* 特性曲线图 */
.chart-wrap {
  margin-top: 20px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.chart-title {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
}

.chart-container {
  position: relative;
  height: 630px;
  width: 100%;
}

/* 放线表双列表头 */
#tbl-str th[rowspan="2"] {
  vertical-align: middle;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #e8f0fe;
}

#tbl-str th[colspan="2"] {
  text-align: center;
  background: #d0e3f7;
}

/* 结果框 */
.result-box {
  padding: 16px;
}

.result-box .hint {
  color: #999;
  text-align: center;
  padding: 40px 0;
}

/* 参数网格响应式：6 列在窄屏依次降为 4 / 3 / 2 列 */
@media (max-width: 1280px) {
  .detail-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 响应式 */
@media (max-width: 768px) {
  /* 手机：单列卡片式，标签在上、数值在下（横向并排会被挤断行并撑破屏幕）*/
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .detail-item {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;
    padding: 8px 12px;
    min-width: 0;
  }
  .detail-label {
    flex: 0 0 auto;
    white-space: normal;      /* 允许长标签自然换行 */
    font-size: 12px;
    color: #8a97a5;
    line-height: 1.4;
  }
  .detail-value {
    text-align: left;         /* 纵向堆叠后不再需要右对齐 */
    font-size: 15px;           /* 手机上数值放大更好读 */
    line-height: 1.4;
    white-space: nowrap;       /* 数字绝不折行 */
    word-break: keep-all;
    font-variant-numeric: tabular-nums;
  }
  .wire-detail {
    margin-top: 12px;
    padding: 12px;
  }
  .wire-detail-group {
    margin-bottom: 14px;
  }
  .wire-detail-group h3 {
    font-size: 15px;
    margin-bottom: 8px;
  }
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .char-controls {
    width: 100%;
  }
  .tab {
    padding: 8px 12px;
    font-size: 13px;
  }
  .project-badge {
    font-size: 11px;
    padding: 3px 6px;
  }
  .stress-result-grid {
    grid-template-columns: 1fr;
  }
}

/* 超小屏（iPhone SE 等）：进一步压缩间距与字号 */
@media (max-width: 480px) {
  .wire-detail {
    padding: 10px;
  }
  .detail-item {
    padding: 7px 10px;
  }
  .detail-label {
    font-size: 11px;
  }
  .detail-value {
    font-size: 14px;
  }
}

/* ============================================================
   工程管理（对话框 / 工程列表）— 菜单与徽章已并入 .tabs 第 0 项
   ============================================================ */
/* 对话框（对齐 yijiyice .modal / .modal .mdl）*/
.proj-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.proj-modal.on {
  display: flex;
}

.proj-modal-box {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  padding: 24px;
  width: 90%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
}

.proj-modal-box h3 {
  margin: 0 0 14px;
  font-size: 16px;
  color: #2c3e50;
}

.proj-label {
  display: block;
  font-size: 13px;
  color: #555;
  margin: 8px 0 6px;
}

.proj-modal-box input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.proj-modal-box input[type="text"]:focus {
  outline: none;
  border-color: #4a90d9;
}

.proj-modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.proj-list {
  max-height: 320px;
  overflow-y: auto;
}

.proj-empty {
  text-align: center;
  padding: 20px;
  color: #546e7a;
  font-size: 14px;
}

/* 工程列表项（对齐 yijiyice .project-item：列表式，仅下边框线）*/
.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #cfd8dc;
  transition: background 0.15s;
  cursor: pointer;
}

.project-item:last-child {
  border-bottom: none;
}

.project-item:hover {
  background: #e3f2fd;
}

.pj-name {
  font-weight: 500;
  font-size: 14px;
  color: #263238;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pj-time {
  font-size: 11px;
  color: #546e7a;
  margin-top: 2px;
}

.proj-item-ops {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.proj-item-ops button {
  background: #2196f3;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 12px;
}

.proj-item-ops button.danger {
  background: #e53935;
}
