/* ToolbeltDocs Tools — shared base styles.
   Everything is scoped under .tbe-tool (the shortcode container) so nothing leaks into
   the GeneratePress theme. System fonts only (no webfont download). */

.tbe-tool {
  --tbe-navy: #1e3a5f;
  --tbe-navy-2: #2b4f7c;
  --tbe-navy-soft: #e8eef6;
  --tbe-accent: #ea580c;
  --tbe-ink: #111827;
  --tbe-ink-2: #4b5563;
  --tbe-muted: #6b7280;
  --tbe-line: #d7dde5;
  --tbe-line-2: #e9edf2;
  --tbe-bg: #f5f7fa;
  --tbe-card: #ffffff;
  --tbe-input: #ffffff;
  --tbe-ok: #15803d;
  --tbe-ok-soft: #ecfdf3;
  --tbe-warn: #9a5b00;
  --tbe-warn-soft: #fff7e6;
  --tbe-warn-line: #f3c46b;
  --tbe-err: #b42318;
  --tbe-err-soft: #fef3f2;
  --tbe-radius: 10px;
  --tbe-radius-sm: 7px;
  --tbe-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --tbe-focus: 0 0 0 3px rgba(43, 79, 124, 0.35);
  --tbe-tap: 44px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--tbe-ink);
  -webkit-text-size-adjust: 100%;
  margin: 0 0 2em;
  min-height: 420px; /* reserve space while JS loads (CLS) */
}
.tbe-tool *,
.tbe-tool *::before,
.tbe-tool *::after {
  box-sizing: border-box;
}
.tbe-tool [hidden] {
  display: none !important;
}

/* Neutralise theme button/input styling inside the tool */
.tbe-tool button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  line-height: inherit;
  box-shadow: none;
  border-radius: 0;
  min-height: 0;
}
.tbe-tool button:hover,
.tbe-tool button:focus {
  background: none;
  color: inherit;
}
.tbe-tool button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.tbe-tool :focus-visible {
  outline: none;
  box-shadow: var(--tbe-focus);
}
.tbe-tool p {
  margin: 0 0 0.75em;
}
.tbe-tool h2,
.tbe-tool h3,
.tbe-tool h4 {
  margin: 0;
  font-family: inherit;
  color: var(--tbe-ink);
  letter-spacing: -0.01em;
}
.tbe-tool img {
  max-width: 100%;
  height: auto;
}

/* The finished tools are always taller than the screen. Reserving that height from the first
   paint means the content below never jumps while the tool boots (Lighthouse CLS). */
#tbd-estimate-maker.tbe-tool,
#tbd-invoice-generator.tbe-tool {
  min-height: max(420px, calc(100vh - 100px));
  min-height: max(420px, calc(100svh - 100px));
}

/* Skeleton shown before JS (printed by the shortcode) */
.tbe-tool .tbe-skeleton {
  display: grid;
  gap: 14px;
}
.tbe-tool .tbe-skel-bar,
.tbe-tool .tbe-skel-card {
  border-radius: var(--tbe-radius);
  background: linear-gradient(90deg, #eef1f5 0%, #f6f8fa 50%, #eef1f5 100%);
  background-size: 200% 100%;
  animation: tbe-shimmer 1.4s infinite linear;
}
.tbe-tool .tbe-skel-bar {
  height: 48px;
}
.tbe-tool .tbe-skel-card {
  /* At least a screen tall: the real tool is taller than the viewport, so nothing below the
     placeholder is visible before the tool loads — no layout shift (CLS) when it appears. */
  height: 360px;
  height: max(360px, calc(100vh - 120px));
  height: max(360px, calc(100svh - 120px));
}
@keyframes tbe-shimmer {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tbe-tool .tbe-skel-bar,
  .tbe-tool .tbe-skel-card {
    animation: none;
  }
  .tbe-tool * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
.tbe-noscript {
  padding: 1em;
  border: 1px solid #d7dde5;
  border-radius: 10px;
  background: #fff7e6;
}

/* ---------- Buttons ---------- */
.tbe-tool .tbe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tbe-tap);
  padding: 10px 16px;
  border-radius: var(--tbe-radius-sm);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.tbe-tool .tbe-btn--primary,
.tbe-tool .tbe-btn--primary:hover,
.tbe-tool .tbe-btn--primary:focus {
  background: var(--tbe-navy);
  color: #fff;
}
.tbe-tool .tbe-btn--primary:hover {
  background: var(--tbe-navy-2);
}
.tbe-tool .tbe-btn--secondary,
.tbe-tool .tbe-btn--secondary:focus {
  background: #fff;
  color: var(--tbe-navy);
  border-color: var(--tbe-line);
}
.tbe-tool .tbe-btn--secondary:hover {
  background: var(--tbe-navy-soft);
  color: var(--tbe-navy);
  border-color: #b9c6d6;
}
.tbe-tool .tbe-btn--ghost,
.tbe-tool .tbe-btn--ghost:focus {
  background: transparent;
  color: var(--tbe-navy);
}
.tbe-tool .tbe-btn--ghost:hover {
  background: var(--tbe-navy-soft);
  color: var(--tbe-navy);
}
.tbe-tool .tbe-btn--danger,
.tbe-tool .tbe-btn--danger:hover {
  color: var(--tbe-err);
}
.tbe-tool .tbe-btn--lg {
  min-height: 50px;
  padding: 12px 22px;
  font-size: 16px;
}
.tbe-tool .tbe-link {
  color: var(--tbe-navy);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
  padding: 4px 2px;
  min-height: 0;
}
.tbe-tool .tbe-link:hover {
  color: var(--tbe-accent);
}
.tbe-tool .tbe-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tbe-tap);
  height: var(--tbe-tap);
  flex: 0 0 auto;
  border-radius: var(--tbe-radius-sm);
  color: var(--tbe-ink-2);
}
.tbe-tool .tbe-icon-btn:hover {
  background: var(--tbe-navy-soft);
  color: var(--tbe-navy);
}
.tbe-tool .tbe-icon-btn--danger:hover {
  background: var(--tbe-err-soft);
  color: var(--tbe-err);
}

/* ---------- Form controls ---------- */
.tbe-tool .tbe-input {
  display: block;
  width: 100%;
  min-height: var(--tbe-tap);
  padding: 9px 12px;
  margin: 0;
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming on focus */
  color: var(--tbe-ink);
  background: var(--tbe-input);
  border: 1px solid var(--tbe-line);
  border-radius: var(--tbe-radius-sm);
  box-shadow: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.tbe-tool .tbe-input:hover {
  border-color: #b9c3cf;
}
.tbe-tool .tbe-input:focus {
  outline: none;
  border-color: var(--tbe-navy-2);
  box-shadow: var(--tbe-focus);
  background: #fff;
}
.tbe-tool .tbe-input::placeholder {
  color: #9aa3ae;
  opacity: 1;
}
.tbe-tool .tbe-input[aria-invalid="true"] {
  border-color: var(--tbe-err);
}
.tbe-tool .tbe-textarea {
  resize: vertical;
  line-height: 1.45;
}
.tbe-tool .tbe-select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234b5563' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.tbe-tool input[type="date"].tbe-input {
  min-height: var(--tbe-tap);
}
.tbe-tool .tbe-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.tbe-tool .tbe-field > label,
.tbe-tool .tbe-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--tbe-ink);
}
.tbe-tool .tbe-optional {
  font-weight: 400;
  color: var(--tbe-muted);
}
.tbe-tool .tbe-hint {
  font-size: 13px;
  color: var(--tbe-muted);
  line-height: 1.4;
}
.tbe-tool .tbe-error {
  font-size: 13px;
  color: var(--tbe-err);
  font-weight: 600;
}
.tbe-tool .tbe-inline {
  display: flex;
  align-items: stretch;
}
.tbe-tool .tbe-inline .tbe-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  min-width: 0;
}
.tbe-tool .tbe-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--tbe-line);
  border-left: 0;
  border-radius: 0 var(--tbe-radius-sm) var(--tbe-radius-sm) 0;
  background: var(--tbe-bg);
  color: var(--tbe-ink-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.tbe-tool .tbe-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tbe-tap);
}
.tbe-tool .tbe-check input[type="checkbox"],
.tbe-tool .tbe-radio input[type="radio"],
.tbe-tool .tbe-chip input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--tbe-navy);
  cursor: pointer;
}
.tbe-tool .tbe-check label {
  cursor: pointer;
  font-size: 15px;
}
.tbe-tool .tbe-check--sm {
  min-height: 36px;
}
.tbe-tool .tbe-check--sm label {
  font-size: 14px;
}
.tbe-tool .tbe-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

/* Segmented control */
.tbe-tool .tbe-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--tbe-bg);
  border: 1px solid var(--tbe-line);
  gap: 3px;
  max-width: 100%;
}
.tbe-tool .tbe-seg__btn {
  min-height: 38px;
  padding: 6px 16px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 15px;
  color: var(--tbe-ink-2);
}
.tbe-tool .tbe-seg__btn:hover {
  color: var(--tbe-navy);
}
.tbe-tool .tbe-seg__btn.is-on,
.tbe-tool .tbe-seg__btn.is-on:hover,
.tbe-tool .tbe-seg__btn.is-on:focus {
  background: #fff;
  color: var(--tbe-navy);
  box-shadow: var(--tbe-shadow);
}

/* Notes */
.tbe-tool .tbe-note {
  padding: 10px 12px;
  border-radius: var(--tbe-radius-sm);
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid var(--tbe-line);
  background: var(--tbe-bg);
  color: var(--tbe-ink-2);
}
.tbe-tool .tbe-note--warn {
  background: var(--tbe-warn-soft);
  border-color: var(--tbe-warn-line);
  color: #6b3f00;
}
.tbe-tool .tbe-note--error {
  background: var(--tbe-err-soft);
  border-color: #fda29b;
  color: var(--tbe-err);
}

/* Toasts */
.tbe-tool .tbe-toasts {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 460px);
  pointer-events: none;
}
.tbe-tool .tbe-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #1f2937;
  color: #fff;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  transition: opacity 0.35s, transform 0.35s;
  animation: tbe-in 0.2s ease-out;
}
.tbe-tool .tbe-toast.is-out {
  opacity: 0;
  transform: translateY(8px);
}
.tbe-tool .tbe-toast__btn {
  color: #fdba74;
  font-weight: 700;
  padding: 6px 4px;
}
.tbe-tool .tbe-toast__btn:hover {
  color: #fff;
}
@keyframes tbe-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
html.tbe-noscroll,
html.tbe-noscroll body {
  overflow: hidden;
}

/* ---------- Hardening: the tool can be embedded inside other site layouts (e.g. the
   site's own .tbd-app pages). Doubled class = higher specificity than generic theme rules
   such as ".tbd-app section", ".tbd-app input", ".tbd-app h2", ".tbd-app p". ---------- */
.tbe-tool.tbe-tool section,
.tbe-tool.tbe-tool aside,
.tbe-tool.tbe-tool details {
  margin: 0;
}
.tbe-tool.tbe-tool h2,
.tbe-tool.tbe-tool h3,
.tbe-tool.tbe-tool h4 {
  font-family: inherit;
  letter-spacing: -0.01em;
  margin: 0;
}
.tbe-tool.tbe-tool p {
  margin: 0 0 0.75em;
}
.tbe-tool.tbe-tool input[type="checkbox"],
.tbe-tool.tbe-tool input[type="radio"] {
  min-height: 0;
  padding: 0;
  border-radius: 3px;
  font: inherit;
  appearance: auto;
  -webkit-appearance: auto;
}
.tbe-tool.tbe-tool input[type="radio"] {
  border-radius: 50%;
}
.tbe-tool.tbe-tool button {
  min-height: 0;
}
.tbe-tool .tbe-btn--danger-solid,
.tbe-tool .tbe-btn--danger-solid:hover,
.tbe-tool .tbe-btn--danger-solid:focus {
  background: var(--tbe-err);
  color: #fff;
}
.tbe-tool .tbe-btn--danger-solid:hover {
  background: #912018;
}

/* ---------- Free plan / Pro (src/shared/pro.js) ---------- */
.tbe-tool .tbe-plan {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--tbe-navy-soft);
  color: var(--tbe-ink);
  font-size: 14px;
  line-height: 1.5;
}
.tbe-tool .tbe-plan--pro {
  background: var(--tbe-ok-soft);
  color: var(--tbe-ok);
  font-weight: 600;
}
.tbe-tool .tbe-plan svg {
  vertical-align: -3px;
}
.tbe-tool .tbe-plan__note {
  color: var(--tbe-err);
}
.tbe-tool .tbe-linkbtn {
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
  font: inherit;
  font-weight: 600;
  color: var(--tbe-navy);
  text-decoration: underline;
  cursor: pointer;
}
.tbe-tool .tbe-pro p {
  margin: 0 0 12px;
}
.tbe-tool .tbe-pro__plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 12px;
}
.tbe-tool .tbe-pro__plan {
  display: grid;
  gap: 2px;
  padding: 14px;
  border: 2px solid var(--tbe-line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--tbe-ink);
  background: #fff;
}
.tbe-tool .tbe-pro__plan strong {
  font-size: 17px;
  color: var(--tbe-navy);
}
.tbe-tool .tbe-pro__plan span {
  font-size: 13px;
  color: var(--tbe-muted);
}
.tbe-tool .tbe-pro__plan.is-best {
  border-color: var(--tbe-navy);
  background: var(--tbe-navy-soft);
}
.tbe-tool .tbe-pro__plan:hover,
.tbe-tool .tbe-pro__plan:focus {
  border-color: var(--tbe-navy-2);
}
.tbe-tool .tbe-pro__key {
  display: flex;
  gap: 8px;
  margin: 4px 0 8px;
}
.tbe-tool .tbe-pro__key .tbe-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  text-transform: uppercase;
}
.tbe-tool .tbe-pro__msg {
  min-height: 1.4em;
  font-size: 14px;
}
.tbe-tool .tbe-pro__msg.is-ok {
  color: var(--tbe-ok);
  font-weight: 600;
}
.tbe-tool .tbe-pro__msg.is-err {
  color: var(--tbe-err);
}
@media (max-width: 480px) {
  .tbe-tool .tbe-pro__plans {
    grid-template-columns: 1fr;
  }
}
