/* ==========================================================================
   FurnitureFlow — try.css (page-specific; tokens/components in brand.css)
   NOTE: --accent is set dynamically per-store by try.js
   (document.documentElement.style.setProperty("--accent", C.accent)).
   It stays a separate variable from brand.css's --ff-acc on purpose:
   --accent drives store-specific interactive states (selected tab,
   selected product, generate button, WhatsApp button); --ff-acc/--ff-*
   drive the fixed FurnitureFlow chrome (header, footer, card frames).
   ========================================================================== */

:root { --accent: #b45309; }

main.layout {
  width: 100%;
  max-width: var(--ff-container);
  margin: 0 auto;
  padding: 32px 24px 56px;
  display: grid;
  grid-template-columns: 1fr 320px;
  align-items: start;
  gap: 28px;
}

/* Grid items default to min-width:auto, which lets a wide flex-row child
   (the horizontally-scrolling mobile rail) force the whole grid — and the
   page — wider than the viewport instead of scrolling within its column. */
#stage-wrap, #rail-wrap { min-width: 0; }

/* ------------------------------------ Stage ------------------------------------ */
#stage-wrap { align-self: start; }

#stage {
  position: relative;
  min-height: 360px;
  background: var(--ff-card);
  border: 1px solid var(--ff-line);
  border-radius: var(--ff-radius);
  box-shadow: var(--ff-shadow);
  overflow: hidden;
}

#stage-img { width: 100%; display: block; }
#stage-img[hidden] { display: none; }

#stage-caption {
  margin: 0;
  padding: 12px 18px 16px;
  color: var(--ff-mut);
  font-size: 14px;
}

#drop-zone {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 360px;
  margin: 14px;
  border: 2px dashed var(--accent);
  border-radius: var(--ff-radius-sm);
  cursor: pointer;
  text-align: center;
  font-size: 16.5px;
  color: var(--ff-ink);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

#drop-zone:hover { background: var(--ff-acc-soft); }

#drop-zone small { color: var(--ff-mut); font-size: 13px; font-weight: 400; }

/* ------------------------------- Tabs + WA button ------------------------------- */
.ff-stage-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
}

#stage-tabs { display: flex; gap: 8px; flex-wrap: wrap; }

.tab {
  font-family: var(--ff-font-body);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--ff-line);
  background: var(--ff-card);
  color: var(--ff-mut);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.tab:hover { color: var(--ff-ink); border-color: #ddceb9; }

.tab.sel {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#wa-btn { background: var(--accent); flex: none; }
#wa-btn:hover { background: var(--ff-acc-deep); }

/* Static, mode-agnostic step hints (see try/index.html) — kept in CSS/markup
   only so try.js's id/behavior contract stays untouched. */
.ff-hint-strip {
  margin: 14px 0 0;
  padding: 10px 16px;
  background: var(--ff-card);
  border: 1px solid var(--ff-line);
  border-radius: var(--ff-radius-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-size: 13px;
  color: var(--ff-mut);
}

.ff-hint-strip span { white-space: nowrap; }

/* ------------------------------------- Rail ------------------------------------- */
#rail-wrap { align-self: start; }

#rail-wrap h2 {
  font-family: var(--ff-font-display);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ff-ink);
  margin: 0 0 14px;
}

#rail-wrap h2 .ff-mut {
  font-family: var(--ff-font-body);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 13px;
}

#product-rail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-height: 74vh;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--ff-line) transparent;
}

#product-rail::-webkit-scrollbar { width: 6px; }
#product-rail::-webkit-scrollbar-track { background: transparent; }
#product-rail::-webkit-scrollbar-thumb { background: var(--ff-line); border-radius: 999px; }
#product-rail::-webkit-scrollbar-thumb:hover { background: #ddceb9; }

.product {
  border: 1px solid var(--ff-line);
  border-radius: var(--ff-radius-sm);
  padding: 8px;
  background: var(--ff-card);
  cursor: grab;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.product:hover {
  border-color: #ddceb9;
  box-shadow: var(--ff-shadow);
  transform: translateY(-2px);
}

.product img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  pointer-events: none;
  display: block;
}

.product span {
  font-size: 12.5px;
  line-height: 1.3;
  display: block;
  margin-top: 6px;
  color: var(--ff-ink);
}

.product.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.product.dim { opacity: 0.4; }

/* --------------------------------- Overlays -------------------------------------- */
#confirm-chip {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: var(--ff-card);
  border: 1px solid var(--accent);
  border-radius: var(--ff-radius-sm);
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: var(--ff-shadow-hover);
  max-width: 92%;
  font-size: 14px;
  color: var(--ff-ink);
  z-index: 3;
}

#confirm-chip button {
  font-family: var(--ff-font-body);
  border: none;
  border-radius: var(--ff-radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}

#chip-generate { background: var(--accent); color: #fff; }
#chip-cancel { background: var(--ff-bg); color: var(--ff-ink); }

#progress-bar {
  position: absolute;
  inset: auto 0 0 0;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 16px;
  font-size: 14px;
  color: var(--ff-mut);
  z-index: 3;
}

#progress-bar .bar {
  height: 4px;
  border-radius: 4px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, var(--accent) 30%, var(--ff-acc-soft) 30%);
  background-size: 200% 100%;
  animation: ff-slide 1.4s linear infinite;
}

@keyframes ff-slide { to { background-position: -200% 0; } }

#alert-bar {
  position: absolute;
  inset: auto 0 0 0;
  background: var(--ff-acc-soft);
  border-top: 1px solid var(--accent);
  padding: 10px 16px;
  font-size: 14px;
  color: var(--ff-acc-deep);
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 3;
}

#alert-bar button {
  font-family: var(--ff-font-body);
  border: none;
  border-radius: var(--ff-radius-sm);
  padding: 6px 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

#confirm-chip[hidden], #alert-bar[hidden], #drop-zone[hidden] { display: none; }

/* ---------------------------------- Responsive ------------------------------------ */
@media (max-width: 720px) {
  .ff-header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; row-gap: 6px; }
  #store-name { max-width: 100%; }

  main.layout { grid-template-columns: 1fr; padding: 20px 16px 40px; gap: 20px; }

  .ff-stage-controls { flex-direction: column; align-items: stretch; }
  #wa-btn { justify-content: center; }

  #product-rail {
    display: flex;
    overflow-x: auto;
    max-height: none;
    gap: 10px;
    padding-bottom: 6px;
  }
  .product { flex: 0 0 132px; width: 132px; }
}

@media (prefers-reduced-motion: reduce) {
  #progress-bar .bar { animation: none; }
}
