/* ──────────────────────────────────────────────────────────────────────────
 * TextTab — Pawfectly Yours
 *
 * Class names match the .tt__ scheme used in TextTab.jsx.
 * ────────────────────────────────────────────────────────────────────────── */

.tt {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Edit-mode banner — small pink chip that appears above the form when a
 * text element is selected on the canvas. Tells the user the form's edits
 * will live-update the selection. */

.tt__mode-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  align-self: flex-start;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--brand-pink-soft);
  color: var(--brand-pink-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.tt__mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-pink);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.18);
  animation: tt-pulse 1.6s ease-in-out infinite;
}

@keyframes tt-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.18); }
  50%      { box-shadow: 0 0 0 5px rgba(236, 72, 153, 0.08); }
}

.tt__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.tt__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.tt__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.tt__value {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
}

.tt__textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-body);
  resize: vertical;
  background: #fff;
  color: var(--text-primary);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.tt__textarea:focus {
  outline: none;
  border-color: var(--brand-pink);
  box-shadow: 0 0 0 3px var(--brand-pink-soft);
}

.tt__select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.tt__select:focus {
  outline: none;
  border-color: var(--brand-pink);
  box-shadow: 0 0 0 3px var(--brand-pink-soft);
}

/* Color row --------------------------------------------------------------- */

.tt__colors {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tt__colors--inline {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  /* Breathing room so the selected swatch's pink ring (a 2px outward
   * box-shadow) isn't clipped by the scroll container's edges.
   * `overflow-x: auto` implicitly forces `overflow-y` to auto/hidden
   * per the CSS spec, so without padding the ring gets sliced on all
   * four sides — top, bottom, and at the leftmost/rightmost swatches
   * (which are pinned against the container's content edges).
   * 3px > 2px ring width gives the shadow room to render fully. */
  padding: 3px 4px;
}

.tt__colors--inline::-webkit-scrollbar { display: none; }

.tt__color {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tt__color--small {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.tt__color:hover {
  transform: scale(1.06);
}

.tt__color.is-selected {
  box-shadow: 0 0 0 2px var(--brand-pink);
}

.tt__color--custom {
  background: linear-gradient(135deg, #fff, var(--brand-pink-soft));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 16px;
  color: var(--brand-pink-strong);
  font-weight: 700;
}

.tt__color--custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Eyedropper button — sized like a swatch but with a stroke icon and a
 * cool/lavender gradient that's distinct from both the curated palette
 * and the custom-color square. Hover reveals the brand-pink to match
 * other interactive controls. */
.tt__color--eyedropper {
  background: linear-gradient(135deg, #fff, var(--brand-lavender-soft, #e9defc));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: transform 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}

.tt__color--eyedropper:hover {
  color: var(--brand-pink-strong);
  box-shadow: 0 0 0 2px var(--brand-pink);
}

/* Recent-colors row — sits above the QUICK_COLORS swatches, separated by a
 * dashed underline so the two sets of swatches read as distinct: "colors
 * you've used" vs "the curated palette". */
.tt__recent-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border);
}

.tt__recent-caption {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Outline (stroke) controls (S8) ----------------------------------------- */

.tt__outline-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  cursor: pointer;
}

.tt__outline-toggle input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
  margin: 0;
}

.tt__outline-toggle-track {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background 0.15s ease;
}

.tt__outline-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease;
}

.tt__outline-toggle input:checked ~ .tt__outline-toggle-track {
  background: var(--brand-pink);
}

.tt__outline-toggle input:checked ~ .tt__outline-toggle-track .tt__outline-toggle-thumb {
  transform: translateX(16px);
}

.tt__outline-controls {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.tt__outline-swatch {
  width: 28px;
  height: 28px;
  position: relative;
  cursor: pointer;
}

.tt__outline-swatch-fill {
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.tt__outline-slider {
  width: 100%;
}

.tt__outline-width {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
  min-width: 2.5em;
  text-align: right;
}

/* Arc controls -----------------------------------------------------------
 *
 * Three-button picker. Each button stacks an SVG curve icon over a
 * short text label so the user can read both at-a-glance. The buttons
 * are a segmented control: equal widths, mutually exclusive selection,
 * one always active. Selected button uses the brand-pink fill + white
 * foreground so it reads as the chosen state without ambiguity.
 *
 * Replaced an earlier bidirectional slider. Horizontal sliders don't
 * have an innate up/down semantic, so requiring users to internalize
 * "drag right = curve down" was a learnability tax. The buttons make
 * the mapping obvious from the icon shapes alone. */

.tt__arc-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.45rem;
}

.tt__arc-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 0.4rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.tt__arc-btn:hover {
  border-color: var(--brand-pink);
  color: var(--brand-pink-strong);
  background: var(--brand-pink-soft);
}

.tt__arc-btn:active {
  transform: translateY(1px);
}

.tt__arc-btn.is-selected {
  background: var(--brand-pink);
  border-color: var(--brand-pink);
  color: #fff;
}

/* Icon takes its color from the button's currentColor so it inverts
 * cleanly on selected state. Fixed dimensions keep the three buttons
 * vertically aligned regardless of label length. */
.tt__arc-btn-icon {
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}

.tt__arc-btn-label {
  line-height: 1;
  /* Tiny letter-spacing makes the all-caps-ish labels read cleanly at
   * 11px without looking cramped against the icon above. */
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Label-row variant that holds the label alongside a small inline
 * widget on the LEFT side of the row (rather than the right). The
 * base `.tt__label-row` uses `space-between` to push the secondary
 * widget to the right — that's right for the Outline row (label +
 * toggle), and for the Size row (label + value). For the Color row
 * the indicator sits IMMEDIATELY next to the label as a left-aligned
 * pair, so we wrap them together in this container and let the row
 * itself handle no further layout. Centered alignment keeps a small
 * swatch (~14px) visually balanced with the label text. */
.tt__label-with-swatch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Current-color indicator next to the "Color" label. Small filled
 * circle with a thin border so a white fill stays distinguishable
 * from the white sidebar surface (otherwise white-on-white reads as
 * "no indicator at all"). The border colour matches the curated
 * palette swatches' outer ring so the indicator and palette read as
 * the same visual family. Inline `background-color` is set by the
 * React component from the current `fill` value. */
.tt__current-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  /* Smooth swap when the user picks a different colour — same
   * timing as the preview swatch's background transition so the
   * indicator and preview animate in lockstep when both update. */
  transition: background-color 150ms ease;
}

/* Preview ----------------------------------------------------------------- */

.tt__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 1rem;
  /* Brand pink wash. Same colour used as the soft pink surface
   * elsewhere in the app, kept stable here for ALL fills so the
   * preview section doesn't visually pop relative to the rest of
   * the Text tab.
   *
   * Earlier iterations explored swapping the background to a
   * darker pink when the user's chosen fill had bad contrast
   * against the wash (white on near-white, peach on near-white,
   * etc). The contrast was great, but the saturated dark pink
   * drew too much attention to the section and broke the quiet
   * "swatch confirming styling" role the preview is supposed to
   * play. The fix moved to TextTab.jsx: when the fill has low
   * contrast against this wash, the React component applies a
   * soft dark `text-shadow` to the preview text itself (see the
   * LOW_CONTRAST_TEXT_SHADOW constant). The shadow gives each
   * glyph a visible silhouette without recolouring the surface. */
  background: var(--brand-pink-wash);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
}

/* Submit ------------------------------------------------------------------ */

.tt__submit {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--brand-pink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}

.tt__submit:hover {
  background: var(--brand-pink-strong);
}

.tt__submit:active {
  transform: translateY(1px);
}

/* Hide the font-size slider on desktop.
 *
 * On desktop the user has fine-grained corner-drag handles on the canvas
 * (the Konva transformer's keepRatio scale) plus arrow-key nudge, so the
 * slider is a redundant control that just takes vertical space in the
 * right-rail Text tab. Mobile users can't easily corner-drag a small
 * touch target on a small screen, so the slider stays as the primary
 * size affordance there.
 *
 * Breakpoint matches App.jsx's MOBILE_QUERY (max-width: 768px) — the
 * same line that switches the layout between mobile bottom-sheet and
 * desktop right-rail. Anything at ≥769px is the desktop layout, where
 * the canvas is the primary surface and corner drag is available. */
@media (min-width: 769px) {
  .tt__field--size {
    display: none;
  }
}
