/* ============================================================
   CHANDAMART — SOCIAL / ENGAGEMENT FEATURES CSS
   Loaded alongside style.css / marketplace.css / dashboard.css.
   Reuses existing --rose / --ink / --line variables, defines
   fallbacks so this file also works standalone on vendor pages.
   ============================================================ */

.social-css-scope,
body {
  --s-rose: var(--rose);
  --s-rose-dark: var(--rose-dark, var(--rose-dark));
  --s-ink: var(--ink, #1A1A2E);
  --s-ink-soft: var(--ink-soft, #6B6B7B);
  --s-line: var(--line, #EFEFF3);
}

/* ---------- Product gallery (dedicated product page) ---------- */
.pg-gallery { position: relative; width: 100%; aspect-ratio: 1/1; background: #F5F5F7; overflow: hidden; }
.pg-gallery-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pg-gallery-track::-webkit-scrollbar { display: none; }
.pg-gallery-track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; background: #F5F5F7; scroll-snap-align: start; }
.pg-gallery-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.pg-gallery-dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.55); }
.pg-gallery-dots span.active { background: #fff; width: 16px; border-radius: 4px; }

.pg-body { padding: 16px; }
.pg-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pg-title-row h1 { font-size: 19px; font-weight: 700; }
.pg-like-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: none; flex-shrink: 0; }
.pg-like-btn .material-symbols-outlined { font-size: 26px; color: var(--s-ink-soft); }
.pg-like-btn.liked .material-symbols-outlined { color: var(--s-rose); font-variation-settings: 'FILL' 1; }
.pg-like-btn .pg-like-count { font-size: 11px; color: var(--s-ink-soft); }

.pg-shop-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 14px; cursor: pointer; }
.pg-shop-row img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.pg-shop-row .pg-shop-name { font-size: 13.5px; font-weight: 600; color: var(--s-rose-dark); }

.pg-actions { display: flex; gap: 10px; padding: 0 16px 16px; position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--s-line); padding-top: 12px; }
.pg-actions button { flex: 1; }

/* ---------- Comments section ---------- */
.comments-section { padding: 16px; border-top: 8px solid #F6F6FA; }
.comments-section h3 { font-size: 15px; margin-bottom: 12px; }
.comment-form { display: flex; gap: 8px; margin-bottom: 16px; }
.comment-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 100px; padding: 10px 12px; border: 1px solid var(--s-line); border-radius: 12px; font-family: inherit; font-size: 13.5px; }
.comment-form button { padding: 0 16px; border-radius: 12px; background: var(--s-rose); color: #fff; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.comment-form button:disabled { opacity: .5; }

.comment-item { padding: 12px 0; border-bottom: 1px solid var(--s-line); }
.comment-head { display: flex; justify-content: space-between; align-items: center; }
.comment-author { font-size: 13px; font-weight: 700; }
.comment-date { font-size: 11px; color: var(--s-ink-soft); }
.comment-body { font-size: 13.5px; line-height: 1.5; margin: 4px 0 6px; white-space: pre-wrap; word-break: break-word; }
.comment-actions { display: flex; gap: 14px; }
.comment-actions button { background: none; font-size: 11.5px; color: var(--s-ink-soft); font-weight: 600; }
.comment-actions button:hover { color: var(--s-rose); }
.comment-edited-tag { font-size: 10.5px; color: var(--s-ink-soft); font-weight: 400; }

.seller-reply { margin: 8px 0 0 18px; padding: 10px 12px; background: var(--rose-light); border-radius: 12px; border-left: 3px solid var(--s-rose); }
.seller-reply .comment-author { color: var(--s-rose-dark); }
.seller-reply .comment-author::after { content: "Seller"; font-size: 9.5px; font-weight: 700; background: var(--s-rose); color: #fff; padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: middle; }
.seller-reply-form { display: flex; gap: 6px; margin: 8px 0 0 18px; }
.seller-reply-form input { flex: 1; padding: 8px 10px; border: 1px solid var(--s-line); border-radius: 10px; font-size: 12.5px; font-family: inherit; }
.seller-reply-form button { padding: 0 12px; border-radius: 10px; background: var(--s-ink); color: #fff; font-size: 12px; font-weight: 600; }
.reply-toggle-btn { font-size: 11.5px; color: var(--s-rose-dark); font-weight: 600; margin: 6px 0 0 18px; background: none; }

.comment-edit-box { display: flex; gap: 6px; margin-top: 4px; }
.comment-edit-box textarea { flex: 1; padding: 8px 10px; border: 1px solid var(--s-line); border-radius: 10px; font-size: 13px; font-family: inherit; }

/* ---------- Home sections: Trending / Most Liked / New Arrivals ---------- */
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding: 4px 16px 12px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .card { flex: 0 0 150px; }
.section-emoji-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 2px; }
.section-emoji-head h2 { font-size: 15.5px; font-weight: 700; }

/* ---------- Seller social profile ---------- */
.shop-bio { font-size: 13px; color: var(--s-ink); line-height: 1.55; margin: 10px 0; text-align: left; padding: 0 4px; }
.shop-stats-row { display: flex; justify-content: center; gap: 22px; margin: 12px 0; }
.shop-stats-row .stat { text-align: center; }
.shop-stats-row .stat b { display: block; font-size: 16px; }
.shop-stats-row .stat span { font-size: 11px; color: var(--s-ink-soft); }

.shop-actions-row { display: flex; gap: 8px; margin-top: 14px; }
.shop-actions-row button, .shop-actions-row a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 8px; border-radius: 12px; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.shop-action-chat { background: var(--s-ink); color: #fff; }
.shop-action-follow { background: #F5F0FF; color: #6D28D9; border: 1px solid #E4D9FA; }
.shop-action-follow.following { background: var(--s-ink); color: #fff; }
.shop-action-contact { background: var(--s-rose); color: #fff; }

.shop-policies { margin: 18px 0; }
.policy-row { padding: 12px 14px; border: 1px solid var(--s-line); border-radius: 12px; margin-bottom: 8px; }
.policy-row h4 { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.policy-row p { font-size: 12.5px; color: var(--s-ink-soft); line-height: 1.5; white-space: pre-wrap; }

/* ---------- Chat ---------- */
.chat-list-item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--s-line); cursor: pointer; }
.chat-list-item img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.chat-list-item .cli-name { font-size: 13.5px; font-weight: 700; }
.chat-list-item .cli-last { font-size: 12px; color: var(--s-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.chat-list-item .cli-time { font-size: 10.5px; color: var(--s-ink-soft); flex-shrink: 0; margin-left: auto; }

.chat-thread-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--s-line); position: sticky; top: 0; background: #fff; z-index: 5; }
.chat-thread-header img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.chat-thread-header .cth-name { font-size: 14px; font-weight: 700; }
.chat-back-btn { background: none; }

.chat-messages { padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 55vh; }
.chat-bubble { max-width: 78%; padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.4; word-break: break-word; }
.chat-bubble.mine { align-self: flex-end; background: var(--s-rose); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.theirs { align-self: flex-start; background: #F0F0F3; color: var(--s-ink); border-bottom-left-radius: 4px; }
.chat-bubble-time { font-size: 9.5px; opacity: .7; margin-top: 3px; display: block; }
.chat-product-ref { align-self: center; background: var(--rose-light); color: var(--s-rose-dark); font-size: 11.5px; padding: 6px 12px; border-radius: 10px; margin-bottom: 4px; }

.chat-input-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--s-line); position: sticky; bottom: 0; background: #fff; }
.chat-input-row input { flex: 1; padding: 11px 14px; border: 1px solid var(--s-line); border-radius: 20px; font-family: inherit; font-size: 13.5px; }
.chat-input-row button { width: 42px; height: 42px; border-radius: 50%; background: var(--s-rose); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ---------- Multi-image uploader (vendor product full page) ---------- */
.mi-uploader { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mi-slot { position: relative; aspect-ratio: 1/1; border-radius: 12px; border: 1.5px dashed var(--s-line); overflow: hidden; display: flex; align-items: center; justify-content: center; background: #FAFAFC; }
.mi-slot img { width: 100%; height: 100%; object-fit: cover; }
.mi-slot input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mi-slot .mi-empty-label { font-size: 11px; color: var(--s-ink-soft); text-align: center; padding: 6px; pointer-events: none; }
.mi-slot .mi-cover-badge { position: absolute; top: 4px; left: 4px; background: var(--s-rose); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
.mi-slot .mi-remove-btn { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; z-index: 2; }
.mi-slot .mi-cover-btn { position: absolute; bottom: 4px; left: 4px; right: 4px; font-size: 9.5px; background: rgba(0,0,0,.55); color: #fff; padding: 3px; border-radius: 6px; text-align: center; z-index: 2; }

/* ---------- Product creation full page ---------- */
.pf-shell { max-width: 640px; margin: 0 auto; padding-bottom: 90px; }
.pf-section { background: #fff; border-radius: 14px; padding: 16px; margin: 12px 16px; box-shadow: 0 2px 10px rgba(20,21,43,0.05); }
.pf-section h3 { font-size: 14px; margin-bottom: 12px; }
.pf-sticky-footer { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--s-line); padding: 12px 16px; display: flex; gap: 10px; z-index: 20; }
.pf-sticky-footer button { flex: 1; padding: 13px; border-radius: 12px; font-weight: 600; font-size: 14px; }
.pf-preview-card { border: 1px solid var(--s-line); border-radius: 14px; overflow: hidden; }

@media (max-width: 480px) {
  .mi-uploader { grid-template-columns: repeat(3, 1fr); }
}

/* Vendor "Add product" preview: compact so it does not push the form far down */
#pfPreviewCard .card-img-wrap { aspect-ratio: 1 / 1; }
#pfPreviewCard .card-body { padding: 8px 10px 10px; }
