/* 08-tools.css — Back-to-Top Button, Workbook Gate, Tool Navigation, Calculator, Timeline Builder */

/* ─── BACK TO TOP BUTTON ─── */
.back-to-top-btn {
  display: none; /* shown only on mobile via media query */
  position: fixed; bottom: 24px; right: 20px;
  background: var(--cobalt); color: white;
  border: none; border-radius: 3px;
  padding: 8px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  cursor: pointer; z-index: 800;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  transition: opacity 0.2s, background 0.2s;
  opacity: 0; pointer-events: none;
  white-space: nowrap;
}
.back-to-top-btn.visible { opacity: 1; pointer-events: auto; }
.back-to-top-btn:hover { background: var(--cobalt-dark); }

/* Gated online button state */
.btn-toolkit-online.gated {
  background: rgba(255,255,255,0.06);
  cursor: not-allowed;
  opacity: 0.6;
}

  /* ─── TOOLS NAV SECTION ─── */
  .tools-nav-title {
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--gold); font-weight: 600; padding: 18px 20px 8px;
    border-top: 1px solid rgba(255,255,255,0.08); margin-top: 12px;
  }
  .tool-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
  }
  .tool-nav-item:hover { background: rgba(255,255,255,0.05); }
  .tool-nav-item.active {
    background: rgba(184,92,74,0.12);
    border-left-color: var(--terracotta);
  }
  .tool-nav-icon { font-size: 16px; flex-shrink: 0; }
  .tool-nav-label { font-size: 12px; color: rgba(255,255,255,0.82); line-height: 1.3; }
  .tool-nav-item.active .tool-nav-label { color: white; }

  /* ─── TOOL CONTENT PANELS ─── */
  .tool-panel { display: none; padding: 40px 48px; max-width: 900px; }
  .tool-panel.active { display: block; }
  .tool-header { margin-bottom: 32px; position: relative; }
  .tool-header h2 { font-size: 26px; color: var(--cobalt); font-weight: 700; margin: 0 0 8px; }
  .tool-header p { font-size: 14px; color: var(--text-mid); margin: 0; line-height: 1.6; }
  .tool-back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: 1px solid var(--rule); color: var(--text-light);
    padding: 6px 14px; font-family: 'DM Sans', sans-serif;
    font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
    cursor: pointer; margin-bottom: 16px; transition: all 0.2s;
  }
  .tool-back-btn:hover { border-color: var(--cobalt); color: var(--cobalt); }
  .tool-section { margin-bottom: 32px; }
  .tool-section-title {
    font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--gold); font-weight: 600; margin-bottom: 12px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
  }

  /* ─── INCOME CALCULATOR ─── */
  .calc-pathway-tabs {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px;
  }
  .calc-tab {
    padding: 8px 16px; border-radius: 3px; border: 1px solid var(--border);
    background: white; font-size: 12px; cursor: pointer; font-family: inherit;
    color: var(--text-mid); transition: all 0.15s;
  }
  .calc-tab.active {
    background: var(--cobalt); color: white; border-color: var(--cobalt);
  }
  .calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
  .calc-field { display: flex; flex-direction: column; gap: 6px; }
  .calc-field label { font-size: 12px; color: var(--text-mid); font-weight: 500; }
  .calc-field input {
    border: 1px solid var(--border); border-radius: 3px; padding: 10px 12px;
    font-family: inherit; font-size: 14px; color: var(--text-dark);
    background: white; transition: border-color 0.15s;
  }
  .calc-field input:focus { border-color: var(--cobalt); }
  .calc-field input:focus:not(:focus-visible) { outline: none; }
  .calc-input-usd { position: relative; display: flex; align-items: center; }
  .calc-input-usd::before {
    content: '$'; position: absolute; left: 11px;
    font-size: 14px; color: var(--text-mid); pointer-events: none; z-index: 1;
  }
  .calc-input-usd input { padding-left: 24px; width: 100%; }
  .calc-field .field-hint { font-size: 12px; color: var(--text-light-aa); }
  .calc-result-box {
    border-radius: 4px; padding: 20px 24px; margin-top: 24px;
    border-left: 4px solid var(--border);
  }
  .calc-result-box.pass { background: #EEF8F2; border-left-color: #1A6B3A; }
  .calc-result-box.fail { background: #FAF0EC; border-left-color: var(--terracotta); }
  .calc-result-box.marginal { background: #FBF7EF; border-left-color: var(--gold); }
  .calc-result-box.neutral { background: var(--surface); border-left-color: var(--cobalt); }
  .calc-result-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; margin-bottom: 8px; }
  .calc-result-box.pass .calc-result-label { color: #1A6B3A; }
  .calc-result-box.fail .calc-result-label { color: var(--terracotta); }
  .calc-result-box.marginal .calc-result-label { color: var(--gold); }
  .calc-result-box.neutral .calc-result-label { color: var(--cobalt); }
  .calc-result-total { font-size: 28px; font-weight: 700; color: var(--cobalt); margin-bottom: 4px; }
  .calc-result-breakdown { font-size: 13px; color: var(--text-mid); line-height: 1.6; }
  .calc-consulate-table { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 13px; }
  .calc-consulate-table th {
    background: var(--cobalt); color: white; padding: 10px 14px;
    text-align: left; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  }
  .calc-consulate-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .calc-consulate-table tr:nth-child(even) td { background: var(--surface); }
  .status-badge {
    display: inline-block; padding: 3px 10px; border-radius: 2px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  }
  .badge-pass { background: #EEF8F2; color: #1A6B3A; }
  .badge-marginal { background: #FBF7EF; color: #8C6420; }
  .badge-fail { background: #FAF0EC; color: var(--terracotta); }
  .badge-na { background: var(--surface); color: var(--text-light); }

  /* ─── TIMELINE BUILDER ─── */
  .tl-input-row { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap; }
  .tl-field { display: flex; flex-direction: column; gap: 6px; }
  .tl-field label { font-size: 12px; color: var(--text-mid); font-weight: 500; }
  .tl-field input, .tl-field select {
    border: 1px solid var(--border); border-radius: 3px; padding: 0 12px;
    font-family: inherit; font-size: 14px; color: var(--text-dark); background: white;
    height: 42px; box-sizing: border-box;
  }
  .tl-field input:focus, .tl-field select:focus { border-color: var(--cobalt); }
  .tl-field input:focus:not(:focus-visible), .tl-field select:focus:not(:focus-visible) { outline: none; }
  .tl-field select:invalid, .tl-field select option[value=""] { color: var(--text-light); }
  .tl-field select option:not([value=""]) { color: var(--text-dark); }
  .tl-build-btn {
    padding: 0 24px; background: var(--cobalt); color: white; border: none;
    border-radius: 3px; font-family: inherit; font-size: 13px; cursor: pointer;
    letter-spacing: 0.04em; font-weight: 600;
    height: 42px; box-sizing: border-box; align-self: flex-end;
  }
  .tl-build-btn:hover { background: var(--cobalt-dark); }
  .timeline-output { margin-top: 8px; }
  .tl-warning {
    background: #FAF0EC; border-left: 4px solid var(--terracotta);
    padding: 14px 18px; border-radius: 3px; font-size: 13px;
    color: var(--text-dark); margin-bottom: 20px; line-height: 1.6;
  }
  .tl-row {
    display: grid; grid-template-columns: 180px 130px 1fr;
    gap: 0; border-bottom: 1px solid var(--border);
    align-items: stretch;
  }
  .tl-row.tl-header {
    background: var(--cobalt); font-size: 11px; letter-spacing: 0.06em;
    text-transform: uppercase; color: white; font-weight: 600;
    border-bottom: none;
  }
  .tl-cell {
    padding: 12px 16px; font-size: 13px; color: var(--text-dark);
    border-right: 1px solid var(--border); line-height: 1.5;
  }
  .tl-cell:last-child { border-right: none; }
  .tl-row.tl-header .tl-cell { color: white; padding: 10px 16px; }
  .tl-row.tl-critical { background: #FAF0EC; }
  .tl-row.tl-critical .tl-cell:first-child { color: var(--terracotta); font-weight: 600; }
  .tl-row.tl-critical .tl-cell:nth-child(2) { color: var(--terracotta); }
  .tl-row.tl-phase-start { background: #E8EFF5; }
  .tl-row.tl-phase-start .tl-cell:first-child { color: var(--cobalt); font-weight: 700; }
  .tl-row.tl-phase-start .tl-cell:nth-child(2) { color: var(--cobalt); }
  .tl-row.tl-milestone { background: #FBF7EF; }
  .tl-row.tl-milestone .tl-cell:first-child { color: var(--gold-dark, #8C6420); font-weight: 600; }
  .tl-row.tl-milestone .tl-cell:nth-child(2) { color: var(--gold-dark, #8C6420); }
  .tl-row.tl-item { background: white; }
  .tl-row.tl-item .tl-cell:nth-child(2) { color: var(--text-light); }
  .tl-past .tl-cell { color: var(--text-light) !important; }
  .tl-past .tl-cell div { color: var(--text-light) !important; }
  .tl-past .tl-cell strong { color: var(--text-light) !important; font-weight: 400; }
  .tl-today-marker {
    background: var(--cobalt); color: white; padding: 8px 16px;
    font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
    font-weight: 600; text-align: center;
  }
