/* ========================================
   EntireCalc — Shared Calculator UI
   Used by all construction (and future) tools
   ======================================== */

.calculator-page {
  padding: 40px 0 60px;
}

.calculator-page h1 {
  font-size: 2rem;
  color: #1e3a5f;
  margin-bottom: 8px;
  text-align: center;
}

.calculator-page .subtitle {
  text-align: center;
  color: #4a5568;
  margin-bottom: 8px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.updated-line {
  text-align: center;
  font-size: 0.82rem;
  color: #4a5568;
  margin-bottom: 30px;
}

.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-bottom: 30px;
}

.tabs {
  display: flex;
  background: #edf2f7;
  border-bottom: 1px solid #e2e8f0;
}

.tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: none;
  font-size: 0.95rem;
  color: #4a5568;
  transition: all 0.2s;
}

.tab.active {
  background: white;
  color: #2b6cb0;
  border-bottom: 3px solid #2b6cb0;
}

.tab:hover:not(.active) {
  background: #e2e8f0;
}

.tab-content {
  display: none;
  padding: 28px;
}

.tab-content.active {
  display: block;
}

/* Non-tab calculator forms (e.g. Stair) — same padding as tab panels */
.form-section {
  padding: 28px;
}

@media (max-width: 600px) {
  .form-section {
    padding: 20px 16px;
  }
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2b6cb0;
  margin: 8px 0 14px;
}

.form-section .section-label:first-child {
  margin-top: 0;
}


.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .tabs {
    flex-direction: column;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary, #2d3748);
}

.input-row {
  display: flex;
  gap: 8px;
}

input[type="number"],
select {
  padding: 12px 14px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

input[type="number"].field-error {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12);
}

select {
  background: white;
  cursor: pointer;
  min-width: 110px;
}

.field-error-msg {
  font-size: 0.78rem;
  color: #e53e3e;
  margin-top: 4px;
  min-height: 14px;
}

.form-error-banner {
  display: none;
  background: #fff5f5;
  border: 1px solid #feb2b2;
  color: #c53030;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.form-error-banner.show {
  display: block;
}

.pricing-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.pricing-toggle button {
  flex: 1;
  padding: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid #cbd5e0;
  background: white;
  color: #4a5568;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.pricing-toggle button.active {
  background: #2b6cb0;
  color: white;
  border-color: #2b6cb0;
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

button.calculate {
  flex: 1;
  background: #2b6cb0;
  color: white;
  border: none;
  padding: 14px 24px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

button.calculate:hover {
  background: #2c5282;
}

button.reset {
  background: #e2e8f0;
  color: #4a5568;
  border: none;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
}

button.reset:hover {
  background: #cbd5e0;
}

.results {
  display: none;
  background: #ebf8ff;
  border: 1px solid #90cdf4;
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
}

.results.show {
  display: block;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 10px;
  flex-wrap: wrap;
}

.results h3 {
  color: #2b6cb0;
  font-size: 1.2rem;
  margin: 0;
}

.copy-btn {
  background: white;
  border: 1px solid #90cdf4;
  color: #2b6cb0;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.copy-btn:hover {
  background: #ebf8ff;
}

.results-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.print-btn {
  background: white;
  border: 1px solid #90cdf4;
  color: #2b6cb0;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.print-btn:hover { background: #ebf8ff; }
.diagram-wrap {
  margin-top: 20px;
  background: #fff;
  border: 1px solid #bee3f8;
  border-radius: 12px;
  padding: 16px;
}
.diagram-wrap h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #2b6cb0;
  font-weight: 700;
}
.diagram-svg {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 auto;
}
.diagram-caption {
  text-align: center;
  font-size: 0.8rem;
  color: #4a5568;
  margin-top: 10px;
}
.copy-btn.copied {
  background: #2b6cb0;
  color: white;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 500px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
}

.result-item {
  background: white;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #bee3f8;
}

.result-item .label {
  font-size: 0.85rem;
  color: #4a5568;
  margin-bottom: 4px;
}

.result-item .value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a365d;
}

.result-item.highlight {
  background: #2b6cb0;
  border-color: #2b6cb0;
}

.result-item.highlight .label,
.result-item.highlight .value {
  color: white;
}

.result-item .sub-value {
  font-size: 0.78rem;
  color: #718096;
  margin-top: 2px;
}

.result-item.highlight .sub-value {
  color: #bee3f8;
}

.note {
  margin-top: 16px;
  font-size: 0.9rem;
  color: #2c5282;
  background: #bee3f8;
  padding: 10px 14px;
  border-radius: 8px;
}

.info-section {
  background: white;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  margin-bottom: 30px;
}

.info-section h2 {
  font-size: 1.35rem;
  color: #1e3a5f;
  margin-bottom: 14px;
}

.info-section h3 {
  font-size: 1.1rem;
  color: #2b6cb0;
  margin: 20px 0 10px;
}

.info-section p,
.info-section li {
  color: #4a5568;
  margin-bottom: 10px;
  line-height: 1.6;
}

.info-section ul {
  padding-left: 20px;
}

.reviewer-note {
  background: #f7fafc;
  border-left: 4px solid #2b6cb0;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #4a5568;
  margin-top: 18px;
}

.reviewer-note strong {
  color: #1e3a5f;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95rem;
}

th, td {
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  text-align: left;
}

th {
  background: #edf2f7;
  font-weight: 600;
  color: #2d3748;
}

td {
  color: #4a5568;
}

/* FAQ Styles */
.faq-item {
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 0;
}

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

.faq-question {
  font-weight: 600;
  color: #1e3a5f;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-question:hover {
  color: #2b6cb0;
}

.faq-answer {
  display: none;
  margin-top: 10px;
  color: #4a5568;
  line-height: 1.6;
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-item.open .faq-toggle {
  transform: rotate(180deg);
}

.faq-toggle {
  transition: transform 0.2s;
  font-size: 1.2rem;
  color: #2b6cb0;
}

/* Breadcrumb */
.breadcrumb-nav {
  font-size: 0.85rem;
  color: #4a5568;
  margin-bottom: 18px;
  text-align: center;
}

.breadcrumb-nav a {
  color: #2b6cb0;
  text-decoration: none;
}

.breadcrumb-nav a:hover {
  text-decoration: underline;
}

/* Dark mode */
html.dark .card {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

html.dark .tabs {
  background: #0f172a;
  border-bottom-color: var(--border);
}

html.dark .tab {
  color: var(--text-secondary);
}

html.dark .tab.active {
  background: var(--bg-card);
  color: var(--primary);
}

html.dark input[type="number"],
html.dark select {
  background: #0f172a;
  border-color: var(--border);
  color: var(--text-primary);
}

html.dark .pricing-toggle button {
  background: #0f172a;
  border-color: var(--border);
  color: var(--text-secondary);
}

html.dark .pricing-toggle button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

html.dark .form-error-banner {
  background: #2d1414;
  border-color: #742a2a;
  color: #feb2b2;
}

html.dark .results {
  background: #1e3a5f;
  border-color: #3b82f6;
}

html.dark .result-item {
  background: #0f172a;
  border-color: #334155;
}

html.dark .result-item .value {
  color: var(--text-primary);
}

html.dark .result-item.highlight {
  background: var(--primary);
}

html.dark .copy-btn {
  background: #0f172a;
  border-color: #3b82f6;
  color: #93c5fd;
}

html.dark .note {
  background: #1e3a5f;
  color: #93c5fd;
}

html.dark .info-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

html.dark .info-section h2,
html.dark .info-section h3,
html.dark .faq-question {
  color: var(--text-primary);
}

html.dark .info-section p,
html.dark .info-section li,
html.dark .faq-answer {
  color: var(--text-secondary);
}

html.dark .reviewer-note {
  background: #0f172a;
  color: var(--text-secondary);
}

html.dark .reviewer-note strong {
  color: var(--text-primary);
}

html.dark .print-btn {
  background: #0f172a;
  border-color: #3b82f6;
  color: #93c5fd;
}
html.dark .print-btn:hover {
  background: #1e3a5f;
}

.diagram-container {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0;
}
.stair-diagram,
.fence-diagram {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto;
  color: #64748b;
}
.diagram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  justify-content: center;
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--text-secondary, #4a5568);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
html.dark .diagram-legend {
  color: var(--text-secondary);
}

html.dark .diagram-wrap {
  background: #0f172a;
  border-color: #334155;
}
html.dark .diagram-wrap h4 {
  color: #93c5fd;
}
html.dark .diagram-caption {
  color: var(--text-secondary);
}
html.dark .section-label {
  color: #93c5fd;
}

html.dark label,
html.dark .form-group label {
  color: var(--text-primary, #f1f5f9);
}
html.dark .calculator-page h1 {
  color: var(--text-primary);
}
html.dark .calculator-page .subtitle,
html.dark .updated-line {
  color: var(--text-secondary);
}
html.dark table th {
  background: #0f172a;
  color: var(--text-primary);
}
html.dark table td {
  color: var(--text-secondary);
  border-color: var(--border);
}
html.dark .breadcrumb-nav {
  color: var(--text-secondary);
}


html.dark .faq-item {
  border-bottom-color: var(--border);
}

html.dark .updated-line,
html.dark .breadcrumb-nav {
  color: var(--text-secondary);
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0;
}
.faq-question:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
  border-radius: 4px;
}
html.dark .diagram-svg polygon,
html.dark .diagram-svg path,
html.dark .diagram-svg ellipse {
  stroke: #60a5fa;
}
.popup-blocked-note {
  margin-top: 10px;
  font-size: 0.88rem;
  color: #c53030;
  display: none;
}
.popup-blocked-note.show { display: block; }
.results-tip {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #4a5568;
  line-height: 1.5;
}
html.dark .results-tip { color: var(--text-secondary); }