/* ========================================================
   矩形钢管截面缩尺自动化设计系统 — 样式表 (公网版)
   ======================================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    background: #f0f2f5;
    color: #2c3e50;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Navbar ---------- */
.navbar {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; height: 56px;
    background: linear-gradient(135deg, #1a365d, #2b6cb0);
    color: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,.18);
}
.nav-brand {
    font-size: 1.2rem; font-weight: 700; letter-spacing: .5px;
    display: flex; align-items: center; gap: 8px;
    white-space: nowrap;
}
.nav-icon { font-size: 1.4rem; }
.nav-links { display: flex; gap: 4px; }
.nav-link {
    padding: 7px 16px; border-radius: 7px;
    color: rgba(255,255,255,.75); text-decoration: none;
    font-size: .9rem; font-weight: 500;
    transition: all .2s;
}
.nav-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.22); color: #fff; }
.nav-mobile-toggle {
    display: none; font-size: 1.5rem; cursor: pointer;
    padding: 4px 8px; border-radius: 6px;
}
.nav-mobile-toggle:hover { background: rgba(255,255,255,.15); }

/* ---------- App Container ---------- */
.app-container { max-width: 1480px; margin: 0 auto; padding: 24px 20px 40px; flex: 1; width: 100%; }

/* ---------- Tab Pane ---------- */
.tab-pane { display: none; animation: fadeIn .25s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Content Grid (3-column) ---------- */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 22px;
}

/* ---------- Card ---------- */
.card {
    background: #fff; border-radius: 14px; padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
    transition: box-shadow .25s;
}
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.09); }
.card-wide  { max-width: 1000px; margin: 0 auto; }
.card-narrow { max-width: 800px; margin: 0 auto; }

.card-title {
    font-size: 1.25rem; font-weight: 700; margin-bottom: 18px;
    display: flex; align-items: center; gap: 8px;
}
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.blue   { background: #3182ce; }
.dot.green  { background: #38a169; }
.dot.orange { background: #dd6b20; }

.sub-title {
    font-size: 1.02rem; font-weight: 600; color: #34495e;
    margin: 18px 0 10px;
}

/* ---------- Form ---------- */
.form-group { margin-bottom: 13px; }
.form-group label {
    display: block; margin-bottom: 4px;
    font-weight: 600; font-size: .86rem; color: #4a5568;
}
.form-group input, .batch-textarea {
    width: 100%; padding: 9px 12px;
    border: 1.5px solid #d1d9e6; border-radius: 7px;
    font-size: .92rem; color: #2c3e50;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus, .batch-textarea:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49,130,206,.12);
}
.batch-textarea {
    font-family: 'Consolas', 'SF Mono', 'Courier New', monospace;
    font-size: .86rem; resize: vertical; line-height: 1.5;
}
.batch-desc { margin-bottom: 12px; color: #5a6c7d; font-size: .9em; }

.params-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.weight-row {
    display: grid; grid-template-columns: 1fr 80px; gap: 8px;
    align-items: center; margin-bottom: 10px;
}
.weight-row label { font-size: .85rem; font-weight: 500; margin: 0; color: #4a5568; }
.weight-row input { padding: 7px 10px; font-size: .88rem; border: 1.5px solid #d1d9e6; border-radius: 7px; }
.weight-row input:focus { outline: none; border-color: #3182ce; box-shadow: 0 0 0 3px rgba(49,130,206,.12); }

/* ---------- Toggle Switch ---------- */
.switch-row {
    margin-top: 16px; display: flex; align-items: center;
    justify-content: space-between;
    padding: 10px 14px; background: #f7fafc;
    border: 1px solid #e2e8f0; border-radius: 8px;
}
.switch-row > label:first-child { font-weight: 600; font-size: .9rem; color: #2d3748; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
    position: absolute; inset: 0;
    background: #cbd5e0; border-radius: 24px;
    transition: .25s;
}
.toggle .slider::before {
    content: ''; position: absolute; width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%;
    transition: .25s; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle input:checked + .slider { background: #3182ce; }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* ---------- Buttons ---------- */
.btn-group { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.btn {
    padding: 10px 20px; border: none; border-radius: 8px;
    font-size: .92rem; font-weight: 600; cursor: pointer;
    transition: all .2s; letter-spacing: .3px;
    display: inline-flex; align-items: center; gap: 4px;
}
.btn.primary {
    background: linear-gradient(135deg, #3182ce, #2b6cb0);
    color: #fff;
}
.btn.primary:hover { box-shadow: 0 4px 14px rgba(49,130,206,.35); transform: translateY(-1px); }
.btn.accent {
    background: linear-gradient(135deg, #38a169, #2f855a);
    color: #fff;
}
.btn.accent:hover { box-shadow: 0 4px 14px rgba(56,161,105,.35); transform: translateY(-1px); }
.btn.ghost {
    background: transparent; border: 1.5px solid #a0aec0;
    color: #4a5568;
}
.btn.ghost:hover { background: #edf2f7; }
.btn.ghost.danger { border-color: #e53e3e; color: #e53e3e; }
.btn.ghost.danger:hover { background: #fff5f5; }
.btn.small { padding: 7px 14px; font-size: .84rem; }

/* ---------- Result Area ---------- */
.result-toolbar { display: flex; gap: 10px; margin-bottom: 14px; }

.result-item {
    background: #f7faf9; padding: 14px 16px; border-radius: 10px;
    margin-bottom: 12px; border-left: 4px solid #38a169;
}
.result-item h4 { font-size: .98rem; color: #2d3748; margin-bottom: 6px; }
.result-value { font-size: 1.02rem; font-weight: 700; color: #38a169; line-height: 1.6; }

.placeholder-text { text-align: center; color: #a0aec0; font-style: italic; padding: 30px 0; }

/* ---------- Comparison Table ---------- */
.comparison-table {
    width: 100%; border-collapse: collapse; margin-top: 16px;
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 1px 8px rgba(0,0,0,.05);
}
.comparison-table th, .comparison-table td {
    padding: 9px 10px; text-align: center;
    border-bottom: 1px solid #e2e8f0; font-size: .87rem;
}
.comparison-table th {
    background: linear-gradient(135deg, #2d3748, #1a365d);
    color: #fff; font-weight: 600;
}
.comparison-table tr:hover { background: #f7fafc; }

.err-good   { color: #38a169; font-weight: 600; }
.err-medium { color: #d69e2e; font-weight: 600; }
.err-bad    { color: #e53e3e; font-weight: 600; }

/* ---------- Chart & Sketch ---------- */
.chart-box, .sketch-box {
    margin-top: 16px; padding: 14px;
    border: 1px solid #e2e8f0; border-radius: 10px;
    background: #fafcff;
}
#errorChart { width: 100%; border-radius: 6px; }
#sketchCanvas { width: 100%; border-radius: 6px; display: block; }

/* ---------- Info Box ---------- */
.info-box {
    margin-top: 14px; padding: 14px;
    background: #ebf8ff; border-radius: 8px; border: 1px solid #bee3f8;
    font-size: .84rem; color: #2a4365; line-height: 1.55;
}

/* ---------- Warning ---------- */
.warning-box {
    background: #fffff0; border: 1px solid #fefcbf;
    color: #744210; padding: 12px 16px; border-radius: 8px;
    margin-top: 14px; font-size: .88rem;
}

/* ---------- Help ---------- */
.help-content h3 { margin: 20px 0 8px; color: #2b6cb0; font-size: 1.05rem; }
.help-content p, .help-content li { font-size: .92rem; line-height: 1.7; color: #3d4f5f; }
.help-content ol, .help-content ul { padding-left: 22px; margin-bottom: 10px; }
.help-content code {
    background: #edf2f7; padding: 2px 7px; border-radius: 4px;
    font-size: .86rem; color: #2d3748;
}
.formula-box {
    background: #f7fafc; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 14px 18px; margin-top: 8px; font-size: .9rem; line-height: 1.8;
    color: #2d3748;
}

/* ---------- History ---------- */
.history-item {
    padding: 12px 16px; border-radius: 8px; background: #f7fafc;
    margin-bottom: 10px; cursor: pointer;
    border: 1px solid #e2e8f0; font-size: .88rem; line-height: 1.5;
    transition: all .2s;
}
.history-item:hover { border-color: #90cdf4; background: #ebf8ff; }
.history-item .hi-time { font-weight: 600; color: #2b6cb0; }
.history-item .hi-err  { float: right; font-weight: 700; }

/* ---------- Footer ---------- */
.footer {
    text-align: center; padding: 18px 20px;
    font-size: .82rem; color: #a0aec0;
    border-top: 1px solid #e2e8f0; background: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .navbar { padding: 0 14px; }
    .nav-brand { font-size: 1rem; }
    .nav-links { 
        display: none; 
        position: absolute; top: 56px; left: 0; right: 0;
        background: #1a365d; flex-direction: column;
        padding: 12px; gap: 4px; z-index: 99;
        box-shadow: 0 8px 20px rgba(0,0,0,.2);
    }
    .nav-links.open { display: flex; }
    .nav-mobile-toggle { display: block; }
    .params-grid { grid-template-columns: 1fr; }
    .result-toolbar { flex-direction: column; }
    .app-container { padding: 14px 10px 30px; }
    .card { padding: 18px; }
}
