/* CloudzFun Parties — native Partiful-style DM modal + inbox. Light, clean theme,
   independent of the event theme tokens. Paired with public/js/party-dm.js. */

.pdm-modal { position:fixed; inset:0; z-index:100050; display:flex; align-items:flex-end; justify-content:center;
  background:rgba(15,10,30,.55);
  font-family:'Inter','Hanken Grotesk',system-ui,sans-serif; }
@media (min-width:600px){ .pdm-modal { align-items:center; } }

.pdm-sheet { background:#fff; color:#19151f; width:100%; max-width:440px; height:88vh; height:88dvh; max-height:760px;
  border-radius:22px 22px 0 0; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 -10px 50px rgba(0,0,0,.3); }
@media (min-width:600px){ .pdm-sheet { border-radius:22px; height:80vh; height:80dvh; } }

/* header bar */
.pdm-head { flex:0 0 auto; display:flex; align-items:center; gap:8px; padding:12px 14px; border-bottom:1px solid #efedf2; }
.pdm-x { width:30px; height:30px; flex:0 0 auto; border:0; border-radius:50%; background:#f3f1f6; color:#6b6577; font-size:14px; cursor:pointer; }
.pdm-x:hover { color:#19151f; }
.pdm-htitle { flex:1; text-align:center; font-weight:800; font-size:17px; margin:0; letter-spacing:-.3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pdm-hsp { width:30px; flex:0 0 auto; }

.pdm-host { flex:1; min-height:0; display:flex; }

/* one conversation */
.pdm-conv { position:relative; flex:1; min-width:0; display:flex; flex-direction:column; }
.pdm-conv-head { position:relative; flex:0 0 auto; display:flex; align-items:center; gap:11px; padding:12px 14px; border-bottom:1px solid #efedf2; }
.pdm-back { display:none; width:28px; height:28px; border:0; background:none; font-size:24px; line-height:1; color:#6b6577; cursor:pointer; flex:0 0 auto; }
.pdm-hclose { flex:0 0 auto; width:30px; height:30px; border:0; border-radius:50%; background:#f3f1f6; color:#6b6577; font-size:13px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.pdm-hclose:hover { color:#19151f; }
.pdm-conv-hav, .pdm-conv-rav { flex:0 0 auto; width:40px; height:40px; border-radius:50%; background:#dcd8e3 center/cover no-repeat; display:flex; align-items:center; justify-content:center; color:#fff; overflow:hidden; }
.pdm-conv-hav.e, .pdm-conv-rav.e { background:linear-gradient(135deg,#c9a6ff,#9b6cff); }
.pdm-conv-hav.e svg, .pdm-conv-rav.e svg { width:22px; height:22px; }
.pdm-conv-hav.ini, .pdm-conv-rav.ini { color:#fff; font-weight:800; font-size:15px; }
.pdm-conv-hmeta { flex:1; min-width:0; display:flex; flex-direction:column; gap:1px; }
.pdm-conv-hname { font-weight:800; font-size:15.5px; letter-spacing:-.2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pdm-conv-hsub { font-size:12.5px; color:#8a8494; min-height:16px; }
.pdm-viewprofile, .pdm-viewprofile2 { border:0; background:none; padding:0; color:#7a3cff; font-weight:700; font-size:12.5px; cursor:pointer; font-family:inherit; }
.pdm-onl { color:#8a8494; } .pdm-onl.on { color:#22a559; } .pdm-typing { color:#7a3cff; font-style:italic; }
.pdm-conv-more { margin-left:auto; flex:0 0 auto; width:32px; height:32px; border:0; border-radius:50%; background:#f3f1f6; color:#6b6577; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.pdm-conv-more svg { width:18px; height:18px; }

/* ⋯ menu */
.pdm-cmenu { position:absolute; top:52px; right:12px; z-index:6; background:#fff; border:1px solid #e8e5ee; border-radius:12px; box-shadow:0 14px 36px rgba(0,0,0,.18); padding:6px; min-width:160px; }
.pdm-cmenu button { display:block; width:100%; text-align:left; border:0; background:none; font-family:inherit; font-weight:600; font-size:14px; color:#19151f; padding:10px 12px; border-radius:8px; cursor:pointer; }
.pdm-cmenu button:hover { background:#f5f3f8; }
.pdm-cmenu button[data-a="block"], .pdm-cmenu button[data-a="report"] { color:#e0356a; }

/* message list */
.pdm-msgs { flex:1; min-height:0; overflow-y:auto; list-style:none; margin:0; padding:14px; display:flex; flex-direction:column; gap:8px; }
.pdm-msgs-load, .pdm-msgs-empty { color:#8a8494; font-weight:600; text-align:center; padding:30px 0; list-style:none; }
.pdm-daysep { list-style:none; text-align:center; margin:6px 0; }
.pdm-daysep span { font-size:11px; font-weight:700; letter-spacing:.03em; color:#a8a2b2; text-transform:uppercase; }
/* NB: global site CSS puts `margin:auto` on <li>. In a flex column that CENTERS each item (auto margins beat
   align-self), so we must force horizontal margins to 0 or the bubbles all stack centered instead of left/right. */
.pdm-msgs > .pdm-msg { margin-left:0 !important; margin-right:0 !important; }
.pdm-msg { display:flex; flex-direction:column; max-width:78%; }
.pdm-msg.me { align-self:flex-end; align-items:flex-end; }
.pdm-msg.them { align-self:flex-start; align-items:flex-start; }
/* same-sender burst: tighten spacing + show the time only on the last message (the hidden tick still updates via JS). */
.pdm-msg.grp { margin-top:-4px; }
.pdm-msg:has(+ .pdm-msg.grp) .pdm-time { display:none; }
.pdm-bubble { padding:9px 13px; border-radius:18px; font-size:14.5px; line-height:1.35; word-wrap:break-word; white-space:pre-wrap; }
.pdm-msg.them .pdm-bubble { background:#f1eff5; color:#19151f; border-bottom-left-radius:5px; }
.pdm-msg.me .pdm-bubble { background:#7a3cff; color:#fff; border-bottom-right-radius:5px; }
.pdm-bubble.del { font-style:italic; opacity:.6; }
.pdm-time { font-size:11px; color:#a8a2b2; margin:2px 4px 0; }
.pdm-tick { margin-left:3px; } .pdm-tick.read { color:#22a559; }

/* footer / composer */
.pdm-foot { flex:0 0 auto; border-top:1px solid #efedf2; padding:10px 12px calc(12px + env(safe-area-inset-bottom,0px)); }
.pdm-foot-sub { display:block; font-size:11.5px; color:#8a8494; line-height:1.4; margin:0 4px 8px; text-align:center; }
.pdm-foot-sub a { color:#7a3cff; }
.pdm-invited { text-align:center; margin:0 0 8px; }
.pdm-invited b { display:block; font-size:14px; } .pdm-invited span { font-size:11.5px; color:#8a8494; }
.pdm-composer { display:flex; align-items:flex-end; gap:8px; }
.pdm-input { flex:1; resize:none; border:1.5px solid #e3e0ea; border-radius:20px; background:#faf9fc; padding:10px 14px; font-family:inherit; font-size:14.5px; color:#19151f; max-height:120px; line-height:1.35; box-sizing:border-box; }
.pdm-input:focus { outline:none; border-color:#7a3cff; }
.pdm-send { flex:0 0 auto; width:38px; height:38px; border:0; border-radius:50%; background:#7a3cff; color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.pdm-send svg { width:18px; height:18px; }

/* ── Inbox (two-pane) ── */
.pdm-inbox-sheet { max-width:440px; }
@media (min-width:760px){ .pdm-inbox-sheet { max-width:780px; } }
.pdm-twopane { flex:1; min-height:0; display:flex; }
.pdm-left { width:100%; border-right:1px solid #efedf2; display:flex; flex-direction:column; min-width:0; }
.pdm-right { display:none; flex:1; min-width:0; }
@media (min-width:760px){ .pdm-left { width:300px; flex:0 0 300px; } .pdm-right { display:flex; } }
.pdm-conv-list { flex:1; overflow-y:auto; padding:6px; }
.pdm-conv-row { display:flex; align-items:center; gap:11px; width:100%; border:0; background:none; padding:10px 10px; border-radius:12px; cursor:pointer; text-align:left; font-family:inherit; }
.pdm-conv-row:hover { background:#f5f3f8; }
.pdm-conv-row.on { background:#f0ecfb; }
.pdm-conv-rmeta { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.pdm-conv-rname { font-weight:700; font-size:14.5px; color:#19151f; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pdm-conv-rsub { display:flex; align-items:center; gap:5px; min-width:0; }
.pdm-conv-rlast { min-width:0; font-size:13px; color:#8a8494; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pdm-conv-dot { flex:0 0 auto; color:#c8c3d0; font-size:13px; }
.pdm-conv-rtime { flex:0 0 auto; font-size:12px; color:#a8a2b2; font-weight:600; }
.pdm-conv-row.unread .pdm-conv-rname { color:#19151f; }
.pdm-conv-row.unread .pdm-conv-rlast { color:#19151f; font-weight:600; }
.pdm-conv-badge { flex:0 0 auto; min-width:18px; height:18px; padding:0 5px; border-radius:99px; background:#7a3cff; color:#fff; font-size:11px; font-weight:800; display:flex; align-items:center; justify-content:center; }
.pdm-inbox-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; height:100%; gap:4px; color:#8a8494; padding:30px; }
.pdm-inbox-empty.sm { padding:40px 20px; }
.pdm-inbox-empty b { color:#19151f; font-size:16px; }
.pdm-inbox-emoji { font-size:42px; margin-bottom:6px; }
.pdm-nm-btn { margin-top:14px; display:inline-flex; align-items:center; gap:8px; border:0; border-radius:99px; background:#7a3cff; color:#fff; font-family:inherit; font-weight:800; font-size:14px; padding:11px 20px; cursor:pointer; }
.pdm-nm-btn svg { width:17px; height:17px; }
/* compose button (channel list) */
.pdm-left { position:relative; }
.pdm-compose { position:absolute; right:14px; bottom:14px; width:48px; height:48px; border:0; border-radius:50%; background:#7a3cff; color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; box-shadow:0 8px 22px rgba(122,60,255,.4); z-index:3; }
.pdm-compose svg { width:21px; height:21px; }
@media (min-width:760px){ .pdm-show-right .pdm-compose { display:flex; } }
/* unread separator */
.pdm-unreadsep { list-style:none; display:flex; align-items:center; gap:10px; margin:6px 2px; color:#7a3cff; }
.pdm-unreadsep::before, .pdm-unreadsep::after { content:''; flex:1; height:1px; background:#e7def8; }
.pdm-unreadsep span { font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
/* New Message modal */
.pdm-nm-search { padding:10px 14px; border-bottom:1px solid #efedf2; }
.pdm-nm-input { width:100%; border:1.5px solid #e3e0ea; border-radius:12px; background:#faf9fc; padding:10px 14px; font-family:inherit; font-size:15px; color:#19151f; box-sizing:border-box; }
.pdm-nm-input:focus { outline:none; border-color:#7a3cff; }
.pdm-nm-list { flex:1; overflow-y:auto; padding:6px; }
.pdm-nm-hint { color:#8a8494; font-weight:600; text-align:center; padding:28px 16px; }
/* New Message view in the inbox RIGHT pane (Partiful NewMessageView) */
.pdm-nmv { display:flex; flex-direction:column; flex:1; min-height:0; }
.pdm-nmv-head { display:flex; align-items:center; gap:6px; padding:10px 12px; border-bottom:1px solid #efedf2; }
.pdm-nmv-head .pdm-nm-search { flex:1; position:relative; padding:0; border:0; display:flex; align-items:center; }
.pdm-nmv-head .pdm-nm-search svg { position:absolute; left:13px; width:18px; height:18px; color:#8a8494; pointer-events:none; }
.pdm-nmv-head .pdm-nm-input { padding-left:40px; }
.pdm-nmv-list { flex:1; overflow-y:auto; padding:6px; }
/* mobile: tapping a row reveals the right pane over the list */
@media (max-width:759px){
  .pdm-show-right .pdm-left { display:none; }
  .pdm-show-right .pdm-right { display:flex; }
  .pdm-back { display:block; }
}

.pdm-bubble:not(.del) { cursor:pointer; }
/* per-message delete action sheet (tap a bubble) */
.pdm-sheetmodal { position:absolute; inset:0; z-index:8; display:flex; align-items:flex-end; justify-content:center; background:rgba(15,10,30,.4); }
.pdm-actionsheet { width:100%; max-width:340px; margin:10px; background:#fff; border-radius:16px; overflow:hidden; box-shadow:0 14px 40px rgba(0,0,0,.25); }
.pdm-as-title { text-align:center; font-weight:700; font-size:13px; color:#8a8494; padding:14px 16px 6px; }
.pdm-as-btn { display:block; width:100%; border:0; border-top:1px solid #efedf2; background:none; font-family:inherit; font-weight:700; font-size:15px; color:#19151f; padding:14px; cursor:pointer; }
.pdm-as-btn:hover { background:#f7f5fa; }
.pdm-as-btn.danger { color:#e0356a; }
.pdm-as-btn.cancel { color:#8a8494; font-weight:600; }

/* ── message-request gate ── */
.pdm-gate-note { text-align:center; color:#8a8494; font-weight:600; font-size:13px; padding:14px 8px; }
.pdm-acceptbar { display:flex; flex-direction:column; gap:12px; padding:4px 2px; }
.pdm-accept-q { text-align:center; }
.pdm-accept-q b { display:block; font-size:15px; color:#19151f; }
.pdm-accept-q span { font-size:12px; color:#8a8494; line-height:1.4; }
.pdm-accept-btns { display:flex; gap:8px; }
.pdm-ab { flex:1; border:0; border-radius:12px; font-family:inherit; font-weight:800; font-size:14px; padding:12px; cursor:pointer; }
.pdm-ab.accept { background:#7a3cff; color:#fff; }
.pdm-ab.block { background:#fde7ee; color:#e0356a; }
.pdm-ab.del { background:#f1eff5; color:#19151f; }
.pdm-ab:hover { filter:brightness(.97); }
/* inbox section headers + request rows */
.pdm-list-head { font-size:12px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; color:#a8a2b2; padding:10px 12px 4px; }
.pdm-conv-row.req .pdm-conv-rname { font-weight:800; }
.pdm-req-tag { flex:0 0 auto; align-self:center; font-size:10.5px; font-weight:800; color:#7a3cff; background:#f0ecfb; border-radius:99px; padding:2px 8px; text-transform:uppercase; letter-spacing:.03em; }

/* toast */
.pdm-toast { position:fixed; left:50%; bottom:26px; transform:translateX(-50%); background:#23173f; color:#fff; padding:11px 18px; border-radius:99px; font-weight:700; font-size:14px; z-index:100070; box-shadow:0 8px 24px rgba(0,0,0,.3); transition:opacity .4s; }

/* ── Dark theme — applies ONLY inside a dark-themed party page so the DM stays consistent with the
   event (light mode is untouched). CSS-only; no JS/logic change. ── */
body:has(.pty-root.pty-dark) .pdm-sheet,
body:has(.pty-root.pty-dark) .pdm-actionsheet { background:#1a1430; color:#ece8ff; }
body:has(.pty-root.pty-dark) .pdm-head,
body:has(.pty-root.pty-dark) .pdm-conv-head,
body:has(.pty-root.pty-dark) .pdm-foot,
body:has(.pty-root.pty-dark) .pdm-left,
body:has(.pty-root.pty-dark) .pdm-nm-search,
body:has(.pty-root.pty-dark) .pdm-nmv-head { border-color:rgba(255,255,255,.09); }
body:has(.pty-root.pty-dark) .pdm-htitle,
body:has(.pty-root.pty-dark) .pdm-conv-hname,
body:has(.pty-root.pty-dark) .pdm-conv-rname,
body:has(.pty-root.pty-dark) .pdm-inbox-empty b,
body:has(.pty-root.pty-dark) .pdm-accept-q b,
body:has(.pty-root.pty-dark) .pdm-invited b { color:#ece8ff; }
body:has(.pty-root.pty-dark) .pdm-conv-hsub,
body:has(.pty-root.pty-dark) .pdm-time,
body:has(.pty-root.pty-dark) .pdm-onl,
body:has(.pty-root.pty-dark) .pdm-foot-sub,
body:has(.pty-root.pty-dark) .pdm-conv-rlast,
body:has(.pty-root.pty-dark) .pdm-conv-rtime,
body:has(.pty-root.pty-dark) .pdm-msgs-empty,
body:has(.pty-root.pty-dark) .pdm-msgs-load,
body:has(.pty-root.pty-dark) .pdm-gate-note,
body:has(.pty-root.pty-dark) .pdm-inbox-empty { color:#a79fc4; }
body:has(.pty-root.pty-dark) .pdm-x,
body:has(.pty-root.pty-dark) .pdm-hclose,
body:has(.pty-root.pty-dark) .pdm-conv-more { background:rgba(255,255,255,.08); color:#cdc4ea; }
body:has(.pty-root.pty-dark) .pdm-x:hover,
body:has(.pty-root.pty-dark) .pdm-hclose:hover { color:#fff; }
body:has(.pty-root.pty-dark) .pdm-msg.them .pdm-bubble,
body:has(.pty-root.pty-dark) .pdm-ab.del { background:#2c2342; color:#ece8ff; }
body:has(.pty-root.pty-dark) .pdm-input,
body:has(.pty-root.pty-dark) .pdm-nm-input { background:#241a36; border-color:rgba(255,255,255,.12); color:#ece8ff; }
body:has(.pty-root.pty-dark) .pdm-cmenu { background:#241a36; border-color:rgba(255,255,255,.1); }
body:has(.pty-root.pty-dark) .pdm-cmenu button,
body:has(.pty-root.pty-dark) .pdm-as-btn { color:#ece8ff; }
body:has(.pty-root.pty-dark) .pdm-cmenu button:hover,
body:has(.pty-root.pty-dark) .pdm-as-btn:hover,
body:has(.pty-root.pty-dark) .pdm-conv-row:hover { background:rgba(255,255,255,.06); }
body:has(.pty-root.pty-dark) .pdm-conv-row.on { background:rgba(122,60,255,.20); }
body:has(.pty-root.pty-dark) .pdm-as-btn { border-top-color:rgba(255,255,255,.08); }
body:has(.pty-root.pty-dark) .pdm-as-title,
body:has(.pty-root.pty-dark) .pdm-list-head,
body:has(.pty-root.pty-dark) .pdm-daysep span,
body:has(.pty-root.pty-dark) .pdm-accept-q span,
body:has(.pty-root.pty-dark) .pdm-invited span { color:#8a82a8; }
body:has(.pty-root.pty-dark) .pdm-req-tag { background:rgba(122,60,255,.22); color:#c9a6ff; }

/* Respect reduced-motion — DM modals mount on <body>, outside the .pty-root guard. */
@media (prefers-reduced-motion: reduce) {
  .pdm-modal *, .pdm-modal *::before, .pdm-modal *::after { animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; scroll-behavior:auto !important; }
}

/* ── RTL (Arabic) — scoped under [dir="rtl"], set on DM overlays only for 'ar'
   (party-dm.js). LTR users never match. Message-bubble alignment auto-flips via
   flex align-self; below fixes the physical bits (edges, icons, bubble tails). ── */
[dir="rtl"] .pdm-conv-more { margin-left:0; margin-right:auto; }
[dir="rtl"] .pdm-conv-row, [dir="rtl"] .pdm-cmenu button { text-align:right; }
[dir="rtl"] .pdm-cmenu { right:auto; left:12px; }
[dir="rtl"] .pdm-compose { right:auto; left:14px; }
[dir="rtl"] .pdm-left { border-right:0; border-left:1px solid #efedf2; }
[dir="rtl"] .pdm-nmv-head .pdm-nm-search svg { left:auto; right:13px; }
[dir="rtl"] .pdm-nmv-head .pdm-nm-input { padding-left:0; padding-right:40px; }
[dir="rtl"] .pdm-back { transform:scaleX(-1); }
[dir="rtl"] .pdm-msg.them .pdm-bubble { border-bottom-left-radius:18px; border-bottom-right-radius:5px; }
[dir="rtl"] .pdm-msg.me .pdm-bubble { border-bottom-right-radius:18px; border-bottom-left-radius:5px; }
