/* ==========================================================================
   LeGlamorous Jewels — Price requests, customization requests and chat
   Used by the partner portal (b2b/price-requests, b2b/chat, product page) and the admin panel
   (admin/price-requests, admin/chat). Mobile first: everything stacks below 900px.
   ========================================================================== */

/* ── Menu badges (unread replies / messages) ─────────────────────────── */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 .38rem; margin-left: .5rem;
  border-radius: var(--r-full); background: var(--gold-fill, #C9A24B); color: var(--ink, #1c1814); font-size: .7rem; font-weight: 800; line-height: 1; vertical-align: middle; }
.nav-badge.hidden, .pill.hidden { display: none !important; }

/* ── Product page actions + attached files ───────────────────────────── */
.pd-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 1rem; }
.pd-actions .btn { flex: 0 1 auto; }
.file-chip { display: inline-flex; align-items: center; gap: .4rem; max-width: 100%; padding: .3rem .65rem; margin: 0 .4rem .4rem 0; border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--surface-2, #faf7f2); font-size: .84rem; color: var(--ink); text-decoration: none; word-break: break-all; }
.file-chip svg { width: 15px; height: 15px; flex: none; }
.file-chip small { color: var(--ink-3, #6b6259); }
a.file-chip:hover { border-color: var(--gold); }

/* ── Filter chips with counts ─────────────────────────────────────────── */
.status-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.status-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .9rem; border: 1px solid var(--line); border-radius: var(--r-full); background: #fff;
  color: var(--ink-2); font-weight: 600; font-size: .88rem; cursor: pointer; font-family: inherit; }
.status-tab .n { display: inline-block; min-width: 20px; padding: 0 .35rem; border-radius: var(--r-full); background: var(--surface-2, #f2eee7); color: var(--ink-2); font-size: .74rem; text-align: center; }
.status-tab.active { border-color: var(--gold); background: var(--gold-tint, #f7f0de); color: var(--ink); }
.status-tab.active .n { background: var(--gold-fill, #C9A24B); color: var(--ink); }

/* ── Request list ─────────────────────────────────────────────────────── */
.req-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: .9rem; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.req-row:last-child { border-bottom: 0; }
.req-row:hover { background: var(--surface-2, #faf7f2); }
.req-row .thumb-sm { width: 56px; height: 56px; border-radius: var(--r-sm, 6px); object-fit: cover; background: var(--surface-2, #f2eee7); display: grid; place-items: center; overflow: hidden; }
.req-row .thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.req-row .thumb-sm svg { width: 26px; height: 26px; opacity: .45; }
.req-title { font-weight: 700; display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.req-sub { color: var(--ink-3, #6b6259); font-size: .85rem; margin-top: .15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-side { text-align: right; display: grid; gap: .3rem; justify-items: end; }
.req-quote { font-weight: 800; color: var(--gold-text, #8a6a1f); }
.new-dot { display: inline-block; padding: .05rem .5rem; border-radius: var(--r-full); background: var(--gold-fill, #C9A24B); color: var(--ink); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }

/* ── Request detail / conversation ────────────────────────────────────── */
.req-detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.req-thread { display: grid; gap: .9rem; }
.req-msg { border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: #fff; padding: .9rem 1.1rem; }
.req-msg.from-team { border-color: var(--gold); background: var(--gold-tint, #f7f0de); }
.req-msg .who { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .82rem; color: var(--ink-3, #6b6259); margin-bottom: .35rem; }
.req-msg .who strong { color: var(--ink); }
.req-msg .text { white-space: pre-wrap; word-break: break-word; }
.quote-box { display: inline-flex; align-items: baseline; gap: .6rem; margin: .5rem 0 .2rem; padding: .5rem .9rem; border-radius: var(--r-md, 10px); background: #fff; border: 1px solid var(--gold); }
.quote-box span { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3, #6b6259); font-weight: 700; }
.quote-box strong { font-size: 1.35rem; font-family: var(--serif, Georgia, serif); color: var(--gold-text, #8a6a1f); }
.req-product { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: .8rem; align-items: center; }
.req-product .thumb-lg { width: 72px; height: 72px; border-radius: var(--r-sm, 6px); overflow: hidden; background: var(--surface-2, #f2eee7); display: grid; place-items: center; }
.req-product .thumb-lg img { width: 100%; height: 100%; object-fit: cover; }
.reply-form textarea { min-height: 110px; }

/* ── Chat ─────────────────────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; height: min(680px, calc(100vh - 230px)); min-height: 420px; border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: #fff; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--surface-2, #faf7f2); }
.chat-head h3 { margin: 0; font-size: 1.05rem; font-family: var(--sans, inherit); font-weight: 700; letter-spacing: 0; }
.chat-head .sub { color: var(--ink-3, #6b6259); font-size: .82rem; }
.chat-head .grow { flex: 1; min-width: 0; }
.chat-head .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; background: #fbf9f5; scroll-behavior: smooth; }
.chat-day { align-self: center; margin: .6rem 0 .3rem; padding: .15rem .7rem; border-radius: var(--r-full); background: var(--surface-2, #efe9de); color: var(--ink-3, #6b6259); font-size: .74rem; font-weight: 700; }
.bubble { max-width: min(78%, 520px); padding: .5rem .8rem .35rem; border-radius: 14px; border: 1px solid var(--line); background: #fff; word-break: break-word; }
.bubble.mine { align-self: flex-end; background: var(--gold-tint, #f7f0de); border-color: #e5d3a6; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble .name { font-size: .72rem; font-weight: 800; color: var(--gold-text, #8a6a1f); margin-bottom: .1rem; }
.bubble .body { white-space: pre-wrap; line-height: 1.45; }
.bubble .body a { color: var(--gold-text, #8a6a1f); text-decoration: underline; }
.bubble .meta { display: flex; justify-content: flex-end; gap: .45rem; margin-top: .15rem; font-size: .7rem; color: var(--ink-3, #6b6259); }
.bubble.pending { opacity: .65; }
.bubble.failed { border-color: var(--danger); background: var(--danger-bg, #fdecea); }
.bubble .retry { border: 0; background: none; color: var(--danger); font-weight: 700; cursor: pointer; padding: 0; font-size: .72rem; text-decoration: underline; font-family: inherit; }
.chat-more { align-self: center; margin-bottom: .4rem; }
.chat-empty { margin: auto; text-align: center; color: var(--ink-3, #6b6259); max-width: 320px; }
.chat-empty svg { width: 38px; height: 38px; opacity: .4; margin-bottom: .4rem; }
.chat-attachment-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--surface-2, #faf7f2);
  border-top: 1px solid var(--line);
  animation: slideDown 0.2s ease;
}
.chat-attachment-bar.hidden { display: none !important; }
.chat-att-preview {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-att-icon {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--gold-dark, #8a6a1f);
}
.chat-att-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.chat-att-name {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-att-size {
  font-size: 0.75rem;
  color: var(--ink-3, #6b6259);
}
.chat-att-remove {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.chat-att-remove:hover { color: var(--danger, #c0392b); }

.chat-attach-btn {
  height: 44px;
  width: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid var(--line-strong, #d8d0c2);
  border-radius: 12px;
  background: var(--surface-2, #faf7f2);
  color: var(--ink-2);
  transition: all 0.2s;
  flex-shrink: 0;
}
.chat-attach-btn:hover {
  background: #fff;
  border-color: var(--gold);
  color: var(--gold-text, #8a6a1f);
}

/* Chat bubble media previews */
.chat-media-card {
  margin: 0.25rem 0 0.5rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.03);
}
.chat-thumb-img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.chat-thumb-img:hover { opacity: 0.92; }
.chat-player {
  display: block;
  max-width: 100%;
  max-height: 340px;
  width: 100%;
  border-radius: 6px;
  background: #000;
}
.chat-media-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  background: rgba(0,0,0,0.04);
}
.chat-media-title {
  color: var(--ink-2);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-dl-btn {
  color: var(--gold-text, #8a6a1f);
  display: flex;
  align-items: center;
  text-decoration: none;
  padding: 0.15rem;
}
.chat-dl-btn:hover { color: var(--ink); }

.chat-composer { display: flex; gap: .6rem; align-items: flex-end; padding: .75rem 1rem; border-top: 1px solid var(--line); background: #fff; }
.chat-composer textarea { flex: 1; min-height: 44px; max-height: 140px; resize: none; padding: .6rem .8rem; border: 1px solid var(--line-strong, #d8d0c2); border-radius: 12px; font: inherit; line-height: 1.4; }
.chat-composer textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.chat-composer .btn { height: 44px; }
.chat-note { padding: .35rem 1rem .6rem; font-size: .76rem; color: var(--ink-3, #6b6259); background: #fff; }


/* Admin: partner list + conversation side by side */
.chat-admin { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 1rem; align-items: start; }
.chat-list { border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: #fff; overflow: hidden; height: min(680px, calc(100vh - 230px)); min-height: 420px; display: flex; flex-direction: column; }
.chat-list-tools { padding: .75rem; border-bottom: 1px solid var(--line); display: grid; gap: .55rem; }
.chat-list-items { overflow-y: auto; flex: 1; }
.conv { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: .7rem; align-items: center; width: 100%; padding: .7rem .9rem; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.conv:hover { background: var(--surface-2, #faf7f2); }
.conv.active { background: var(--gold-tint, #f7f0de); }
.conv .avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ink, #1c1814); color: var(--gold-bright, #e8c978); font-weight: 800; font-size: .85rem; }
.conv .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .pv { color: var(--ink-3, #6b6259); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .when { font-size: .72rem; color: var(--ink-3, #6b6259); text-align: right; }
.conv .cnt { display: inline-block; margin-top: .2rem; min-width: 20px; padding: 0 .38rem; border-radius: var(--r-full); background: var(--gold-fill, #C9A24B); color: var(--ink); font-size: .7rem; font-weight: 800; text-align: center; line-height: 20px; }
.chat-pane-empty { height: min(680px, calc(100vh - 230px)); min-height: 420px; border: 1px dashed var(--line-strong, #d8d0c2); border-radius: var(--r-md, 10px); display: grid; place-items: center; text-align: center; color: var(--ink-3, #6b6259); padding: 1rem; }
.chat-back { display: none; }

@media (max-width: 900px) {
  .req-detail { grid-template-columns: minmax(0, 1fr); }
  .chat-admin { grid-template-columns: minmax(0, 1fr); }
  .chat-admin .chat-pane { display: none; }
  .chat-admin.show-thread .chat-list { display: none; }
  .chat-admin.show-thread .chat-pane { display: block; }
  .chat-back { display: inline-flex; }
  .chat, .chat-list, .chat-pane-empty { height: calc(100vh - 190px); min-height: 380px; }
  .bubble { max-width: 88%; }
  .chat-head-wrap { flex-wrap: wrap; }
  .chat-head-wrap .grow { flex: 1 1 100%; }
  .chat-head-wrap .grow > * { white-space: normal; }
  .req-row { grid-template-columns: 48px minmax(0, 1fr); }
  .req-row .thumb-sm { width: 48px; height: 48px; }
  .req-side { grid-column: 1 / -1; text-align: left; justify-items: start; grid-auto-flow: column; justify-content: space-between; align-items: center; }
}

/* Header menu items stay on one line (the badge sits beside the label) */
.main-nav a { white-space: nowrap; }
