/*!
 * tj-calc-framework.css
 *
 * Standard form + result panel styling for every 3tej tool migrated to the
 * unified .tj-calc template. Lives under /assets/ so the legacy script loader
 * can include it from any embedded body.
 *
 * Brand accent: indigo #115e59 (matches existing card highlights).
 */

.tj-calc {
  margin: 18px 0 24px;
  max-width: 100%;
}

.tj-calc h1,
.tj-calc h2,
.tj-calc h3 {
  letter-spacing: -0.3px;
}

.tj-calc .tj-lede {
  font-size: 15px;
  color: #475569;
  line-height: 1.55;
  margin: 0 0 14px;
  max-width: 780px;
}

/* CALCULATOR PANEL */
.tj-calc-panel {
  background: linear-gradient(135deg, #f0fdfa 0%, #ffffff 60%);
  border: 1px solid #99f6e4;
  border-radius: 14px;
  padding: 18px 18px 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.tj-calc-panel .tj-calc-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #115e59;
  margin-bottom: 6px;
}

.tj-calc-panel .tj-calc-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.tj-calc-panel .tj-calc-sub {
  margin: 0 0 14px;
  font-size: 13px;
  color: #134e4a;
  line-height: 1.5;
}

/* FORM */
.tj-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 14px;
}

.tj-field {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

.tj-field.tj-field-wide {
  grid-column: 1 / -1;
}

.tj-label {
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 6px;
  font-size: 13px;
}

.tj-field input,
.tj-field select,
.tj-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: 15px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tj-field textarea {
  min-height: 110px;
  font-size: 14px;
  font-family: 'SF Mono', 'Roboto Mono', ui-monospace, monospace;
  resize: vertical;
}

.tj-field input:focus,
.tj-field select:focus,
.tj-field textarea:focus {
  outline: none;
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

.tj-help {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.4;
}

.tj-field input[type='checkbox'],
.tj-field input[type='radio'] {
  width: auto;
  margin-right: 8px;
}

/* RESULT PANEL */
.tj-result {
  margin: 12px 0 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 6px 14px;
}

.tj-result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
}

.tj-result-row:last-child {
  border-bottom: none;
}

.tj-result-row.tj-result-row-primary {
  padding: 14px 0;
}

.tj-result-row.tj-result-row-primary .tj-result-label {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.tj-result-row.tj-result-row-primary .tj-result-value {
  font-size: 22px;
  font-weight: 700;
  color: #115e59;
}

.tj-result-label {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

.tj-result-value {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tj-result-value.tj-positive { color: #047857; }
.tj-result-value.tj-negative { color: #b91c1c; }
.tj-result-value.tj-muted    { color: #64748b; font-weight: 500; }

.tj-result-note {
  font-size: 12px;
  color: #64748b;
  padding: 10px 0 4px;
  line-height: 1.5;
}

/* OUTPUT BOX (e.g. password/QR/lorem text) */
.tj-output-box {
  margin: 10px 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: 'SF Mono', 'Roboto Mono', ui-monospace, monospace;
  font-size: 14px;
  color: #0f172a;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 36px;
}

.tj-output-box.tj-output-center {
  text-align: center;
  font-size: 22px;
  letter-spacing: 1px;
}

/* BUTTONS */
.tj-btn {
  display: inline-block;
  padding: 8px 14px;
  background: #115e59;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  font-family: inherit;
}

.tj-btn:hover { background: #134e4a; }
.tj-btn:active { transform: translateY(1px); }
.tj-btn.tj-btn-ghost {
  background: #ffffff;
  color: #115e59;
  border: 1px solid #99f6e4;
}
.tj-btn.tj-btn-ghost:hover { background: #f0fdfa; }

.tj-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

/* FORMULA / SCHEDULE TABLE */
.tj-formula {
  margin: 12px 0 0;
  font-size: 13px;
  color: #475569;
}

.tj-formula summary {
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
  padding: 8px 0;
  list-style: none;
}

.tj-formula summary::before {
  content: '▸ ';
  color: #0d9488;
  font-weight: 700;
}

.tj-formula[open] summary::before { content: '▾ '; }

.tj-formula p,
.tj-formula li {
  margin: 6px 0;
  line-height: 1.55;
}

.tj-formula code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.tj-schedule {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0;
  font-variant-numeric: tabular-nums;
}

.tj-schedule th,
.tj-schedule td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
  text-align: right;
}

.tj-schedule th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  text-align: right;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.tj-schedule th:first-child,
.tj-schedule td:first-child {
  text-align: left;
}

.tj-schedule-wrap {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

/* SVG BAR (visual share). */
.tj-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
  margin: 8px 0 4px;
}

.tj-bar-seg-principal { background: #0d9488; }
.tj-bar-seg-interest  { background: #f59e0b; }
.tj-bar-seg-match     { background: #10b981; }
.tj-bar-seg-tax       { background: #ef4444; }

.tj-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #475569;
  margin-bottom: 6px;
}

.tj-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* RESPONSIVE */
@media (max-width: 520px) {
  .tj-calc-panel { padding: 14px 12px 6px; border-radius: 12px; }
  .tj-form { grid-template-columns: 1fr; gap: 10px; }
  .tj-result-row.tj-result-row-primary .tj-result-value { font-size: 19px; }
}
