/* ==========================================================================
   Stage 3B-2A-R5B-2-R1 · Unified Product Detail UX Prototype Styles
   Single shared template for ALL applications (Fabric / Rug / Cushion / Sofa).
   Desktop 1440px layout · Mobile 390px layout.
   ========================================================================== */

/* ---------- Reset & Tokens (inherits color vars from site.css) ---------- */
.ux-prototype-page .container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 600px) {
  .ux-prototype-page .container { padding: 0 16px; }
}

.ux-prototype-page .status-ribbon { display: none; } /* disable old R3A status banner on UX proto pages */

/* ---------- Breadcrumb ---------- */
.ux-breadcrumb {
  padding: 20px 0 8px;
  font-size: 13px;
  color: var(--color-text-light);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ux-breadcrumb a { color: var(--color-text-light); text-decoration: none; }
.ux-breadcrumb a:hover { color: var(--color-accent); }
.ux-breadcrumb .sep { opacity: 0.5; }
.ux-breadcrumb .current { color: var(--color-text); font-weight: 500; }

/* ---------- Hero split: Gallery ~58% | Summary ~42% (DESKTOP) ---------- */
.ux-hero {
  display: grid;
  grid-template-columns: 58fr 42fr;
  gap: 40px;
  align-items: start;
  padding: 24px 0 56px;
}
@media (max-width: 960px) {
  .ux-hero { grid-template-columns: 1fr; gap: 24px; padding: 16px 0 32px; }
}

/* ---------- Gallery (left) ---------- */
.ux-gallery-main {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--color-bg-alt);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.ux-gallery-main img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.ux-gallery-main .ux-ai-badge {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,0.5); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 4px; text-transform: uppercase;
  z-index: 2;
}
.ai-disclosure-below {
  margin-top: 8px;
  font-size: 11px; line-height: 1.5;
  color: var(--color-text-light);
  max-width: 640px;
}

.ux-gallery-missing {
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: 32px;
  color: #5f6368;
  background: repeating-linear-gradient(135deg, #f1f3f5 0 18px, #e9ecef 18px 36px);
  font-weight: 650;
  text-align: center;
}

.ux-colorway-chip.image-missing {
  opacity: .52;
  cursor: not-allowed;
  filter: grayscale(1);
}

.ux-colorway-chip-tag.missing {
  color: #6b7280;
  background: #e9ecef;
}
.ux-gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
@media (max-width: 600px) {
  .ux-gallery-thumbs { grid-template-columns: repeat(4, 1fr); gap: 8px; }
}
.ux-gallery-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--color-bg-alt);
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.ux-gallery-thumb:hover { border-color: var(--color-accent); }
.ux-gallery-thumb.active { border-color: var(--color-accent); }
.ux-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ux-gallery-thumb .ux-ai-dot {
  position: absolute; top: 5px; left: 5px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--color-tag-ai, #8b5cf6);
  color: #fff; font-size: 8px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Summary (right / desktop first) ---------- */
.ux-summary-series-code {
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin-bottom: 6px;
}
.ux-summary-series-name {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 30px; font-weight: 700; line-height: 1.2;
  color: var(--color-text);
  margin: 0 0 4px 0;
}
@media (max-width: 600px) {
  .ux-summary-series-name { font-size: 24px; }
}
.ux-summary-app-name {
  font-size: 15px; font-weight: 500;
  color: var(--color-accent);
  margin-bottom: 16px;
}
.ux-summary-bucket-tag {
  display: inline-block;
  padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff; margin-bottom: 18px;
}
.ux-summary-bucket-tag.ready  { background: var(--color-tag-ready, #2f9e44); }
.ux-summary-bucket-tag.custom { background: var(--color-tag-custom, #1971c2); }
.ux-summary-bucket-tag.pending { background: #868e96; display: none; } /* Pending Confirmation hidden on customer page */

/* ---------- Purchase Summary (key facts near top) ---------- */
.ux-purchase-summary {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.ux-purchase-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px dashed var(--color-border);
}
.ux-purchase-row:last-child { border-bottom: none; padding-bottom: 0; }
.ux-purchase-row:first-child { padding-top: 0; }
.ux-purchase-row .label {
  color: var(--color-text-light);
  flex-shrink: 0;
  font-weight: 400;
}
.ux-purchase-row .value {
  color: var(--color-text);
  font-weight: 600;
  text-align: right;
}

/* ---------- CTA buttons (desktop inline / mobile fixed bottom) ---------- */
.ux-cta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.ux-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  cursor: pointer; border: none;
  transition: transform 0.1s ease, background 0.15s ease;
  font-family: inherit;
}
.ux-btn:hover { transform: translateY(-1px); }
.ux-btn-primary { background: var(--color-accent); color: #fff; }
.ux-btn-primary:hover { background: var(--color-accent-hover, var(--color-accent)); color: #fff; }
.ux-btn-outline {
  background: transparent; color: var(--color-accent);
  border: 1.5px solid var(--color-accent);
}
.ux-btn-outline:hover { background: rgba(25,113,194,0.06); }

/* ---------- Colorway Selector (under CTAs on right) ---------- */
.ux-colorway-section { margin-bottom: 8px; }
.ux-colorway-section-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin-bottom: 12px;
}
.ux-colorway-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.ux-colorway-chip {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--color-border);
  background: #fff;
  font-size: 13px; font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  min-width: 0;
}
.ux-colorway-chip:hover { border-color: var(--color-accent); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.ux-colorway-chip.active {
  border-color: var(--color-accent);
  background: rgba(25,113,194,0.04);
  box-shadow: 0 0 0 3px rgba(25,113,194,0.12);
}
.ux-colorway-chip-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: var(--color-bg-alt);
  border: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.ux-colorway-chip-label {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; flex-wrap: wrap;
}
.ux-colorway-chip-code {
  font-size: 13px; font-weight: 600;
  color: var(--color-text);
}
.ux-colorway-chip-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase;
  color: #fff;
}
.ux-colorway-chip-tag.ready   { background: var(--color-tag-ready, #2f9e44); }
.ux-colorway-chip-tag.custom  { background: var(--color-tag-custom, #1971c2); }
.ux-colorway-chip-tag.pending { background: #868e96; }
.ux-colorway-chip-unavailable-note {
  font-size: 11px;
  color: var(--color-text-light);
  margin-top: 10px;
  padding-left: 2px;
}

/* ---------- Detail Sections (below hero) ---------- */
.ux-detail-section {
  padding: 32px 0;
  border-top: 1px solid var(--color-border);
}
.ux-detail-section h2 {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 22px; font-weight: 700;
  margin: 0 0 18px 0;
  color: var(--color-text);
}
@media (max-width: 600px) {
  .ux-detail-section { padding: 24px 0; }
  .ux-detail-section h2 { font-size: 18px; }
}
.ux-detail-section .ux-section-inner { font-size: 14.5px; line-height: 1.7; color: var(--color-text); }
.ux-detail-section ul.ux-bullet-list {
  padding-left: 20px; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}

/* ---------- Size & MOQ table ---------- */
.ux-moq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--color-border);
}
.ux-moq-table th, .ux-moq-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.ux-moq-table th {
  background: var(--color-bg-alt);
  font-weight: 600;
  color: var(--color-text);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.ux-moq-table tr:last-child td { border-bottom: none; }
.ux-moq-note {
  margin-top: 12px; padding: 12px 14px;
  background: #f8f9fa;
  border-left: 3px solid var(--color-accent);
  border-radius: 4px;
  font-size: 13px; color: var(--color-text);
}

/* ---------- Finishing Information Cards (D03) ---------- */
.ux-finishing-intro {
  font-size: 13px; line-height: 1.6;
  color: var(--color-text-muted, #495057);
  margin-bottom: 18px;
  padding: 12px 14px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid var(--color-accent);
}
.ux-finishing-card-group { margin-bottom: 28px; }
.ux-sub-heading {
  font-size: 14px; font-weight: 700;
  color: var(--color-text);
  margin: 0 0 4px 0;
}
.ux-sub-note {
  font-size: 12px; color: var(--color-text-light);
  margin: 0 0 12px 0; line-height: 1.5;
}
.ux-finishing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.ux-finishing-card {
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ux-finishing-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.ux-finishing-card.standard { }
.ux-finishing-card.custom {
  border-style: dashed;
  opacity: 0.95;
}
.ux-finishing-card.standard:hover { opacity: 1; }
.ux-finishing-card-visual {
  aspect-ratio: 4 / 3;
  max-height: 220px;
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 50%, #ced4da 100%);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
}
.ux-finishing-card-visual.multiple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ux-finishing-reference-item { position: relative; min-width: 0; overflow: hidden; }
.ux-finishing-reference-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.ux-finishing-reference-label {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  background: rgba(255,255,255,0.9);
  color: #343a40;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.03em;
}
.ux-finishing-card.custom .ux-finishing-card-visual {
  background: linear-gradient(135deg, #e7f5ff 0%, #d0ebff 50%, #a5d8ff 100%);
}
.ux-finishing-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.ux-finishing-card-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.ux-finishing-card-title {
  font-size: 15px; font-weight: 700;
  color: var(--color-text);
  margin: 0;
}
.ux-finishing-card-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--color-accent); color: #fff;
  padding: 2px 7px; border-radius: 4px;
}
.ux-finishing-card-desc {
  font-size: 12.5px; line-height: 1.5;
  color: var(--color-text-muted, #495057);
  margin: 0;
}
.ux-finishing-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}
.ux-finishing-card-type {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px;
  color: #fff;
}
.ux-finishing-card-type.standard { background: var(--color-tag-ready, #2f9e44); }
.ux-finishing-card-type.custom   { background: var(--color-tag-custom, #1971c2); }
.ux-finishing-card-impact {
  font-size: 11px; color: var(--color-text-light);
}
@media (max-width: 480px) {
  .ux-finishing-cards { grid-template-columns: 1fr; }
  .ux-finishing-card-visual { max-height: 210px; }
}

/* ---------- FAQ accordion (static expanded for prototype) ---------- */
.ux-faq-item {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 10px;
  background: #fff;
}
.ux-faq-q { font-weight: 600; margin: 0 0 6px 0; color: var(--color-text); }
.ux-faq-a { margin: 0; color: var(--color-text-muted, #495057); line-height: 1.7; font-size: 14px; }

/* ---------- Other Applications (Also available as) ---------- */
.ux-other-apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .ux-other-apps-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .ux-other-apps-grid { grid-template-columns: 1fr; } }

.ux-other-app-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  display: flex; flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  color: inherit;
}
a.ux-other-app-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  text-decoration: none;
  color: inherit;
}
.ux-other-app-card.unavailable {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.ux-other-app-card-img {
  aspect-ratio: 4 / 3;
  background: var(--color-bg-alt);
  background-size: cover; background-position: center;
  position: relative;
}
.ux-other-app-card-img .ux-ai-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,0.5); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase;
}
.ux-other-app-card-body { padding: 12px 14px 16px; }
.ux-other-app-card-title {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 15px; color: var(--color-text);
  margin-bottom: 4px;
}
.ux-other-app-card-title .arrow { color: var(--color-accent); font-size: 14px; }
.ux-other-app-card-sub {
  font-size: 12px; color: var(--color-text-light);
}
.ux-other-app-card-unavailable {
  font-size: 11px; color: #868e96; padding: 10px 14px 14px;
  line-height: 1.4;
}

/* ---------- Inquiry Form (static) ---------- */
.ux-inquiry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 14px;
}
@media (max-width: 600px) { .ux-inquiry-grid { grid-template-columns: 1fr; } }
.ux-inquiry-field label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ux-inquiry-field input,
.ux-inquiry-field textarea,
.ux-inquiry-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
  color: var(--color-text);
  box-sizing: border-box;
}
.ux-inquiry-field input:focus,
.ux-inquiry-field textarea:focus,
.ux-inquiry-field select:focus {
  outline: none;
  border-color: var(--color-accent);
}
.ux-inquiry-field.full { grid-column: 1 / -1; }

/* ---------- Related Series ---------- */
.ux-related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 960px) { .ux-related-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .ux-related-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }
.ux-related-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  text-decoration: none; color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex; flex-direction: column;
}
.ux-related-card:hover { transform: translateY(-2px); border-color: var(--color-accent); text-decoration: none; color: inherit; }
.ux-related-card-img {
  aspect-ratio: 4/3;
  background: var(--color-bg-alt);
  background-size: cover; background-position: center;
}
.ux-related-card-body { padding: 10px 12px 14px; }
.ux-related-card-code { font-size: 11px; color: var(--color-text-light); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.ux-related-card-name { font-size: 14px; font-weight: 600; color: var(--color-text); margin-top: 2px; }

/* ---------- Mobile fixed bottom CTA bar (390px and below) ---------- */
.ux-mobile-fixed-bar {
  display: none;
}
@media (max-width: 600px) {
  .ux-mobile-fixed-bar {
    display: grid;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 100;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: #fff;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
  }
  .ux-mobile-fixed-bar .ux-btn { border-radius: 0; padding: 14px 10px; font-size: 13px; }
  .ux-mobile-fixed-bar .ux-btn:first-child { border-radius: 8px 0 0 8px; border-right: 1px solid rgba(255,255,255,0.3); }
  .ux-mobile-fixed-bar .ux-btn-outline { border-radius: 0 8px 8px 0 !important; }
  /* spacer so last section doesn't hide behind fixed bar */
  .ux-prototype-page { padding-bottom: 80px; }
  /* desktop CTAs hidden on mobile to avoid double */
  .ux-cta-row.desktop-only { display: none; }
}

/* ---------- Value block (multi-line summary values, D01) ---------- */
.ux-value-block { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.ux-value-label {
  font-size: 11px; font-weight: 600;
  color: var(--color-text-light);
  letter-spacing: 0.02em;
}
.ux-value-sub {
  font-size: 13px; font-weight: 700;
  color: var(--color-text);
}

/* ---------- Fallback / Warning (D05-D07) ---------- */
.ux-fallback-note {
  position: absolute; bottom: 12px; left: 12px;
  background: rgba(255, 193, 7, 0.95);
  color: #212529;
  font-size: 11px; font-weight: 600;
  padding: 6px 10px; border-radius: 6px;
  max-width: calc(100% - 24px);
}
.ux-fallback-reason {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff9db;
  border: 1px solid #ffe066;
  border-radius: 8px;
  font-size: 12px; line-height: 1.5;
  color: #664d03;
}
.ux-gallery-warning {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fff3f3;
  border-left: 3px solid #e03131;
  border-radius: 4px;
  font-size: 12px; color: #c92a2a;
}

/* ---------- Stress test: colorways wrap at 390px ---------- */
@media (max-width: 600px) {
  .ux-colorway-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .ux-colorway-chip { padding: 10px; }
  .ux-colorway-chip-img { aspect-ratio: 1 / 1; }
}

/* ---------- No horizontal overflow safety ---------- */
.ux-prototype-page img { max-width: 100%; }
.ux-prototype-page * { box-sizing: border-box; }
