/* ============================================================
   Detail pages — shared UX pass
   ------------------------------------------------------------
   Loaded after each page's own stylesheet on every detail page
   (retail, wholesale, service, job, institution, stay). It fixes the
   issues that were identical everywhere:

     1. attribute chips: the attribute NAME is now a chip inside the
        chip, so "Brand" and "Samsung" never read as one phrase
     2. share/posting row: bigger icon, hover that stays legible in dark
     3. reviews: neutral card in both themes, no coloured glow
     4. the review poster is a single row that never wraps
     5. seller card buttons: one system, three levels of emphasis
     6. report card: quiet panel, not a striped form
     7. the account pill in the corner matches the marketplace header
     8. the Secure Buy glyph is sized like every other action icon
     9. sellers get a notice on their own listing instead of vanished buttons
   ============================================================ */

/* ---------- 1. attribute chips ---------- */

/* The attribute container is always the full width of the card it sits in,
   and a chip is never allowed to be wider than that. Long values wrap inside
   the chip instead of being clipped, so every label and value stays readable. */
.attr-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

a.attr-chip,
.attr-chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--color-border, #e4e6ea);
  border-radius: 8px;
  background: var(--color-surface, #f8fafc);
  color: var(--color-on-surface, #24344a);
  font-size: 1.2rem;
  line-height: 1.35;
  text-decoration: none;
  /* Grow to the container, never past it, and never below the content. */
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.attr-chip svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--color-on-muted, #64748b);
}

/* The label is its own mini-chip: muted, uppercase, tight. The value keeps
   full ink weight, which is what makes the pair readable at a glance. */
.attr-chip b {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--color-border, #e4e6ea);
  background: var(--white, #fff);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-on-muted, #64748b);
  white-space: nowrap;
}

/* The value takes the remaining width and wraps: a long place name, size list
   or model number is shown in full, never cut with an ellipsis. */
.attr-chip i {
  flex: 1 1 auto;
  min-width: 0;
  font-style: normal;
  font-weight: 600;
  font-size: 1.22rem;
  color: var(--color-on-surface, #16233a);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: visible;
  text-overflow: clip;
}

a.attr-chip:hover,
a.attr-chip:focus-visible {
  border-color: var(--color-primary, #0b3c5d);
  background: var(--color-surface, #f1f5f9);
  color: var(--color-on-surface, #16233a);
}

[data-theme="dark"] a.attr-chip,
[data-theme="dark"] .attr-chip {
  background: #131d2e;
  border-color: #24314b;
  color: #e7eefb;
}

[data-theme="dark"] .attr-chip b {
  background: #1a2740;
  border-color: #2b3a55;
  color: #a9bbd4;
}

[data-theme="dark"] .attr-chip i { color: #f1f6ff; }

/* ---------- 2. posted row + share ---------- */

.posted {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  color: var(--color-on-muted, #5b7186);
  font-weight: 500;
}

.posted button,
.share-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--color-border, #e4e6ea);
  border-radius: 999px;
  background: var(--white, #fff);
  color: var(--color-on-surface, #24344a);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transform: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.posted button:hover,
.posted button:focus-visible,
.share-detail-btn:hover,
.share-detail-btn:focus-visible {
  background: var(--color-surface, #f1f5f9);
  border-color: var(--color-primary, #0b3c5d);
  color: var(--color-on-surface, #16233a);
  transform: none;
  box-shadow: none;
  filter: none;
}

.posted button:focus-visible,
.share-detail-btn:focus-visible {
  outline: 2px solid var(--color-primary, #0b3c5d);
  outline-offset: 2px;
}

/* The share glyph was 15px and got lost beside the label. 18px matches the
   icon size used in the rest of the action set. */
.posted button svg,
.share-detail-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: currentColor;
}

[data-theme="dark"] .posted button,
[data-theme="dark"] .share-detail-btn {
  background: #17223a;
  border-color: #2b3a55;
  color: #e7eefb;
}

/* The old dark hover painted an orange surface under orange text. Neutral
   surface + full-contrast ink instead. */
[data-theme="dark"] .posted button:hover,
[data-theme="dark"] .posted button:focus-visible,
[data-theme="dark"] .share-detail-btn:hover,
[data-theme="dark"] .share-detail-btn:focus-visible {
  background: #22314d;
  border-color: #4d668f;
  color: #ffffff;
}

/* ---------- 3. reviews ---------- */

.productComments .comment,
.comment {
  background: var(--white, #fff);
  border: 1px solid var(--color-border, #e4e6ea);
  border-radius: 12px;
  box-shadow: none;
}

.comment:hover {
  transform: none;
  box-shadow: 0 1px 2px rgba(15, 39, 66, 0.08);
  border-color: var(--color-on-muted, #94a3b8);
}

.commentData span.reviewComment,
.comment p,
.comment .reviewComment {
  color: var(--color-on-surface, #1f2a3a);
}

.commentData .userDet .userName span,
.comment .userName span,
.comment .username {
  color: var(--color-on-surface, #16233a);
}

.commentData .userImage {
  border: 1px solid var(--color-border, #e4e6ea);
  box-shadow: none;
}

[data-theme="dark"] .productComments .comment,
[data-theme="dark"] .comment {
  background: #131d2e;
  border-color: #24314b;
}

[data-theme="dark"] .comment:hover {
  border-color: #3a4a68;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .commentData span.reviewComment,
[data-theme="dark"] .comment p,
[data-theme="dark"] .comment .reviewComment { color: #e7eefb; }

[data-theme="dark"] .commentData .userDet .userName span,
[data-theme="dark"] .comment .userName span,
[data-theme="dark"] .comment .username { color: #ffffff; }

/* ---------- 4. review poster: one row, never wraps ---------- */

.commentInput {
  display: block;
  width: 100%;
  padding: 12px 0 4px;
}

.commentInput .inputField {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: auto;
}

.commentInput .inputField textarea {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  min-height: 46px;
  max-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--color-border, #e4e6ea);
  border-radius: 10px;
  background: var(--white, #fff);
  color: var(--color-on-surface, #1f2a3a);
  font-size: 1.3rem;
  line-height: 1.4;
  resize: none;
}

.commentInput .inputField > div {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  height: 46px;
  align-items: center;
  width: auto;
}

.commentInput .inputField div select {
  width: auto;
  max-width: 118px;
  height: 46px;
  padding: 0 8px;
  border: 1px solid var(--color-border, #e4e6ea);
  border-radius: 10px;
  background: var(--white, #fff);
  color: var(--color-on-surface, #1f2a3a);
  font-size: 1.2rem;
  outline: none;
  transform: none;
  box-shadow: none;
}

.commentInput .inputField div select:focus {
  border-color: var(--color-primary, #0b3c5d);
  box-shadow: 0 0 0 3px rgba(11, 60, 93, 0.14);
  transform: none;
}

.commentInput .inputField button,
.inputField button {
  flex: 0 0 auto;
  width: auto;
  min-width: 92px;
  height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--brand-orange-500, #ff7f11);
  color: #1a0d00;
  font-size: 1.3rem;
  font-weight: 600;
  box-shadow: none;
  transform: none;
}

.inputField button:hover {
  transform: none;
  box-shadow: none;
  filter: brightness(0.95);
}

.inputField button:focus-visible {
  outline: 2px solid var(--color-primary, #0b3c5d);
  outline-offset: 2px;
}

.comment-counter,
.commentInput .comment-photo-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .commentInput .inputField textarea,
[data-theme="dark"] .commentInput .inputField div select {
  background: #131d2e;
  border-color: #2b3a55;
  color: #e7eefb;
}

[data-theme="dark"] .commentInput .inputField textarea::placeholder { color: #8ea2bd; }

/* Phones: keep the row, shrink the fixed parts instead of stacking them. */
@media (max-width: 640px) {
  .commentInput .inputField { gap: 6px; }
  .commentInput .inputField div select { max-width: 78px; font-size: 1.05rem; padding: 0 4px; }
  .commentInput .inputField button,
  .inputField button { min-width: 64px; padding: 0 10px; font-size: 1.1rem; }
  .commentInput .inputField textarea { font-size: 1.2rem; padding: 12px 10px; }
}

/* ---------- 5. seller card actions ---------- */

.owner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.owner-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--color-border, #e4e6ea);
  border-radius: 8px;
  background: var(--white, #fff);
  color: var(--color-on-surface, #16233a);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transform: none;
  filter: none;
}

.owner-action a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: inherit;
  font-weight: inherit;
}

/* One primary action (message), one secondary (profile), two outlined
   report actions. Hierarchy by weight and border, never by four hues. */
.owner-action.msg-btn {
  grid-column: 1 / -1;
  background: var(--color-primary, #0b3c5d);
  border-color: var(--color-primary, #0b3c5d);
  color: #fff;
}

.owner-action.msg-btn a { color: #fff; }

.owner-action.danger,
.owner-action.danger-alt {
  background: var(--white, #fff);
  border-color: #d9a3a3;
  color: #a1281f;
  font-weight: 500;
}

.owner-action:hover {
  transform: none;
  box-shadow: none;
  filter: none;
  background: var(--color-surface, #f1f5f9);
  border-color: var(--color-primary, #0b3c5d);
  color: var(--color-on-surface, #16233a);
}

.owner-action.msg-btn:hover { background: #0a3352; border-color: #0a3352; color: #fff; }
.owner-action.msg-btn:hover a { color: #fff; }

.owner-action.danger:hover,
.owner-action.danger-alt:hover {
  background: #fdf3f2;
  border-color: #b42318;
  color: #8d1f17;
}

.owner-action:focus-visible {
  outline: 2px solid var(--color-primary, #0b3c5d);
  outline-offset: 2px;
}

[data-theme="dark"] .owner-action {
  background: #131d2e;
  border-color: #2b3a55;
  color: #e7eefb;
}

[data-theme="dark"] .owner-action.msg-btn { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
[data-theme="dark"] .owner-action.danger,
[data-theme="dark"] .owner-action.danger-alt { background: #1a1420; border-color: #6d3a3a; color: #ffb4ae; }
[data-theme="dark"] .owner-action:hover { background: #1b2740; border-color: #4d668f; color: #fff; }

/* ---------- 6. report product card ---------- */

.productReport {
  width: 100%;
  margin: 18px auto 0;
  padding: 18px 20px;
  border: 1px solid var(--color-border, #e4e6ea);
  border-radius: 12px;
  background: var(--white, #fff);
  box-shadow: none;
}

.productReport .header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-on-surface, #16233a);
}

.productReport .reportContent form {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.productReport textarea {
  flex: 1 1 320px;
  min-height: 90px;
  padding: 12px 14px;
  border: 1px solid var(--color-border, #e4e6ea);
  border-radius: 10px;
  background: var(--white, #fff);
  color: var(--color-on-surface, #1f2a3a);
  font: inherit;
  font-size: 1.25rem;
  resize: vertical;
}

.productReport textarea:focus {
  outline: none;
  border-color: var(--color-primary, #0b3c5d);
  box-shadow: 0 0 0 3px rgba(11, 60, 93, 0.14);
}

.productReport button[type="submit"] {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 8px;
  border: 1px solid #b42318;
  background: var(--white, #fff);
  color: #a1281f;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
}

.productReport button[type="submit"]:hover { background: #fdf3f2; }

[data-theme="dark"] .productReport { background: #131d2e; border-color: #24314b; }
[data-theme="dark"] .productReport .header { color: #e7eefb; }
[data-theme="dark"] .productReport textarea { background: #0f1729; border-color: #2b3a55; color: #e7eefb; }
[data-theme="dark"] .productReport button[type="submit"] { background: #1a1420; border-color: #6d3a3a; color: #ffb4ae; }

/* ---------- 7. corner account pill = marketplace icon group ---------- */

#user-nav-js .user-nav-pill,
.user-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--color-border, #e4e6ea);
  border-radius: 12px;
  background: var(--white, #fff);
  box-shadow: 0 1px 2px rgba(1, 42, 70, 0.06);
}

/* The marketplace header groups its icons in one plate with hairline
   separators; the detail pages get the same plate instead of loose icons. */
#user-nav-js .user-nav-pill > *,
.user-nav-pill > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  position: relative;
}

#user-nav-js .user-nav-pill > * + *::before,
.user-nav-pill > * + *::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--color-border, #e4e6ea);
}

#user-nav-js .user-nav-pill a:hover,
#user-nav-js .user-nav-pill button:hover,
.user-nav-pill a:hover,
.user-nav-pill button:hover { background: var(--color-surface, #f1f5f9); }

#user-nav-js .user-nav-pill svg,
.user-nav-pill svg { width: 20px; height: 20px; }

#user-nav-js .user-nav-pill img.userIcon,
.user-nav-pill img.userIcon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-border, #e4e6ea);
}

[data-theme="dark"] #user-nav-js .user-nav-pill,
[data-theme="dark"] .user-nav-pill {
  background: #131d2e;
  border-color: #24314b;
  box-shadow: none;
}

[data-theme="dark"] #user-nav-js .user-nav-pill > * + *::before,
[data-theme="dark"] .user-nav-pill > * + *::before { background: #2b3a55; }

[data-theme="dark"] #user-nav-js .user-nav-pill a:hover,
[data-theme="dark"] #user-nav-js .user-nav-pill button:hover,
[data-theme="dark"] .user-nav-pill a:hover,
[data-theme="dark"] .user-nav-pill button:hover { background: #1b2740; }

[data-theme="dark"] #user-nav-js .user-nav-pill svg,
[data-theme="dark"] .user-nav-pill svg { color: #e7eefb; }

/* ---------- 8. Secure Buy action glyph ---------- */

.escrowButton .escrowProduct,
.ctaSection .escrowProduct {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.escrowButton .escrowProduct svg,
.ctaSection .escrowProduct svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: currentColor;
}

.escrowButton .escrowProduct span,
.ctaSection .escrowProduct span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .attr-chip,
  .posted button,
  .share-detail-btn,
  .owner-action,
  .comment { transition: none; }
}

/* ---------- 9. "this is your listing" notice ---------- */

/* A seller who opens their own ad gets an explanation in place of the buy
   buttons, instead of an action row that has quietly emptied itself. A quiet
   amber card: it reads as a note, so it never competes with the price above
   it. Type is deliberately close to body size (1.5rem) — smaller made it look
   like fine print. Hidden until syncOwnerOnlyVisibility() runs, so buyers
   never see it. */
.ownerNotice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  margin: 4px 0 16px;
  padding: 14px 16px;
  border: 1px solid rgba(194, 131, 10, 0.26);
  border-radius: 12px;
  background: #fffbf0;
  color: var(--color-on-surface, #16233a);
  font-size: 1.4rem;
  line-height: 1.5;
  text-align: left;
}

/* Beats display:flex above when the attribute is present. */
.ownerNotice[hidden] { display: none; }

.ownerNotice-icon {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  margin-top: 1px;
  padding: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(194, 131, 10, 0.22);
  color: #a97407;
}

.ownerNotice-text {
  flex: 1 1 auto;
  min-width: 0;
}

.ownerNotice-text strong {
  display: block;
  margin-bottom: 2px;
  color: #7d5603;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

.ownerNotice-text span {
  display: block;
  color: var(--color-muted, #55657c);
  font-size: 1.35rem;
}

[data-theme="dark"] .ownerNotice {
  background: #1d2739;
  border-color: rgba(217, 160, 58, 0.32);
  color: #e7eefb;
}

[data-theme="dark"] .ownerNotice-icon {
  background: #253147;
  box-shadow: inset 0 0 0 1px rgba(217, 160, 58, 0.34);
  color: #e8b559;
}

[data-theme="dark"] .ownerNotice-text strong { color: #f2c675; }
[data-theme="dark"] .ownerNotice-text span { color: #b6c4d8; }

/* Phones: reclaim a little of the side padding without shrinking the note
   back into fine print. */
@media (max-width: 480px) {
  .ownerNotice {
    gap: 10px;
    padding: 12px 13px;
  }

  .ownerNotice-text strong { font-size: 1.4rem; }
  .ownerNotice-text span { font-size: 1.3rem; }
}

/* ---------- 10. dark-theme completion ----------
   details.css predates the token layer and still carries a handful of light
   literals that theme.css never overrode: the review composer plate, the
   character counter, the "pending review" pill, the seller "joined" date,
   and the owner card's hairlines. They are small, but on a dark page they
   stayed as bright white patches, so the whole card read as broken.
   Loaded last, so these win without !important. */

[data-theme="dark"] .commentInput .inputField {
  background: #0f1729;
  border-color: #24314b;
}

[data-theme="dark"] .comment-counter {
  background: rgba(255, 255, 255, 0.07);
  color: #9fb0c6;
}

[data-theme="dark"] .comment-counter.comment-counter-full {
  background: rgba(255, 135, 135, 0.16);
  color: #ff9b9b;
}

[data-theme="dark"] .pending-badge {
  background: rgba(163, 130, 255, 0.18);
  color: #d5c4ff;
}

[data-theme="dark"] .owner-id .joined,
[data-theme="dark"] .uname span.joined,
[data-theme="dark"] .owner-meta ~ .joined {
  color: #9fb0c6;
}

[data-theme="dark"] .productComments .userContainer,
[data-theme="dark"] .productComments .comments {
  background: #121a2b;
  border-color: #24314b;
  box-shadow: none;
}

[data-theme="dark"] .productInfo .info .info-label {
  color: #9fb0c6;
}

[data-theme="dark"] .commentInput .inputField button,
[data-theme="dark"] .inputField button {
  color: #1a0d00;
  box-shadow: none;
}

[data-theme="dark"] .review-photo,
[data-theme="dark"] .photo-preview {
  border-color: #2b3a55;
}


/* ---------- 11. legibility fixes (light + dark) ----------
   `--color-muted` is a surface token in tokens.css (#eef2f7), not an ink
   token, so any text that used it on a white card disappeared. These rules
   pin real ink colours for the owner notice and the report card, and give
   the seller-ad price its own light text on the dark dark-theme plate. */
html:not([data-theme="dark"]) .ownerNotice-text span {
  color: #4a5a70;
}

html:not([data-theme="dark"]) .ownerNotice-text strong {
  color: #7a5303;
}

html:not([data-theme="dark"]) .productReport .header {
  color: #16233a;
}

.productReport textarea::placeholder {
  color: #6b7a90;
  opacity: 1;
}

html:not([data-theme="dark"]) .productReport textarea {
  color: #1f2a3a;
  background: #ffffff;
}

[data-theme="dark"] .productReport textarea::placeholder {
  color: #93a4bd;
}

/* The seller's other ads: the price pill must stay readable on its dark
   plate. --white flips to #121a2b in dark mode, which painted dark text on a
   dark gradient. */
[data-theme="dark"] .oa-card-price {
  color: #ffffff;
  background: linear-gradient(135deg, #14395d, #1f5a86);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .oa-card-title,
[data-theme="dark"] .oa-card-desc,
[data-theme="dark"] .oa-card-condition,
[data-theme="dark"] .oa-card-region {
  color: #dbe6f3;
}

[data-theme="dark"] .oa-card-desc {
  color: #9fb3c8;
}
