/* Book Inquiries: the book page's "Ask the seller" and "Delivery & pickup" cards,
   My Inquiries / Book Inquiries lists, and one conversation (Inquiries/Conversation).
   Message bubbles use the ex-msg classes that exchange-chat.js writes. */

.iq-card {
  --iq-royal: #1D4ED8; --iq-royal-soft: #e8eefc; --iq-line: #e1e4d8; --iq-ink: #1a2116; --iq-soft: #52514e;
  --iq-good: #1d6b3a; --iq-good-bg: #e2f2e8; --iq-bad: #b42318; --iq-bad-bg: #fdecea; --iq-warn: #8a5300; --iq-warn-bg: #fbefd2;
  border: 1px solid var(--iq-line); border-radius: 14px; background: #fff; color: var(--iq-ink);
  padding: 14px 16px; margin-bottom: 1rem;
}
.iq-card h2, .iq-card h3 { font-size: 1.05rem; font-weight: 800; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.iq-card .iq-sub { color: var(--iq-soft); font-size: .9rem; margin: 0 0 10px; }
.iq-ico { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--iq-royal-soft); color: var(--iq-royal); flex: none; }
.iq-ico svg { width: 17px; height: 17px; }

/* Topic chips (radio buttons styled as pills) */
.iq-topics { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; border: 0; padding: 0; }
.iq-topics input { position: absolute; opacity: 0; pointer-events: none; }
.iq-topics label { border: 1px solid var(--iq-line); border-radius: 999px; padding: 4px 11px; font-size: .84rem; font-weight: 600; cursor: pointer; background: #fff; color: var(--iq-ink); user-select: none; }
.iq-topics label:hover { border-color: var(--iq-royal); }
.iq-topics input:checked + label { background: var(--iq-royal); border-color: var(--iq-royal); color: #fff; }
.iq-topics input:focus-visible + label { outline: 3px solid #C9A961; outline-offset: 2px; }
.iq-ask textarea { resize: vertical; }
.iq-ask-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.iq-ask-foot small { color: var(--iq-soft); }
.iq-existing { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--iq-royal-soft); }
.iq-existing p { margin: 0; flex: 1 1 220px; }
.iq-new { display: inline-block; background: var(--iq-royal); color: #fff; border-radius: 999px; padding: 0 8px; font-size: .75rem; font-weight: 700; }

/* Delivery & pickup card */
.iq-check { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-radius: 10px; margin: 8px 0; font-weight: 600; font-size: .93rem; }
.iq-check.good { background: var(--iq-good-bg); color: var(--iq-good); }
.iq-check.bad { background: var(--iq-bad-bg); color: var(--iq-bad); }
.iq-check.warn { background: var(--iq-warn-bg); color: var(--iq-warn); }
.iq-check a { color: inherit; text-decoration: underline; }
.iq-areas { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: .92rem; }
.iq-areas li { display: flex; gap: 6px; }
.iq-areas b { white-space: nowrap; }
.iq-row { display: grid; grid-template-columns: 26px 1fr; gap: 6px 8px; padding: 10px 0; border-top: 1px dashed var(--iq-line); }
.iq-row:first-of-type { border-top: 0; padding-top: 4px; }
.iq-row > span { font-size: 1.1rem; line-height: 1.4; }
.iq-row p { margin: 2px 0 0; color: var(--iq-soft); font-size: .9rem; }
.iq-try { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.iq-try select { flex: 1 1 140px; min-width: 0; max-width: 100%; }
.iq-try [data-dc-result] { flex-basis: 100%; }

/* Lists */
.iq-list { list-style: none; margin: 0; padding: 0; }
.iq-item { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid #eef0ea; color: inherit; text-decoration: none; }
.iq-list li:first-child .iq-item { border-top: 0; }
.iq-item:hover { background: #f6f8fd; }
.iq-item.has-new { background: #f3f6fe; }
.iq-item img, .iq-item .iq-cover { width: 48px; height: 66px; object-fit: cover; border-radius: 6px; background: #eef0ea; }
.iq-item-main { min-width: 0; display: grid; gap: 2px; }
.iq-item-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iq-item-main .iq-last { color: #52514e; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iq-item-main .iq-meta { color: #6b6a64; font-size: .8rem; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.iq-item-side { display: grid; justify-items: end; gap: 4px; font-size: .8rem; color: #6b6a64; white-space: nowrap; }
.iq-pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .75rem; font-weight: 700; }
.iq-pill.needs { background: #fdecea; color: #b42318; }
.iq-pill.replied { background: #e2f2e8; color: #1d6b3a; }
.iq-pill.waiting { background: #fbefd2; color: #8a5300; }
.iq-pill.closed { background: #eef0ea; color: #52514e; }
.iq-pill.topic { background: #e8eefc; color: #1D4ED8; }
.iq-empty { padding: 34px 18px; text-align: center; color: #52514e; }
.iq-empty span { font-size: 2rem; display: block; }

/* One conversation */
.iq-convo-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; padding-block: 12px 40px; }
.iq-convo { border: 1px solid #e1e4d8; border-radius: 14px; background: #fff; display: flex; flex-direction: column; min-width: 0; }
.iq-convo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid #eef0ea; }
.iq-convo-head h1 { font-size: 1.15rem; font-weight: 800; margin: 0; flex: 1 1 240px; min-width: 0; }
.iq-convo-head h1 small { display: block; font-size: .82rem; font-weight: 600; color: #6b6a64; }
.iq-messages { display: flex; flex-direction: column; gap: .6rem; min-height: 220px; max-height: 60vh; overflow-y: auto; padding: 14px 16px; background: #f7f8f4; }
.iq-messages .ex-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.iq-messages .ex-msg.is-mine { align-self: flex-end; align-items: flex-end; }
.iq-messages .ex-msg-bubble { padding: .55rem .8rem; border-radius: 1rem 1rem 1rem .25rem; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); white-space: pre-wrap; overflow-wrap: anywhere; }
.iq-messages .ex-msg.is-mine .ex-msg-bubble { border-radius: 1rem 1rem .25rem 1rem; background: #1D4ED8; color: #fff; }
.iq-messages .ex-msg-time { margin-top: .15rem; color: #6b6a64; font-size: .75rem; }
.iq-messages .ex-msg.is-arriving { animation: iq-in .25s ease-out; }
@keyframes iq-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .iq-messages .ex-msg.is-arriving { animation: none; } }
.iq-day { align-self: center; font-size: .75rem; color: #6b6a64; background: #eef0ea; border-radius: 999px; padding: 1px 10px; }
.iq-compose { padding: 12px 16px 14px; border-top: 1px solid #eef0ea; display: grid; gap: 8px; }
.iq-compose .ex-compose { display: flex; gap: .5rem; align-items: flex-end; }
.iq-compose textarea { flex: 1; min-width: 0; resize: vertical; }
.iq-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.iq-quick button { border: 1px solid #e1e4d8; background: #fff; border-radius: 999px; padding: 3px 10px; font-size: .8rem; font-weight: 600; color: #1a2116; cursor: pointer; }
.iq-quick button:hover { border-color: #1D4ED8; color: #1D4ED8; }
.iq-closed-note { margin: 0; padding: 10px 16px; background: #eef0ea; color: #52514e; font-size: .9rem; }
.iq-side { display: grid; gap: 12px; position: sticky; top: 12px; }
.iq-book { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; }
.iq-book img { width: 64px; height: 90px; object-fit: cover; border-radius: 6px; background: #eef0ea; }
.iq-book a.title { font-weight: 800; color: #1a2116; text-decoration: none; }
.iq-book a.title:hover { color: #1D4ED8; }
.iq-price { font-size: 1.15rem; font-weight: 800; }
.iq-tip { font-size: .85rem; color: #52514e; margin: 0; }

@media (max-width: 900px) {
  .iq-convo-wrap { grid-template-columns: 1fr; }
  .iq-side { position: static; order: -1; }
  .iq-side .iq-card.iq-extra { display: none; }
}
@media (max-width: 560px) {
  .iq-item { grid-template-columns: 40px 1fr; }
  .iq-item img, .iq-item .iq-cover { width: 40px; height: 56px; }
  .iq-item-side { grid-column: 2; justify-items: start; grid-auto-flow: column; justify-content: start; gap: 8px; }
  .iq-messages .ex-msg { max-width: 92%; }
}

/* ---------- Book page: one compact strip with "Add to my space" and sharing ----------
   (Books/Details .bk-actions). On wide screens both sit on one line, split by a thin
   rule; narrower screens stack them. */
.bk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1.1rem; margin-bottom: 1rem; padding: .55rem .85rem; border: 1px solid #e1e4d8; border-radius: 14px; background: linear-gradient(120deg, #fff7ea, #fff 60%); }
.bk-actions:not(:has(*)) { display: none; }
.bk-actions .shore-addbar { flex: 0 1 auto; gap: .35rem; margin: 0; padding: 0; border: 0; background: none; }
.bk-actions .shore-addbar strong { margin-right: .15rem; font-size: .85rem; white-space: nowrap; }
.bk-actions .shore-addbar form { gap: .3rem !important; }
.bk-actions .shore-addbar .btn { padding: .2rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; line-height: 1.35; }
.bk-actions .shore-addbar > a { margin-left: .2rem; font-size: .8rem; white-space: nowrap; }
.bk-actions .share-bar { flex-wrap: nowrap; gap: .3rem; margin-left: auto; padding-left: 1.1rem; border-left: 1px solid #e1e4d8; }
.bk-actions-label { margin-right: .2rem; color: #52514e; font-size: .85rem; font-weight: 700; }
.bk-actions .social-icon-sm { width: 1.85rem; height: 1.85rem; flex: none; }
.bk-actions .wave-share-btn { margin-left: .2rem; padding: .22rem .7rem; font-size: .8rem; white-space: nowrap; }
.bk-actions [data-copy-status]:empty { display: none; }
@media (max-width: 1199.98px) {
  .bk-actions .share-bar { flex-wrap: wrap; width: 100%; margin-left: 0; padding: .55rem 0 0; border-left: 0; border-top: 1px dashed #e1e4d8; }
}

/* ---------- Night mode (site-wide dark theme, see night-auto.css) ---------- */
[data-blog-theme="dark"] .iq-card,
[data-blog-theme="dark"] .iq-convo { --iq-line: #2f3a2a; --iq-ink: #e5eadb; --iq-soft: #b9c2b4; --iq-royal-soft: #14204a; border-color: #2f3a2a; background: #1a1e15; color: #e5eadb; }
[data-blog-theme="dark"] .iq-topics label,
[data-blog-theme="dark"] .iq-quick button { border-color: #2f3a2a; background: #22281c; color: #e5eadb; }
[data-blog-theme="dark"] .iq-existing { background: #14204a; }
[data-blog-theme="dark"] .iq-check.good { background: #132c1b; color: #92e7b2; }
[data-blog-theme="dark"] .iq-check.bad { background: #3a1513; color: #f5a8a1; }
[data-blog-theme="dark"] .iq-check.warn { background: #33270f; color: #f1cf86; }
[data-blog-theme="dark"] .iq-row { border-top-color: #2f3a2a; }
[data-blog-theme="dark"] .iq-row p,
[data-blog-theme="dark"] .iq-tip,
[data-blog-theme="dark"] .iq-item-main .iq-last,
[data-blog-theme="dark"] .iq-item-main .iq-meta,
[data-blog-theme="dark"] .iq-item-side,
[data-blog-theme="dark"] .iq-empty { color: #b9c2b4; }
[data-blog-theme="dark"] .iq-item { border-top-color: #2f3a2a; }
[data-blog-theme="dark"] .iq-item:hover,
[data-blog-theme="dark"] .iq-item.has-new { background: #14204a; }
[data-blog-theme="dark"] .iq-convo-head,
[data-blog-theme="dark"] .iq-compose { border-color: #2f3a2a; }
[data-blog-theme="dark"] .iq-messages { background: #12160e; }
[data-blog-theme="dark"] .iq-messages .ex-msg-bubble { background: #22281c; color: #e5eadb; }
[data-blog-theme="dark"] .iq-messages .ex-msg.is-mine .ex-msg-bubble { background: #2563eb; color: #fff; }
[data-blog-theme="dark"] .iq-day,
[data-blog-theme="dark"] .iq-closed-note { background: #22281c; color: #b9c2b4; }
[data-blog-theme="dark"] .iq-book a.title { color: #e5eadb; }
[data-blog-theme="dark"] .bk-actions { border-color: #2f3a2a; background: linear-gradient(120deg, #2b2213, #1a1e15 60%); }
[data-blog-theme="dark"] .bk-actions .share-bar { border-color: #2f3a2a; }
[data-blog-theme="dark"] .bk-actions-label { color: #b9c2b4; }
