/* ============================================================
   FREE BRAND TOOLS — tool UI layer (shared by all 8 generators)
   Loaded inside #tool-mount only. Reuses site.css tokens
   (--blue, --text, --bg-gray, --radius, --font, .glass-panel …).

   The tool *interface* below is Free Brand Tools' own Apple /
   Liquid-Glass branding. The *document* the user generates is
   white-label and themed separately via --bk-* (see each tool).

   Everything here is namespaced .fbt-* so it can never collide
   with the finished site's classes.
   ============================================================ */

.fbt-tool { font-family: var(--font); color: var(--text); --fbt-stage: #eef1f6; }
.fbt-tool *, .fbt-tool *::before, .fbt-tool *::after { box-sizing: border-box; }
.fbt-tool [hidden] { display: none !important; }   /* author display rules tie with UA [hidden]; force it off */

/* ---- two-column layout: controls | live preview ---- */
.fbt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 20px;
  align-items: start;
}
.fbt-col { min-width: 0; }
.fbt-col--preview { position: sticky; top: 72px; }   /* preview follows scroll on desktop */
@media (max-width: 920px) {
  .fbt-grid { grid-template-columns: 1fr; gap: 16px; }
  .fbt-col--preview { position: static; }
}

/* ---- panels (frosted Liquid-Glass cards) ---- */
.fbt-panel {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  padding: clamp(20px, 2.4vw, 28px);
}
.fbt-panel + .fbt-panel { margin-top: 16px; }
.fbt-panel--flush { padding: 0; overflow: hidden; }

.fbt-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.fbt-panel--flush .fbt-panel-head {
  margin-bottom: 0; padding: 18px clamp(18px, 2.2vw, 24px);
  border-bottom: 1px solid var(--hairline-soft);
  background: var(--glass-bg); position: relative; z-index: 2;
}
.fbt-panel-title { font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.fbt-panel-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.fbt-section-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
  color: var(--text-3); margin: 26px 0 14px;
}
.fbt-section-label::after { content: ""; flex: 1; height: 1px; background: var(--hairline-soft); }
.fbt-section-label:first-child { margin-top: 0; }

/* ---- form fields ---- */
.fbt-field { margin-bottom: 16px; }
.fbt-field:last-child { margin-bottom: 0; }
.fbt-field > label, .fbt-label {
  display: block; font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  color: var(--text); margin-bottom: 7px;
}
.fbt-label .fbt-opt { color: var(--text-3); font-weight: 400; }
.fbt-req { color: #e0245e; margin-left: 2px; }

.fbt-input, .fbt-textarea, .fbt-select {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--text);
  padding: 11px 14px; line-height: 1.4;
  background: #fff; border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.fbt-textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
.fbt-input::placeholder, .fbt-textarea::placeholder { color: var(--text-3); }
.fbt-input:focus, .fbt-textarea:focus, .fbt-select:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0,113,227,.14);
}
.fbt-select {
  cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2386868b' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.fbt-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.45; }

.fbt-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fbt-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .fbt-2col, .fbt-3col { grid-template-columns: 1fr; } }

/* ---- color control: swatch + hex ---- */
.fbt-color { display: flex; align-items: center; gap: 10px; }
.fbt-color input[type="color"] {
  -webkit-appearance: none; appearance: none; border: none; background: none;
  width: 46px; height: 40px; flex: none; padding: 0; cursor: pointer; border-radius: var(--radius-sm);
}
.fbt-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.fbt-color input[type="color"]::-webkit-color-swatch { border: 1px solid var(--hairline); border-radius: var(--radius-sm); }
.fbt-color input[type="color"]::-moz-color-swatch { border: 1px solid var(--hairline); border-radius: var(--radius-sm); }
.fbt-color .fbt-input { font-variant-numeric: tabular-nums; text-transform: uppercase; }

/* ---- range / size slider ---- */
.fbt-range-row { display: flex; align-items: center; gap: 12px; }
.fbt-range { flex: 1; min-width: 0; accent-color: var(--blue); height: 6px; cursor: pointer; }
.fbt-range:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; border-radius: 6px; }
.fbt-range-num { width: 74px; flex: none; text-align: center; font-variant-numeric: tabular-nums; }
.fbt-range-unit { font-size: 13px; color: var(--text-3); flex: none; }

/* ---- segmented control ---- */
.fbt-seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--pill);
  background: var(--bg-gray); border: 1px solid var(--hairline-soft);
}
.fbt-seg button {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text-2);
  padding: 7px 16px; border-radius: var(--pill); transition: color .15s, background .15s, box-shadow .15s;
}
.fbt-seg button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: var(--shadow-card); }

/* ---- switch ---- */
.fbt-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.fbt-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.fbt-switch .fbt-track {
  width: 44px; height: 26px; border-radius: var(--pill); background: var(--hairline);
  position: relative; transition: background .2s var(--ease); flex: none;
}
.fbt-switch .fbt-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease);
}
.fbt-switch input:checked + .fbt-track { background: #34c759; }
.fbt-switch input:checked + .fbt-track::after { transform: translateX(18px); }
.fbt-switch input:focus-visible + .fbt-track { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---- buttons (extend site.css .btn) ---- */
.fbt-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  font-family: inherit; font-size: 15px; font-weight: 500; letter-spacing: -.01em;
  padding: 10px 18px; border-radius: var(--pill); white-space: nowrap;
  transition: background .2s var(--ease), transform .12s var(--ease), box-shadow .2s var(--ease), color .15s;
}
.fbt-btn svg { width: 17px; height: 17px; }
.fbt-btn-primary { background: var(--blue); color: #fff; }
.fbt-btn-primary:hover { background: var(--blue-hover); }
.fbt-btn-primary:active { transform: scale(.98); }
.fbt-btn-glass {
  background: var(--glass-bg-strong); color: var(--text);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--hairline-soft); box-shadow: 0 1px 0 var(--glass-edge) inset;
}
.fbt-btn-glass:hover { background: #fff; box-shadow: var(--shadow-card), 0 1px 0 var(--glass-edge) inset; }
.fbt-btn-ghost { background: transparent; color: var(--blue-link); }
.fbt-btn-ghost:hover { background: rgba(0,113,227,.08); }
.fbt-btn-danger { background: transparent; color: #e0245e; }
.fbt-btn-danger:hover { background: rgba(224,36,94,.08); }
.fbt-btn-sm { font-size: 13px; padding: 8px 14px; }
.fbt-btn-block { width: 100%; }
.fbt-btn.is-done { background: #1f8f4a; color: #fff; }
.fbt-btn[disabled] { opacity: .45; pointer-events: none; }
.fbt-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.fbt-actions--end { justify-content: flex-end; }

/* icon-only button (e.g. remove line-item row) */
.fbt-icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  color: var(--text-3); transition: background .15s, color .15s; flex: none;
}
.fbt-icon-btn:hover { background: rgba(224,36,94,.1); color: #e0245e; }
.fbt-icon-btn svg { width: 17px; height: 17px; }

/* ---- uploader / dropzone ---- */
.fbt-uploader { display: flex; align-items: center; gap: 16px; }
.fbt-uploader-preview {
  width: 84px; height: 84px; flex: none; border-radius: 16px; overflow: hidden;
  display: grid; place-items: center; background: var(--bg-gray);
  border: 1px solid var(--hairline-soft); color: var(--text-3); font-size: 12px; text-align: center; padding: 6px;
}
.fbt-uploader-preview img { width: 100%; height: 100%; object-fit: contain; }
.fbt-uploader-preview.is-round { border-radius: 50%; }
.fbt-uploader-preview.is-round img { object-fit: cover; }
.fbt-uploader-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.fbt-drop {
  border: 1.5px dashed var(--hairline); border-radius: var(--radius);
  background: var(--bg-gray-2); padding: 30px 22px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s; color: var(--text-2);
}
.fbt-drop:hover, .fbt-drop.is-drag { border-color: var(--blue); background: rgba(0,113,227,.05); }
.fbt-drop strong { color: var(--text); font-weight: 600; display: block; font-size: 16px; }
.fbt-drop .fbt-drop-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.fbt-drop svg { width: 30px; height: 30px; color: var(--blue); margin: 0 auto 12px; }

/* ---- live preview stage (FBT chrome holding a white-label doc) ---- */
.fbt-stage {
  background: var(--fbt-stage); padding: 26px; overflow: auto;
  display: flex; justify-content: center; min-height: 320px;
}
.fbt-scaler { transform-origin: top center; margin: 0 auto; }

/* generic centered media preview (palette, card) */
.fbt-stage--center { align-items: center; }

/* brand-guidelines doc preview (multi-page, scrollable) */
.fbt-guide-stage { display: block; padding: 22px; max-height: min(72vh, 760px); overflow: auto; }
.fbt-guide-scaler { transform-origin: top left; margin: 0 auto; }

/* ---- color swatches (palette extractor + brand kit) ---- */
.fbt-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 12px; }
.fbt-swatch {
  display: block; width: 100%; padding: 0; font: inherit;
  border-radius: 14px; overflow: hidden; border: 1px solid var(--hairline-soft);
  background: #fff; cursor: pointer; text-align: left; transition: transform .15s var(--ease), box-shadow .15s;
}
.fbt-swatch:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.fbt-swatch-chip { display: block; height: 76px; }
.fbt-swatch-meta { display: block; padding: 9px 11px; }
.fbt-swatch-hex { display: block; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: .01em; }
.fbt-swatch-copy { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }
.fbt-swatch.is-copied .fbt-swatch-copy { color: #1f8f4a; }

/* ---- tabs (install / how-to instructions for signature + letterhead) ---- */
.fbt-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin: 4px 0 20px; flex-wrap: wrap; }
.fbt-tab {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--text-2);
  padding: 10px 16px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.fbt-tab:hover { color: var(--text); }
.fbt-tab[aria-selected="true"] { color: var(--blue-link); border-bottom-color: var(--blue); }
.fbt-tabpanel { display: none; }
.fbt-tabpanel.is-active { display: block; }
.fbt-tabpanel ol, .fbt-tabpanel ul { padding-left: 20px; display: grid; gap: 8px; font-size: 15px; color: var(--text-2); line-height: 1.55; }
.fbt-tabpanel ol { list-style: decimal; } .fbt-tabpanel ul { list-style: disc; }
.fbt-tabpanel strong { color: var(--text); font-weight: 600; }
.fbt-tabpanel kbd {
  background: var(--bg-gray); border: 1px solid var(--hairline); border-radius: 5px;
  padding: 1px 6px; font: inherit; font-size: 12.5px; font-weight: 600;
}
.fbt-note {
  background: #e8f2ff; border: 1px solid #bcdcff; border-left: 3px solid var(--blue);
  border-radius: 10px; padding: 12px 15px; margin-top: 16px; font-size: 13.5px; color: var(--text); line-height: 1.5;
}

/* ---- preview frame (signature: holds raw email HTML) ---- */
.fbt-emailframe {
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 22px; background: #fff; overflow-x: auto;
}
.fbt-emailframe.is-dark { background: #1f1f24; }

/* ---- brand kit live preview card ---- */
.fbt-bk-card {
  background: #fff; border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--hairline-soft); box-shadow: var(--shadow-card);
  width: 100%; max-width: 460px; font-family: var(--bk-font-body, var(--font));
}
.fbt-bk-band { height: 8px; background: linear-gradient(90deg, var(--bk-primary), var(--bk-accent)); }
.fbt-bk-body { padding: 28px; }
.fbt-bk-logo { height: 56px; margin-bottom: 18px; display: flex; align-items: center; }
.fbt-bk-logo img { max-height: 56px; width: auto; object-fit: contain; }
.fbt-bk-logo .fbt-bk-initials {
  width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  background: var(--bk-primary); color: #fff; font-weight: 700; font-size: 22px;
}
.fbt-bk-name { font-family: var(--bk-font-heading, var(--font)); font-size: 25px; font-weight: 700; letter-spacing: -.02em; color: var(--bk-text); }
.fbt-bk-tagline { color: var(--text-2); margin-top: 4px; font-size: 15px; }
.fbt-bk-contact { margin-top: 12px; font-size: 13px; color: var(--text-2); display: grid; gap: 3px; }
.fbt-bk-swatches { display: flex; gap: 8px; margin-top: 22px; }
.fbt-bk-dot { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--hairline-soft); }
.fbt-bk-fonts { margin-top: 18px; font-size: 12px; color: var(--text-3); display: grid; gap: 4px; }
.fbt-bk-fonts b { color: var(--text); font-weight: 600; }

/* ---- business card preview ---- */
.fbt-bizcard {
  width: 3.5in; height: 2in; border-radius: 12px; overflow: hidden; position: relative;
  box-shadow: 0 10px 34px rgba(0,0,0,.22); background: #fff;
}
.fbt-bizcard * { box-sizing: border-box; }

/* ---- empty / hint states ---- */
.fbt-empty { color: var(--text-3); font-size: 14px; text-align: center; padding: 30px 12px; }

/* ---- toast ---- */
.fbt-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 140%);
  background: rgba(29,29,31,.92); color: #fff; font-size: 14px; font-weight: 500;
  padding: 13px 22px; border-radius: var(--pill);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 12px 40px rgba(0,0,0,.28); z-index: 9999; opacity: 0;
  transition: transform .28s var(--ease), opacity .28s var(--ease); max-width: min(92vw, 460px); text-align: center;
}
.fbt-toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---- print: hide the site chrome so only the document prints ----
   (fallback safety — each doc tool prints via isolated iframe, but if a
   user hits Cmd+P on the page we still suppress the chrome.) */
@media print {
  body > *:not(main) { display: none !important; }
  .fbt-col--form, .fbt-panel-head, .breadcrumb, .tool-hero, .prose, .faq, .related { display: none !important; }
}
