/* v4 */
/* v3 */
/* ============================================
   涓栫邯寮虹洓 路 涓�澶�绌鸿皟鎶ヤ环绯荤粺
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif; background: #f0f2f5; color: #333; min-height: 100vh; }

/* 椤堕儴瀵艰埅 */
.top-bar {
  background: linear-gradient(135deg, #1a365d 0%, #2563eb 100%);
  color: white; padding: 12px 24px; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15); position: sticky; top: 0; z-index: 100;
}
.logo { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.nav-tabs { display: flex; gap: 4px; }
.nav-tabs button {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: white; padding: 8px 18px; border-radius: 6px; cursor: pointer;
  font-size: 14px; transition: all .2s;
}
.nav-tabs button:hover { background: rgba(255,255,255,.2); }
.nav-tabs button.active { background: white; color: #2563eb; font-weight: 600; border-color: white; }

/* 椤甸潰瀹瑰櫒 */
.page { max-width: 1400px; margin: 20px auto; padding: 0 16px; }

/* 閰嶇疆闈㈡澘 */
.config-panel {
  background: white; border-radius: 10px; padding: 20px; margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.panel-title {
  font-size: 16px; font-weight: 600; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 2px solid #2563eb; color: #1a365d;
  display: flex; justify-content: space-between; align-items: center;
}

/* 閰嶇疆琛?/ 琛ㄥ崟 */
.config-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px;
  margin-bottom: 8px;
}
.config-row label { font-size: 14px; color: #555; white-space: nowrap; }
.config-row select, .config-row input {
  padding: 6px 10px; border: 1px solid #d0d5dd; border-radius: 6px;
  font-size: 14px; background: white; outline: none; transition: border .2s;
}
.config-row select:focus, .config-row input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.input-xs { width: 70px; }
.input-sm { width: 130px; }
.input-lg { width: 240px; }

.info-row {
  background: #f0f7ff; padding: 10px 16px; border-radius: 6px; margin-top: 10px;
  display: flex; flex-wrap: wrap; gap: 20px; font-size: 14px;
}

/* 琛ㄦ牸 */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 800px;
}
.data-table th {
  background: #f8fafc; padding: 10px 8px; text-align: center;
  font-weight: 600; border-bottom: 2px solid #e2e8f0; color: #475569;
  white-space: nowrap;
}
.data-table td {
  padding: 8px; text-align: center; border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tr:hover td { background: #f8faff; }
.data-table input, .data-table select {
  padding: 4px 6px; border: 1px solid #d0d5dd; border-radius: 4px;
  font-size: 13px; width: 100%; min-width: 60px; outline: none;
}
.data-table input:focus, .data-table select:focus { border-color: #2563eb; }
.data-table .dim-cell { font-size: 12px; color: #666; max-width: 140px; }
.data-table .num { text-align: right; font-family: 'Courier New', monospace; }
.empty-row { color: #aaa; padding: 30px !important; text-align: center !important; }

/* 鎸夐挳 */
.btn-add {
  background: #2563eb; color: white; border: none; padding: 6px 14px;
  border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .2s;
}
.btn-add:hover { background: #1d4ed8; }
.btn-del {
  background: #fee2e2; color: #dc2626; border: none; width: 28px; height: 28px;
  border-radius: 50%; cursor: pointer; font-size: 14px; transition: all .2s;
}
.btn-del:hover { background: #fecaca; }
.btn-print {
  background: #059669; color: white; border: none; padding: 10px 24px;
  border-radius: 8px; cursor: pointer; font-size: 15px; font-weight: 500;
  transition: background .2s;
}
.btn-print:hover { background: #047857; }

/* 姹囨�荤綉鏍?*/
.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.summary-item {
  background: #f8fafc; padding: 14px 18px; border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.summary-item.total { background: #eff6ff; border: 1px solid #bfdbfe; }
.num-lg { font-size: 18px; font-weight: 600; color: #2563eb; font-family: 'Courier New', monospace; }
.num-xl { font-size: 24px; font-weight: 700; color: #dc2626; font-family: 'Courier New', monospace; }

/* 瀹夎�呮柟妗� */
.install-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.install-tabs button {
  padding: 10px 24px; border: 1px solid #d0d5dd; background: white;
  border-radius: 8px; cursor: pointer; font-size: 14px; transition: all .2s;
}
.install-tabs button:hover { border-color: #2563eb; color: #2563eb; }
.install-tabs button.active {
  background: #2563eb; color: white; border-color: #2563eb;
}
.install-content {
  background: white; border-radius: 10px; padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); line-height: 1.8;
  font-size: 14px;
}
.install-content h3 { color: #1a365d; margin: 16px 0 8px; }
.install-content table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.install-content td, .install-content th {
  border: 1px solid #e2e8f0; padding: 8px 12px; text-align: left;
}

/* 鎶ヤ环鍗?*/
.quote-actions { text-align: right; margin-bottom: 16px; }
.quote-sheet {
  background: white; border-radius: 10px; padding: 40px;
  box-shadow: 0 1px 8px rgba(0,0,0,.1); max-width: 900px; margin: 0 auto;
}
.quote-header { text-align: center; margin-bottom: 30px; }
.quote-header h1 { font-size: 24px; color: #1a365d; letter-spacing: 4px; margin-bottom: 6px; }
.quote-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 30px;
  text-align: left; max-width: 600px; margin: 12px auto 0;
  font-size: 14px; color: #555;
}
.quote-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.quote-table th {
  background: #f8fafc; border: 1px solid #e2e8f0; padding: 10px 12px;
  font-size: 13px; text-align: center;
}
.quote-table td {
  border: 1px solid #e2e8f0; padding: 8px 12px; font-size: 13px; text-align: center;
}
.quote-table td.num { text-align: right; font-family: 'Courier New', monospace; }
.quote-summary {
  margin-top: 16px; text-align: right; font-size: 15px; line-height: 2;
}
.quote-summary .grand { font-size: 20px; color: #dc2626; margin-top: 6px; }
.quote-summary .grand-cn { font-size: 14px; color: #666; }
.quote-footer {
  margin-top: 40px; text-align: center; font-size: 13px; color: #888; line-height: 1.8;
}
.quote-footer .slogan { font-size: 16px; color: #2563eb; font-weight: 600; letter-spacing: 2px; margin-top: 4px; }

/* 鍝嶅簲寮?*/
@media (max-width: 768px) {
  .top-bar { flex-direction: column; align-items: flex-start; }
  .nav-tabs { width: 100%; overflow-x: auto; }
  .nav-tabs button { flex: 1; text-align: center; font-size: 12px; padding: 6px 10px; }
  .page { padding: 0 8px; }
  .config-row { flex-direction: column; align-items: stretch; }
  .config-row select, .config-row input { width: 100%; }
  .input-xs, .input-sm, .input-lg { width: 100%; }
  .quote-sheet { padding: 20px; }
}

/* 鎵撳嵃鏍峰紡 */
@media print {
  @page { size: A4; margin: 15mm 18mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: white !important; }
  .top-bar, .quote-actions, .nav-tabs, .btn-print, a[href="/logout"],
  .config-panel, .install-tabs, .install-content, .page:not(#quotePage) {
    display: none !important;
  }
  .page { margin: 0 !important; padding: 0 !important; max-width: 100% !important; }
  .page:not(#quotePage) { display: none !important; }
  #quotePage { display: block !important; }
  .quote-sheet {
    box-shadow: none !important; border-radius: 0 !important;
    padding: 0 !important; max-width: 100% !important; margin: 0 !important;
  }
  .quote-table th { background: #f0f4f8 !important; }
}


/* 瀹夎�呮柟妗堣〃鏍� */
.install-table-wrap { font-size: 13px; overflow-x: auto; }
.install-header { background: linear-gradient(135deg, #1a365d, #2563eb); color: white; padding: 14px 18px; border-radius: 8px 8px 0 0; text-align: center; }
.install-header h3 { margin: 0; font-size: 15px; }
.install-section-title { background: #f0f7ff; font-weight: 600; padding: 10px 14px; margin-top: 8px; color: #1a365d; font-size: 14px; }
.install-row { display: grid; grid-template-columns: 40px 1.3fr 1.8fr 2fr 1.2fr; border-bottom: 1px solid #e2e8f0; align-items: center; }
.install-row.header { background: #f8fafc; font-weight: 600; border-bottom: 2px solid #2563eb; }
.install-row .cell { padding: 8px 10px; border-right: 1px solid #f1f5f9; word-break: break-word; }
.install-row .cell:last-child { border-right: none; }
.install-row .cell.brand-tag { color: #2563eb; font-weight: 500; }
.install-row:nth-child(even):not(.header) { background: #fafbfc; }
.install-footer { text-align: center; padding: 10px; font-size: 14px; color: #2563eb; font-weight: 500; letter-spacing: 1px; }
.quote-brand-area { display: flex; justify-content: center; margin-bottom: 12px; }
.brand-logo { display: flex; align-items: center; gap: 10px; padding: 8px 20px; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0; }
.config-row input[type=\"number\"] { text-align: center; }
@media (max-width: 768px) {
  .install-row { grid-template-columns: 30px 1.1fr 1.4fr 1.5fr 1fr; font-size: 12px; }
  .install-row .cell { padding: 6px 6px; }
}

/* ============================================
   瀹夎�呮柟妗� - 鍥剧墖灞曠ず鏍峰紡
   ============================================ */

.install-row { display: grid; grid-template-columns: 40px 1.2fr 1.5fr 1.8fr 100px 0.8fr; border-bottom: 1px solid #e2e8f0; align-items: center; min-height: 50px; }
.install-row.header { background: #f8fafc; font-weight: 600; border-bottom: 2px solid #2563eb; }
.install-row .cell { padding: 8px 10px; border-right: 1px solid #f1f5f9; word-break: break-word; }
.install-row .cell:last-child { border-right: none; }
.install-row .cell.seq { text-align: center; font-weight: 500; }
.install-row .cell.name { font-weight: 500; color: #1a365d; }
.install-row .cell.spec { font-size: 12px; color: #555; white-space: pre-line; }
.install-row .cell.remark { font-size: 12px; color: #666; white-space: pre-line; }
.install-row .cell.img { text-align: center; }
.install-row .cell.img img { max-width: 80px; max-height: 60px; object-fit: contain; border-radius: 4px; border: 1px solid #e2e8f0; }
.install-row .cell.brand { color: #2563eb; font-weight: 500; text-align: center; }
.install-row:nth-child(even):not(.header) { background: #fafbfc; }

.install-step { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #f0f7ff; margin-top: 10px; border-radius: 6px; border-left: 4px solid #2563eb; }
.step-num { width: 28px; height: 28px; background: #2563eb; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex-shrink: 0; }
.step-name { font-size: 15px; font-weight: 600; color: #1a365d; }

.install-images-row { display: flex; gap: 12px; padding: 10px 14px; flex-wrap: wrap; justify-content: center; }
.install-img-card { flex: 1; min-width: 150px; max-width: 300px; text-align: center; background: white; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.install-img-card img { width: 100%; height: auto; max-height: 180px; object-fit: contain; display: block; }

.install-text { padding: 8px 14px; font-size: 14px; }
.install-footer { text-align: center; padding: 12px; font-size: 15px; color: #2563eb; font-weight: 600; letter-spacing: 1px; background: #f0f7ff; border-radius: 0 0 8px 8px; }

.install-table-wrap { font-size: 13px; overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.install-header { background: linear-gradient(135deg, #1a365d, #2563eb); color: white; padding: 14px 18px; border-radius: 8px 8px 0 0; text-align: center; }
.install-header h3 { margin: 0; font-size: 16px; }
.install-section-title { background: #f0f7ff; font-weight: 700; padding: 10px 14px; color: #1a365d; font-size: 14px; border-bottom: 1px solid #bfdbfe; }

@media (max-width: 768px) {
  .install-row { grid-template-columns: 30px 1fr 1fr 1fr 60px 0.6fr; font-size: 11px; }
  .install-row .cell { padding: 4px 4px; }
  .install-row .cell.img img { max-width: 50px; max-height: 40px; }
  .install-images-row { gap: 6px; justify-content: center; }
  .install-img-card { flex: 1 1 auto; min-width: 0; max-width: 32%; border: none; box-shadow: none; }
  .install-img-card img { height: auto; max-height: 80px; object-fit: contain; }
}



/* ===== 绉诲姩绔�閫傞厤 ===== */
@media (max-width: 768px) {
  .top-bar { flex-direction: column !important; align-items: flex-start !important; padding: 10px 12px !important; gap: 6px !important; }
  .top-bar > div { width: 100%; }
  .nav-tabs { flex-wrap: wrap; gap: 3px; }
  .nav-tabs button { font-size: 12px; padding: 7px 10px; white-space: nowrap; }
  .logo { font-size: 16px !important; }
  .config-row { flex-wrap: wrap !important; gap: 4px !important; }
  .config-row label { min-width: 45px !important; font-size: 12px; }
  .config-row select, .config-row input { font-size: 14px !important; padding: 7px !important; max-width: 90vw !important; }
  .config-row .input-sm { width: 90px !important; }
  .config-row .input-xs { width: 55px !important; }
  .config-row .input-lg { width: 140px !important; }
  .table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; max-width: 100vw !important; }
  .data-table { min-width: 100% !important; width: 100% !important; font-size: 11px; table-layout: auto !important; }
  .data-table th, .data-table td { padding: 4px 2px !important; font-size: 11px !important; white-space: normal; word-break: break-word; }
  .data-table input, .data-table select { font-size: 11px !important; padding: 3px 2px !important; max-width: 100% !important; }
  .data-table .input-xs { width: 40px !important; }
  .data-table .input-sm { width: 60px !important; }
  .quote-table { font-size: 10px !important; min-width: 100% !important; width: 100% !important; table-layout: fixed !important; }
  .quote-table th, .quote-table td { padding: 3px 1px !important; font-size: 10px !important; white-space: normal; word-break: break-word; }
  .config-panel { padding: 10px !important; margin-bottom: 8px !important; }
  .panel-title { font-size: 14px !important; }
  .summary-grid { grid-template-columns: 1fr !important; gap: 6px !important; max-width: 100% !important; }
  .summary-item { font-size: 13px; word-break: break-all; }
  .summary-item.total { font-size: 15px; }
  .num-lg { font-size: 14px !important; }
  .num-xl { font-size: 18px !important; }
  .quote-sheet { padding: 8px !important; max-width: 100% !important; overflow-x: auto !important; }
  .quote-table-wrap { overflow-x: auto !important; max-width: 100vw !important; }
  .quote-header h1 { font-size: 17px !important; }

  .quote-meta { font-size: 11px; }
  .quote-summary { font-size: 12px; }
  .quote-footer { font-size: 11px; }
  .btn-print { font-size: 14px; padding: 8px 16px; }
  .btn-add { font-size: 12px; padding: 5px 10px; }
  .btn-del { font-size: 13px; }
  .install-tabs button { font-size: 12px; padding: 6px 10px; }
  .install-content { max-width: 100vw !important; overflow-x: hidden !important; }
  .install-table-wrap { font-size: 11px; max-width: 100% !important; overflow-x: auto !important; }
  .install-row { grid-template-columns: 28px 0.8fr 1fr 1fr 50px 0.5fr !important; font-size: 10px !important; }
  .install-img-card img { max-height: 80px !important; max-width: 100px !important; }
  .install-images-row { flex-wrap: wrap !important; }
  .cell.img img { max-height: 40px !important; max-width: 50px !important; }
  .brand-logo img { max-width: 100px !important; height: 36px !important; }
  .page { padding: 6px !important; }
  .info-row { font-size: 11px; flex-wrap: wrap; gap: 4px; }
  .install-header h3 { font-size: 13px !important; }
  .install-section-title { font-size: 12px !important; }
  .install-step { font-size: 12px !important; }
}

/* ===== 鎵撳嵃鏍峰紡 ===== */
@media print {
  @page { size: A4; margin: 15mm 18mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body, #app { height: auto !important; overflow: visible !important; }
  body { background: white !important; }
  #app { overflow: hidden !important; }
  .top-bar, .quote-actions, .nav-tabs, .btn-print, .btn-add, .btn-del,
  .config-panel, .install-tabs, .page:not(#quotePage) { display: none !important; }
  .page { margin: 0 !important; padding: 0 !important; }
  #quotePage { display: block !important; overflow: hidden !important; }
  .quote-sheet {
    box-shadow: none !important; border-radius: 0 !important;
    padding: 0 !important; max-width: 100% !important; margin: 0 !important;
    page-break-after: avoid !important;
  }
  .quote-summary, .quote-footer { page-break-inside: avoid !important; }
  .quote-table th { background: #f0f4f8 !important; }
  #installPrintSection { display: block !important; page-break-before: always; padding: 0 10px; }
  #installPrintSection h2 { margin: 10px 0 !important; font-size: 15px !important; }
  #installPrintSection .install-table-wrap { font-size: 10px; }
  #installPrintSection .install-row { grid-template-columns: 22px 0.7fr 0.9fr 0.9fr 50px 0.5fr !important; font-size: 9px !important; }
  #installPrintSection .cell.img img { max-height: 30px; max-width: 40px; }
  #installPrintSection .install-images-row { display: flex !important; flex-direction: row !important; gap: 8px !important; flex-wrap: nowrap !important; justify-content: center !important; }
  #installPrintSection .install-img-card { flex: 1 1 auto !important; min-width: 0 !important; max-width: 32% !important; text-align: center !important; border: none !important; box-shadow: none !important; }
  #installPrintSection .install-img-card img { max-height: 80px; max-width: 100%; width: auto !important; height: auto !important; object-fit: contain !important; }
  #installPrintSection .install-header h3 { font-size: 13px; }
  #installPrintSection .install-section-title { font-size: 11px; }
  #installPrintSection .install-footer, #installPrintSection .install-text { font-size: 10px; }
  .lightbox-overlay { display: none !important; }
}


/* ===== Lightbox ===== */
.lightbox-overlay {
  display: none;
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.88); z-index: 9999;
  justify-content: center; align-items: center; cursor: pointer;
}
.lightbox-overlay.show { display: flex; }
.lightbox-overlay img {
  max-width: 92vw; max-height: 92vh; object-fit: contain;
  border-radius: 6px; box-shadow: 0 4px 30px rgba(0,0,0,0.5);
  cursor: default;
}
.lightbox-close {
  position: fixed; top: 14px; right: 22px;
  color: white; font-size: 34px; font-weight: bold;
  cursor: pointer; z-index: 10000;
}
.cell.img img, .install-img-card img {
  cursor: pointer; transition: opacity .2s;
}
.cell.img img:hover, .install-img-card img:hover { opacity: 0.8; }


/* ===== 移动端图片优化 ===== */
/* 图片响应式缩放 */
.cell.img img, .install-img-card img {
  max-width: 100%;
  height: auto;
  cursor: pointer;
  transition: opacity .3s;
  will-change: opacity;
}
.install-img-card {
  max-width: 100%;
  overflow: hidden;
}
.install-images-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

/* 移动端图片占位，防止布局偏移 */
.cell.img {
  border-radius: 4px;
}

/* 图片加载淡入效果 */
.cell.img img, .install-img-card img {
  /* fade handled by browser */
  animation: imgFadeIn .3s ease forwards;
}
@keyframes imgFadeIn {
  to { opacity: 1; }
}

/* 小屏适配 */
@media (max-width: 768px) {
  .install-images-row {
    grid-template-columns: 1fr;
  }
  .install-img-card {
    max-width: 100%;
  }
  .config-row {
    flex-direction: column;
    align-items: stretch;
  }
  .config-row label {
    margin-top: 6px;
  }
  .config-row select, .config-row input {
    width: 100% !important;
  }
  .input-xs, .input-sm, .input-lg {
    width: 100% !important;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    font-size: 12px;
  }
  .data-table th, .data-table td {
    padding: 6px 8px;
    white-space: nowrap;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .top-bar {
    padding: 10px 12px;
  }
  .nav-tabs button {
    padding: 6px 10px;
    font-size: 12px;
  }
  .page {
    padding: 0 8px;
    margin: 12px auto;
  }
  .config-panel {
    padding: 14px;
  }
  .quote-table {
    font-size: 12px;
  }
  .quote-table th, .quote-table td {
    padding: 6px 8px;
  }
  .quote-sheet {
    padding: 16px;
  }
  .user-menu {
    gap: 4px;
  }
  .user-btn, .admin-link {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
  .logout-btn {
    padding: 4px 8px;
    font-size: 12px;
  }
  .install-tabs button {
    padding: 6px 10px;
    font-size: 12px;
  }
  /* 报价单区域品牌 Logo 缩放 */
  .brand-logo img {
    max-width: 120px !important;
    height: auto !important;
  }
}

/* 大屏优化 */
@media (min-width: 1200px) {
  .install-images-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .install-img-card img {
    max-height: 400px;
    width: auto;
  }
}


/* Image loading optimizations */
.install-img-card img, .cell.img img {
  /* fade handled by browser */
  transition: opacity 0.3s ease-in;
}
/* Mobile: reduce image container padding */
@media (max-width: 768px) {
  .install-img-card { padding: 4px; }
}
@media print {
  .install-img-card img, .cell.img img {
    background: none !important;
    box-shadow: none !important;
  }
  .install-img-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}
