/* ── pipe-notching.css — MetalWeightPro ─────────────────────────────────────
 * Loaded on pipe-notching.html (Pipe Notching Calculator) only.
 * Injected by build.js getCssLinks() via TOOL_CSS_FILES['pipe-notching.html'].
 * Always loaded AFTER base style.css — inherits all CSS variables and tokens.
 * ─────────────────────────────────────────────────────────────────────────── */

/* ═══════════════════════════════════════════════════════════════
   PIPE NOTCHING CALCULATOR
   ═══════════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────────── */
.notch-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.notch-panel--inputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.notch-panel--output {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  position: sticky;
  top: var(--space-md);
}

/* ── Groups (card containers on left panel) ─────────────────── */
.notch-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
}

.notch-group__label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ── 2-column input grid ────────────────────────────────────── */
.notch-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm) var(--space-md);
}

.notch-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* min-height ensures both columns in each row have identical
   label height regardless of text wrapping — FIX #4 */
.notch-field__label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  min-height: 2.4em;
  display: flex;
  align-items: flex-end;
}

.notch-field__hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Unit toggle buttons — FIX #3 ──────────────────────────── */
.notch-unit-btn {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--tr);
}

.notch-unit-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.notch-unit-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* ── Angle slider ───────────────────────────────────────────── */
.notch-angle-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 6px;
}

.notch-angle-slider {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.notch-angle-display {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.notch-angle-num {
  width: 56px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  text-align: center;
}

.notch-angle-unit {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
}

.notch-angle-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Error banner ───────────────────────────────────────────── */
.notch-error[hidden],
.notch-result-stats[hidden] { display: none !important; }

.notch-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.85rem;
  color: #f87171;
}

.notch-error__icon { flex-shrink: 0; }

/* ── Result stats (left panel) ──────────────────────────────── */
.notch-result-stats {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.notch-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notch-stat__label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.notch-stat__value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

/* ── Tabbed output box (right panel) — FIX #2 ──────────────── */
.notch-output-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.notch-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.notch-tab {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px 20px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color var(--tr), border-color var(--tr);
}

.notch-tab:hover { color: var(--text-primary); }

.notch-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.notch-tab-panel { display: block; }
.notch-tab-panel[hidden] { display: none !important; }

/* ── 3D canvas ──────────────────────────────────────────────── */
.notch-3d__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.notch-3d__title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  flex: 1;
}

.notch-3d__hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.notch-3d__reset {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--tr);
}

.notch-3d__reset:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.notch-3d__canvas {
  width: 100%;
  height: 340px;
  display: block;
}

/* ── Template panel ─────────────────────────────────────────── */
.notch-template__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.notch-template__title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  flex: 1;
}

.notch-template__status {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.notch-template__svg-wrap {
  padding: var(--space-md);
  min-height: 200px;
  overflow-x: auto;
}

.notch-template__svg-wrap svg {
  max-width: 100%;
  height: auto;
}

.notch-tile-info {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(232,149,42,0.08);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.notch-tile-info__icon {
  color: var(--accent);
  flex-shrink: 0;
}

.notch-template__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-top: 1px solid var(--border);
}

/* ── Action buttons ─────────────────────────────────────────── */
.notch-action-btn {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--tr);
  text-align: center;
}

.notch-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.notch-action-btn--pdf {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.notch-action-btn--pdf:hover {
  background: #d4841f;
  border-color: #d4841f;
  color: #000;
}

/* ── Print — notch page only ────────────────────────────────── */
@media print {
  .notch-panel--inputs,
  .notch-tabs,
  .notch-tile-info,
  .notch-template__actions,
  .notch-3d { display: none !important; }

  .notch-layout  { display: block !important; }
  .notch-panel--output { width: 100% !important; }
  .notch-output-box { border: none !important; }
  .notch-tab-panel { display: block !important; }
  .notch-template__svg-wrap { padding: 0 !important; }
  body { background: #fff !important; }
}

/* ── Responsive — tablet ────────────────────────────────────── */
@media (max-width: 900px) {
  .notch-layout {
    grid-template-columns: 1fr;
  }

  .notch-panel--output {
    position: static;
  }
}

/* ── Responsive — mobile ────────────────────────────────────── */
@media (max-width: 480px) {
  .notch-inputs-grid {
    grid-template-columns: 1fr;
  }

  .notch-template__actions {
    grid-template-columns: 1fr;
  }

  .notch-field__label {
    min-height: unset; /* single column — no alignment needed */
  }
}
