/**
 * UNIMART Product UI — final visual redesign layer (additive).
 * One product · one nav · one language. No new routes. No backend changes.
 * Extends unimart-brand.css tokens; does not invent a second design system.
 */

:root {
  --um-space-1: 0.25rem;
  --um-space-2: 0.5rem;
  --um-space-3: 0.75rem;
  --um-space-4: 1rem;
  --um-space-5: 1.25rem;
  --um-space-6: 1.5rem;
  --um-space-8: 2rem;
  --um-focus-ring: 0 0 0 3px rgba(246, 139, 30, 0.35);
  --um-motion-fast: 160ms ease;
  --um-motion: 280ms cubic-bezier(0.22, 1, 0.36, 1);
  --um-touch: 44px;
}

/* ── Global product polish ── */
body.has-confidence-nav,
body.confidence-flat-page,
body.today-brand-page,
body.biz-page,
body.home-intelligence-page {
  font-family: var(--unimart-font-sans);
  color: var(--unimart-text);
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--unimart-orange);
  outline-offset: 2px;
  box-shadow: var(--um-focus-ring);
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* Pill search shells already show focus-within — never draw a rectangular ring on the field */
.ul-hero__search-input:focus,
.ul-hero__search-input:focus-visible,
.um-assistant__input:focus,
.um-assistant__input:focus-visible,
.search-pill__input:focus,
.search-pill__input:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
}

/* ── Shared page chrome ── */
.um-page-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--unimart-orange);
}

.um-page-title {
  margin: 0;
  font-family: var(--unimart-font-display);
  font-size: clamp(1.55rem, 4.5vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--unimart-text);
}

.um-page-sub {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--unimart-text-muted);
  max-width: 28rem;
}

.um-section {
  margin: var(--um-space-6) 0;
}

.um-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--um-space-3);
  margin-bottom: var(--um-space-3);
}

.um-section__title {
  margin: 0;
  font-family: var(--unimart-font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--unimart-text);
}

.um-section__link {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--unimart-orange);
  text-decoration: none;
  white-space: nowrap;
}
.um-section__link:hover { text-decoration: underline; }

.um-section__sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--unimart-text-muted);
}

/* Domain hub hero — shared across Commerce / Search / Me / … */
.um-domain-hero {
  padding: var(--um-space-4) 0 var(--um-space-3);
  margin-bottom: var(--um-space-2);
}
.um-domain-hero__kicker {
  margin: 0 0 0.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--unimart-text-muted);
}
.um-domain-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: var(--um-space-4);
}
.um-cta--secondary {
  background: transparent;
  color: var(--unimart-slate);
  border: 1.5px solid var(--unimart-border);
}
.um-cta--secondary:hover {
  border-color: var(--unimart-orange);
  color: var(--unimart-orange);
  background: color-mix(in srgb, var(--unimart-orange) 8%, transparent);
}
.um-empty__cta {
  margin-top: 1rem;
}
.um-empty__cta .um-cta { min-width: 10rem; }
.um-empty__cta--row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.um-cta--card {
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
  border-radius: 999px;
}
.um-cta--icon {
  min-height: 2rem;
  min-width: 2rem;
  padding: 0.35rem;
  border-radius: 999px;
  box-shadow: var(--unimart-shadow, 0 2px 8px rgba(0, 0, 0, 0.12));
  background: #fff;
  z-index: 2;
}
.um-cta--icon i { color: var(--unimart-orange); font-size: 0.75rem; }

.um-page {
  width: min(100%, 42rem);
  margin: 0 auto;
  padding: var(--um-space-4) var(--um-pad-x, 1rem) var(--um-space-8);
}
.um-page--narrow { max-width: 40rem; }
.um-page-back { margin: 0 0 var(--um-space-2); }
.um-simple-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.um-simple-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--unimart-border);
  border-radius: var(--unimart-radius-sm);
  background: var(--unimart-bg);
}
.um-simple-list__item a {
  font-weight: 700;
  color: var(--unimart-slate);
  text-decoration: none;
}
.um-simple-list__item a:hover { color: var(--unimart-orange); }
.um-simple-list__meta {
  font-size: 0.78rem;
  color: var(--unimart-text-muted);
}
.um-prose {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--unimart-text);
}
.um-meta {
  margin-top: var(--um-space-4);
  font-size: 0.8rem;
  color: var(--unimart-text-muted);
}

/* Opportunity overlay hero — keep eyebrow readable */
.opp-detail-hero__caption .um-page-eyebrow {
  color: #fff;
  opacity: 0.9;
}
.opp-detail-hero__caption .um-page-title {
  color: #fff;
}
.um-cta--card .um-cta__label {
  display: none;
}
@media (min-width: 768px) {
  .um-cta--card .um-cta__label { display: inline; }
}

.um-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--unimart-bg-muted);
  color: var(--unimart-slate);
}

/* Commerce hub — domain hero sits above intent bar */
.um-domain-hero--commerce {
  padding-top: 0.35rem;
  padding-bottom: 0.15rem;
  margin-bottom: 0.15rem;
}
.um-domain-hero--commerce .um-page-title {
  font-size: clamp(1.4rem, 4vw, 1.85rem);
}
.um-domain-hero--commerce .um-domain-hero__actions {
  margin-top: 0.75rem;
}

/* Me profile */
.um-me-profile__card {
  background: var(--unimart-bg);
  border: 1px solid var(--unimart-border);
  border-radius: var(--unimart-radius);
  padding: var(--um-space-4);
  margin: var(--um-space-4) 0;
}
.um-me-profile__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--um-space-3);
  margin-top: var(--um-space-3);
}
@media (min-width: 768px) {
  .um-me-profile__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.um-me-profile__stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--um-space-3);
  border-radius: var(--unimart-radius-sm);
  background: var(--unimart-bg-muted);
}
.um-me-profile__stat strong {
  font-family: var(--unimart-font-display);
  font-size: 1.1rem;
  color: var(--unimart-text);
}
.um-me-profile__stat span {
  font-size: 0.75rem;
  color: var(--unimart-text-muted);
}
.um-me-profile__loyalty {
  margin: var(--um-space-3) 0 0;
  font-size: 0.85rem;
  color: var(--unimart-text-muted);
}
.um-me-profile__loyalty i { color: var(--unimart-orange); }
.um-me-profile__order {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--unimart-border);
}
.um-me-profile__order:last-child { border-bottom: none; }
.um-me-profile__order a {
  font-weight: 700;
  color: var(--unimart-slate);
  text-decoration: none;
}
.um-me-profile__order a:hover { color: var(--unimart-orange); }
.um-me-profile__order-date,
.um-me-profile__order-total {
  font-size: 0.85rem;
  color: var(--unimart-text-muted);
  margin-left: 0.5rem;
}
.um-me-profile__order-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Seller profile — align hero CTAs with OS language */
.seller-profile-page .sp-hero__actions .um-cta--secondary {
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}
.seller-profile-page .sp-hero__actions .um-cta--secondary:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.seller-profile-page .sp-hero__actions .um-cta--ghost {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
.seller-profile-page .sp-hero__name {
  font-family: var(--unimart-font-display);
  letter-spacing: -0.02em;
}

/* Opportunity / confidence headers — keep um-* readable on scene heroes */
.om-header .um-page-eyebrow { color: var(--unimart-orange); }
.om-header .um-page-title,
.om-header .om-title.um-page-title {
  color: inherit;
  font-size: clamp(1.45rem, 4vw, 1.9rem);
}
.om-header .um-page-sub { color: inherit; opacity: 0.88; max-width: 32rem; }
.om-header .um-domain-hero__actions { margin-top: 0.85rem; }

body.sd-page .um-domain-hero--services { padding-bottom: 0.35rem; }
body.sd-page .um-domain-hero--services .sd-hero__toolbar { margin-top: var(--um-space-3); }

body.biz-show-page .um-domain-hero--businesses .um-page-title {
  font-size: clamp(1.45rem, 4vw, 1.9rem);
}

/* Search results hero spacing */
body.discover-page .um-domain-hero--search {
  padding-bottom: 0.5rem;
}
body.discover-page .um-domain-hero--search .discover__form {
  margin-top: var(--um-space-3);
}
body.discover-page .discover__submit.um-cta {
  border: none;
}

/* Shared form focus — opt-in classes + guest/discover fields only */
.um-field,
.junior-guest-form__input,
.discover__input {
  transition: border-color var(--um-motion-fast), box-shadow var(--um-motion-fast);
}
.um-field:focus-visible,
.junior-guest-form__input:focus-visible,
.discover__input:focus-visible {
  outline: none;
  border-color: var(--unimart-orange);
  box-shadow: 0 0 0 3px var(--um-focus-ring, rgba(246, 139, 30, 0.28));
}

/* Empty state — shared */
.um-empty {
  text-align: center;
  padding: var(--um-space-8) var(--um-space-4);
  color: var(--unimart-text-muted);
}
.um-empty__title {
  margin: 0 0 0.35rem;
  font-family: var(--unimart-font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--unimart-text);
}
.um-empty__body {
  margin: 0 auto;
  max-width: 22rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

/* Primary / WhatsApp CTAs — thumb-friendly */
.um-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--um-touch);
  padding: 0.7rem 1.2rem;
  border-radius: var(--unimart-radius-sm);
  font-family: var(--unimart-font-sans);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform var(--um-motion-fast), filter var(--um-motion-fast);
}
.um-cta:active { transform: scale(0.98); }
.um-cta--primary {
  background: var(--unimart-orange);
  color: #fff;
}
.um-cta--primary:hover {
  background: var(--unimart-orange-deep);
  color: #fff;
  filter: none;
}
.um-cta--whatsapp {
  background: #25d366;
  color: #fff;
}
.um-cta--whatsapp:hover { filter: brightness(1.05); color: #fff; }
.um-cta--ghost {
  background: transparent;
  color: var(--unimart-slate);
  border: 1.5px solid var(--unimart-border);
}
.um-cta--ghost:hover {
  border-color: var(--unimart-slate);
  color: var(--unimart-slate);
}
.um-cta--block { width: 100%; }

/* Skeleton */
.um-skel {
  background: linear-gradient(90deg, var(--unimart-bg-muted) 25%, #eceef2 50%, var(--unimart-bg-muted) 75%);
  background-size: 200% 100%;
  animation: umSkel 1.2s ease-in-out infinite;
  border-radius: var(--unimart-radius-sm);
}
@keyframes umSkel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Confidence nav — clearer active state ── */
.unimart-nav--confidence .unimart-nav__item.is-active::after,
.unimart-nav--confidence .unimart-nav__item[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0.15rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1.1rem;
  height: 3px;
  border-radius: 999px;
  background: var(--unimart-orange);
}

.unimart-nav--confidence .unimart-nav__item {
  min-height: 52px;
  transition: color var(--um-motion-fast);
}

.unimart-nav--confidence .unimart-nav__item--agent.is-active,
.unimart-nav--confidence .unimart-nav__item--agent[aria-current="page"] {
  color: var(--unimart-orange) !important;
}

/* Create / More sheets — shared UNIMART chrome */
.cn-sheet__title,
.dm-sheet__title {
  font-family: var(--unimart-font-display) !important;
  letter-spacing: -0.02em;
}
.cn-sheet__panel .um-page-eyebrow,
.dm-sheet__heading .um-page-eyebrow {
  margin-bottom: 0.2rem;
}
.cn-list-action {
  min-height: var(--um-touch);
  transition: background var(--um-motion-fast), transform var(--um-motion-fast), border-color var(--um-motion-fast);
}
.cn-list-action:active { transform: scale(0.99); }
.cn-list-action__label {
  font-weight: 700;
}

/* ── Confidence flat headers — brand-first ── */
body.confidence-flat-page .home-intel__greeting,
body.confidence-flat-page .om-title {
  font-family: var(--unimart-font-display);
  letter-spacing: -0.02em;
}

body.confidence-flat-page .home-intel__header {
  padding-top: 0.35rem;
}

body.confidence-flat-page .um-page-eyebrow + .home-intel__greeting {
  margin-top: 0;
}

/* ── Today — one composition first viewport ── */
body.today-brand-page .tb-brief {
  min-height: min(72vh, 36rem);
}

/* Today OS home — compact hero (overrides briefing fold height) */
body.today-os-page.today-brand-page .tb-brief,
body.today-os-page .tos-hero {
  min-height: 0 !important;
}

body.today-brand-page .tb-brief__shell {
  width: min(34rem, calc(100% - 1.75rem));
  gap: 0.85rem;
  padding-top: 1.35rem;
}

body.today-brand-page .tb-eyebrow {
  letter-spacing: 0.14em;
  font-weight: 800;
}

body.today-brand-page .tb-greeting {
  font-size: clamp(1.65rem, 5vw, 2.15rem);
  line-height: 1.12;
}

body.today-brand-page .tb-hook {
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 22rem;
  opacity: 0.92;
}

/* Depth sections — quieter rhythm */
body.today-brand-page .tb-depth,
body.today-brand-page .home-intel--brand .today-flat__section {
  scroll-margin-top: 0.5rem;
}

body.today-brand-page .today-flat__section-title,
body.today-brand-page .tb-depth .um-section__title {
  font-family: var(--unimart-font-display);
}

/* Soft fade into depth after briefing */
body.today-brand-page .tb-depth {
  position: relative;
  padding-top: 0.5rem;
}
body.today-brand-page .tb-depth::before {
  content: "";
  display: block;
  height: 1px;
  margin: 0 auto 1rem;
  max-width: 4rem;
  background: var(--unimart-border);
}

/* ── For Me / opportunity board ── */
.om-header__copy .om-eyebrow {
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--unimart-orange);
}
.om-title {
  font-family: var(--unimart-font-display);
}
.om-sub {
  max-width: 26rem;
}

body.learn-board-confidence .today-flat__row {
  transition: background var(--um-motion-fast);
}
body.learn-board-confidence .today-flat__row:active {
  background: var(--unimart-bg-muted);
}

/* Match badges — orange family only (no blue drift) */
.opp-conf--good {
  background: rgba(44, 62, 80, 0.1) !important;
  color: var(--unimart-slate) !important;
}
.opp-conf--strong {
  background: rgba(246, 139, 30, 0.16) !important;
  color: var(--unimart-orange-deep) !important;
}

/* ── Business detail — mini landing cohesion ── */
body.biz-page {
  background: var(--unimart-bg);
}
body.biz-page .biz-page__title {
  font-family: var(--unimart-font-display);
  letter-spacing: -0.02em;
}
body.biz-page .biz-page__hero {
  border-radius: 0 0 var(--unimart-radius) var(--unimart-radius);
}
body.biz-page .biz-page__lead {
  color: var(--unimart-text-muted);
  line-height: 1.45;
}
body.biz-page a[href*="wa.me"],
body.biz-page .biz-page__wa,
body.biz-page .whatsapp-cta {
  min-height: var(--um-touch);
}

/* ── Service detail ── */
body.service-discovery-page .svc-detail__title,
.service-detail .listing-title,
.sd-detail__title {
  font-family: var(--unimart-font-display);
  letter-spacing: -0.02em;
}

/* ── Product detail ── */
body.pdp-2040-page .pdp-hub__title,
body.pdp-2040-page h1 {
  font-family: var(--unimart-font-display);
}
body.pdp-2040-page .pdp-hub__price {
  font-weight: 800;
  color: var(--unimart-slate);
}

/* ── Opportunity detail ── */
body.opp-layer-page .opp-detail__title,
.opp-detail h1 {
  font-family: var(--unimart-font-display);
  letter-spacing: -0.02em;
}

/* ── Search — cleaner chrome ── */
.search-results-page .commerce-intent-bar,
body:has(.search-results) .commerce-intent__input {
  border-radius: var(--unimart-radius);
}
.today-flat__input-wrap,
.today-flat__input {
  border-radius: 999px;
}
.today-flat__input:focus {
  box-shadow: var(--um-focus-ring);
  border-color: var(--unimart-orange);
  outline: none;
}

/* Ecosystem search sections */
.discover-results__section-title,
.search-section__label {
  font-family: var(--unimart-font-display);
  font-size: 1.05rem;
}

/* ── Junior / assistant — calmer landing ── */
body.assistant-confidence-page .confidence-agent-landing,
body.assistant-confidence-page .jj-landing {
  font-family: var(--unimart-font-sans);
}
body.assistant-confidence-page h1,
body.assistant-confidence-page .jj-landing__title {
  font-family: var(--unimart-font-display);
}

/* Suggested chips — no pill-cluster overload */
.assistant-chip,
.jj-chip,
.agent-suggest-chip {
  border-radius: 999px;
  border: 1px solid var(--unimart-border);
  background: var(--unimart-bg);
  color: var(--unimart-text);
  font-weight: 600;
  min-height: 2.25rem;
  padding: 0.4rem 0.85rem;
  transition: border-color var(--um-motion-fast), color var(--um-motion-fast);
}
.assistant-chip:hover,
.jj-chip:hover,
.agent-suggest-chip:hover {
  border-color: var(--unimart-orange);
  color: var(--unimart-orange-deep);
}

/* ── Me dashboard ── */
body.confidence-flat-page.me-confidence-page .confidence-flat__score-ring,
body.confidence-flat-page .confidence-flat__score-ring {
  border-width: 3px;
}

/* ── Campus profile ── */
body.tour-landing-active .tl-hero__title,
body.cn-uniz-hub-page h1 {
  font-family: var(--unimart-font-display);
}

/* ── Desktop: expanded mobile, same workflows ── */
@media (min-width: 768px) {
  body.has-confidence-nav .content-inner,
  body.confidence-flat-page .home-intel__wrap,
  body.today-brand-page .tb-depth .home-intel__wrap {
    max-width: var(--um-shell-laptop, 1120px);
    margin-left: auto;
    margin-right: auto;
  }

  .unimart-nav--confidence .unimart-nav__item.is-active::after {
    bottom: 0.35rem;
  }
}

.um-empty__icon {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  color: var(--unimart-orange);
  opacity: 0.85;
}

/* Lead / WhatsApp contact bar — thumb-friendly */
.um-lead-bar__btn,
.um-lead-bar__btn--whatsapp {
  min-height: var(--um-touch);
  border-radius: var(--unimart-radius-sm);
  font-weight: 700;
}
.um-lead-bar__btn--whatsapp {
  background: #25d366 !important;
  color: #fff !important;
}

/* Service detail hero */
body.sd-service .sd-service-header h1,
body.sd-service .sd-service-title {
  font-family: var(--unimart-font-display);
  letter-spacing: -0.02em;
}
body.sd-service .sd-btn--primary {
  background: var(--unimart-orange);
  border-color: var(--unimart-orange);
  min-height: var(--um-touch);
  font-weight: 700;
}

/* Create + More sheets — shared intro spacing */
.cn-sheet__header {
  padding-bottom: 0.75rem;
}
.cn-sheet__title::after {
  content: none;
}

/* More grid — calmer tiles */
.cn-more-tile {
  transition: transform var(--um-motion-fast), border-color var(--um-motion-fast), box-shadow var(--um-motion-fast);
}
.cn-more-tile:active {
  transform: scale(0.98);
}

/* Today briefing — keep identity dominant; secondary glass quieter */
@media (max-width: 575px) {
  body.today-brand-page .tb-glass--panel,
  body.today-brand-page .tb-glass--action {
    padding: 0.65rem 0.75rem;
  }
  body.today-brand-page .tb-brief__shell {
    gap: 0.55rem;
  }
}

body.sd-service .sd-btn--wa {
  background: #25d366 !important;
  border-color: #25d366 !important;
  color: #fff !important;
  min-height: var(--um-touch);
  font-weight: 700;
}
body.opp-detail-brand .opp-detail-hero__caption h1,
body.opp-detail-brand .opp-detail__title {
  font-family: var(--unimart-font-display);
  letter-spacing: -0.02em;
}

/* Ecosystem / discover search */
body.discover-page .discover__results-title {
  font-family: var(--unimart-font-display);
  letter-spacing: -0.02em;
}
body.discover-page .discover__submit {
  background: var(--unimart-orange);
  border-color: var(--unimart-orange);
  font-weight: 700;
  min-height: 2.5rem;
}
body.search-results-page .soko-ai-hero-title {
  font-family: var(--unimart-font-display);
  letter-spacing: -0.02em;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tb-scene__photo,
  .tb-glass,
  .um-skel,
  .um-cta,
  .cn-list-action,
  .cn-more-tile {
    animation: none !important;
    transition: none !important;
  }
}

/* High contrast support */
@media (prefers-contrast: more) {
  :root {
    --unimart-border: #9ca3af;
    --unimart-text-muted: #4b5563;
  }
  .um-cta--primary {
    border: 2px solid var(--unimart-slate);
  }
}
