/* ============================================================
   BLOOM & YOU — components
   ============================================================ */

/* ---------------- BUTTONS ---------------- */
.btn {
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: var(--r-pill);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--t-fast) var(--ease-soft),
              box-shadow var(--t-fast) var(--ease-soft),
              background-color var(--t-fast) var(--ease-soft),
              filter var(--t-fast) var(--ease-soft);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(140deg, var(--rose-deep), var(--warm-brown));
  color: #fff8f4;
  box-shadow: var(--sh-2);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: var(--sh-1);
}
.btn-secondary:hover { background: var(--ivory-deep); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--line-strong);
  min-height: 36px;
}

.btn-lg { min-height: 54px; padding: 0 34px; font-size: 1.06rem; }

.btn-stack { display: grid; gap: 10px; }

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  flex: 0 0 auto;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: background-color var(--t-fast) var(--ease-soft), color var(--t-fast) var(--ease-soft);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: rgba(107, 79, 63, 0.07); color: var(--ink); }
.icon-btn:disabled { opacity: 0.34; pointer-events: none; }

.round-btn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink);
  display: grid;
  place-items: center;
  box-shadow: var(--sh-1);
  transition: transform var(--t-fast) var(--ease-soft), background-color var(--t-fast);
}
.round-btn:hover { background: var(--ivory-deep); }
.round-btn:active { transform: scale(0.92); }

.ctrl-btn {
  flex: 1;
  min-height: var(--tap);
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: background-color var(--t-fast) var(--ease-soft), color var(--t-fast) var(--ease-soft), transform var(--t-fast);
}
.ctrl-btn svg { width: 18px; height: 18px; }
.ctrl-btn:hover { background: var(--ivory-deep); color: var(--ink); }
.ctrl-btn:active { transform: scale(0.96); }
.ctrl-btn.danger:hover { background: #fdeced; color: #a84250; }

/* ---------------- PANEL ---------------- */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 8px;
  flex: 0 0 auto;
}
.panel-title { font-size: 1.3rem; }
.panel-sub {
  font-size: 0.78rem;
  color: var(--ink-faint);
  text-transform: capitalize;
  letter-spacing: 0.03em;
}
.panel-body {
  padding: 4px 16px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.panel-note {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-top: 10px;
  text-align: center;
}
.step-heading {
  font-size: 1.28rem;
  margin-bottom: 12px;
}

/* only the active step's tools are shown */
.step-content { display: none; }
.step-content.is-active { display: block; }

.panel-collapse {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  color: var(--ink-soft);
}
.chev, .x { display: block; width: 12px; height: 12px; position: relative; }
.chev::before {
  content: "";
  position: absolute; inset: 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform var(--t-med) var(--ease-soft);
}
.toolpanel.is-collapsed .chev::before { transform: rotate(225deg) translate(-1px, -1px); }
.x::before, .x::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 15px; height: 2px; margin: -1px 0 0 -7.5px;
  background: currentColor; border-radius: 2px;
}
.x::before { transform: rotate(45deg); }
.x::after { transform: rotate(-45deg); }

@media (min-width: 880px) {
  .panel-collapse { display: none; }
}

/* ---------------- COLOR ROW + SWATCHES ---------------- */
.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.color-row-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  flex: 0 0 auto;
}
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }

.swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong), var(--sh-1);
  position: relative;
  transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-fast);
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--ink), var(--sh-2);
  transform: scale(1.06);
}
.swatch[aria-checked="true"]::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ---------------- FLOWER LIST ---------------- */
.flower-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  max-width: 100%;
  padding: 6px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.flower-list::-webkit-scrollbar { display: none; }

.flower-card {
  flex: 0 0 auto;
  width: 88px;
  min-height: 104px;
  padding: 8px 6px 10px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  scroll-snap-align: start;
  transition: transform var(--t-fast) var(--ease-soft), box-shadow var(--t-fast), border-color var(--t-fast);
}
.flower-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.flower-card:active { transform: scale(0.96); }
.flower-card[aria-pressed="true"] {
  border-color: var(--dusty-rose);
  box-shadow: 0 0 0 1.5px var(--dusty-rose), var(--sh-2);
}
.flower-card svg { width: 60px; height: 60px; }
.flower-card .fc-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.15;
}
.flower-card .fc-add {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------------- SWATCH GRID (wrap / ribbon) ---------------- */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
}
.paper-card {
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 92px;
  transition: transform var(--t-fast) var(--ease-soft), box-shadow var(--t-fast), border-color var(--t-fast);
}
.paper-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.paper-card[aria-checked="true"] {
  border-color: var(--dusty-rose);
  box-shadow: 0 0 0 1.5px var(--dusty-rose), var(--sh-2);
}
.paper-swatch {
  width: 100%;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--paper, var(--cream));
  box-shadow: inset 0 -10px 14px rgba(0,0,0,0.10), inset 0 6px 10px rgba(255,255,255,0.35);
}
.ribbon-swatch {
  width: 100%;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--paper, var(--champagne));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06), inset 0 -8px 12px rgba(0,0,0,0.14);
}
.paper-card .pc-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------------- CHIPS ---------------- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: var(--tap);
  padding: 6px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip em {
  font-style: normal;
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--ink-faint);
}
.chip.is-on {
  background: linear-gradient(140deg, var(--blush), var(--ivory-deep));
  border-color: var(--dusty-rose);
  color: var(--ink);
}
.chip.is-on em { color: var(--rose-deep); }

/* ---------------- FIELDS ---------------- */
.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--ink-faint); }
.input:focus {
  outline: none;
  border-color: var(--dusty-rose);
  box-shadow: 0 0 0 3px rgba(201, 139, 155, 0.18);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.counter {
  font-size: 0.72rem;
  color: var(--ink-faint);
  text-align: right;
  margin-top: -8px;
}

/* ---------------- SELECTED PANEL INTERNALS ---------------- */
.selectedpanel .panel-body { display: flex; flex-direction: column; gap: 12px; }

.size-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}
.size-mid { text-align: center; }
.size-mid .field-label { margin-bottom: 0; }
.size-value { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; }

.layer-row { display: flex; gap: 8px; }
.layer-row.two .ctrl-btn { flex: 1; }
.layer-row.four .ctrl-btn {
  flex: 1;
  gap: 4px;
  font-size: 0.7rem;
  padding: 0 4px;
  letter-spacing: 0.01em;
}
.layer-row.four .ctrl-btn svg { width: 15px; height: 15px; }

/* ---------------- STEP NAV ---------------- */
.step-nav-btn {
  flex: 1 0 auto;
  min-width: 54px;
  min-height: var(--tap);
  padding: 5px 8px;
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color var(--t-fast), background-color var(--t-fast);
  position: relative;
}
.step-nav-btn svg { width: 19px; height: 19px; }
.step-nav-btn:hover { color: var(--ink-soft); }
.step-nav-btn[aria-current="step"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--sh-1);
}
.step-nav-btn[aria-current="step"]::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--dusty-rose);
}
.step-nav-btn.is-locked { opacity: 0.45; }

/* ---------------- MODAL ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(58, 46, 42, 0.34);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in var(--t-med) var(--ease-soft) both;
}
.modal-card {
  position: relative;
  width: min(24rem, 100%);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 26px 22px 20px;
  box-shadow: var(--sh-3);
  text-align: center;
  animation: pop-in var(--t-med) var(--ease-spring) both;
}
.modal-title { font-size: 1.5rem; margin-bottom: 8px; }
.modal-text { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; padding: 0 12px; }

/* ---------------- REVEAL CARD ---------------- */
.reveal-card {
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  padding: 22px 20px 18px;
}
.reveal-kicker {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 6px;
}
.reveal-to {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rose-deep);
  margin-bottom: 8px;
}
.reveal-message {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink-soft);
  margin-bottom: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.reveal-actions { display: flex; gap: 10px; }
.reveal-actions .btn { flex: 1; padding: 0 12px; }

@media (max-width: 380px) {
  .reveal-actions { flex-direction: column; }
}

/* ---------------- SVG STAGE ELEMENTS ---------------- */
.bouquet-object {
  cursor: grab;
  transition: opacity var(--t-fast) linear;
}
.bouquet-object.is-selected { cursor: grabbing; }
.bouquet-object.is-hidden-layer { opacity: 0.999; }

.sel-ring {
  fill: none;
  stroke: var(--rose-deep);
  stroke-width: 2.5;
  stroke-dasharray: 7 7;
  opacity: 0.9;
  pointer-events: none;
  animation: dash-spin 9s linear infinite;
}
.sel-ring-glow {
  fill: rgba(201, 139, 155, 0.10);
  stroke: none;
  pointer-events: none;
}
.sel-handle {
  fill: var(--surface);
  stroke: var(--rose-deep);
  pointer-events: none;
}
.sel-handle-hit {
  fill: transparent;
  pointer-events: all;
  cursor: crosshair;
}
.sel-handle-line {
  stroke: var(--rose-deep);
  opacity: 0.6;
  pointer-events: none;
}
.hit-area { fill: transparent; pointer-events: all; cursor: grab; }
#bouquet-svg.is-grabbing,
#bouquet-svg.is-grabbing .hit-area { cursor: grabbing; }

@media (prefers-reduced-motion: reduce) {
  .sel-ring { animation: none; }
}
