/* NexaMed Community window. Uses the site theme variables, so all four themes work. */

.nxc {
  position: fixed; inset: 0; z-index: 100002; display: none;
  padding: 20px; background: var(--overlay); backdrop-filter: blur(8px);
  font-family: 'DM Sans', sans-serif; color: var(--text);
}
.nxc.open { display: block; animation: nxcIn 0.2s ease; }
@keyframes nxcIn { from { opacity: 0; } to { opacity: 1; } }

.nxc-shell {
  --rc: #14b8a6; --rci: #06130b;
  position: relative; height: 100%; max-width: 1440px; margin: 0 auto;
  display: grid; grid-template-columns: 240px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  background: var(--deep); border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}
.nxc-shell.has-thread { grid-template-columns: 240px minmax(0, 1fr) minmax(340px, 440px); }

/* ---------- sidebar ---------- */
.nxc-side { display: flex; flex-direction: column; gap: 14px; padding: 20px 12px 14px; border-right: 1px solid var(--border); background: var(--panel-02); overflow-y: auto; min-height: 0; }
.nxc-brand { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.nxc-title { font-family: 'Bebas Neue', sans-serif; font-size: 1.7rem; letter-spacing: 1.5px; line-height: 1; }
.nxc-rooms { display: flex; flex-direction: column; gap: 3px; }
.nxc-room {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0; border-radius: 11px;
  background: none; color: var(--muted); font-family: inherit; font-size: 0.9rem; font-weight: 600; text-align: left; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nxc-room i { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); flex: 0 0 9px; opacity: 0.85; }
.nxc-room:hover { color: var(--text); background: var(--panel-05); }
.nxc-room.on { color: var(--text); background: color-mix(in srgb, var(--rc) 16%, transparent); box-shadow: inset 3px 0 0 var(--rc); }
.nxc-room.on i { opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc) 25%, transparent); }
.nxc-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 6px; }
.nxc-lounge {
  padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel-03); color: var(--text);
  font-family: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.nxc-lounge:hover { border-color: var(--rc); background: var(--panel-06); }
.nxc-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.nxc-rules li { position: relative; padding-left: 13px; font-size: 0.74rem; line-height: 1.45; color: var(--muted); }
.nxc-rules li::before { content: ''; position: absolute; left: 0; top: 0.5em; width: 5px; height: 5px; border-radius: 50%; background: var(--rc); }

/* ---------- main ---------- */
.nxc-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.nxc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; }
.nxc-head h2 { font-family: 'Bebas Neue', sans-serif; font-size: 2.1rem; letter-spacing: 1.5px; line-height: 1; color: var(--text); }
.nxc-head h2::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--rc); margin-right: 12px; vertical-align: 0.18em; }
.nxc-head p { margin-top: 6px; font-size: 0.84rem; color: var(--muted); }
.nxc-x {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--panel-04); color: var(--muted); cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.nxc-x:hover { color: var(--text); border-color: var(--rc); }
.nxc-x-mobile { display: none; }

.nxc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px 12px; flex-wrap: wrap; }
.nxc-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-03); }
.nxc-tabs button {
  padding: 7px 14px; border: 0; border-radius: 9px; background: none; color: var(--muted);
  font-family: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.nxc-tabs button:hover { color: var(--text); }
.nxc-tabs button.on { background: var(--rc); color: var(--rci); }
#nxc-search {
  width: 220px; max-width: 100%; padding: 9px 13px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--panel-04); color: var(--text); font-family: inherit; font-size: 0.84rem; outline: none;
}
#nxc-search:focus { border-color: var(--rc); }

/* composers */
.nxc-compose { padding: 0 24px 14px; }
.nxc-ta { position: relative; }
.nxc-ta textarea {
  width: 100%; resize: none; padding: 12px 14px 22px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--panel-04); color: var(--text); font-family: inherit; font-size: 0.9rem; line-height: 1.5; outline: none; min-height: 74px;
}
.nxc-ta textarea:focus { border-color: var(--rc); }
.nxc-ta textarea::placeholder { color: var(--muted); }
.nxc-count { position: absolute; right: 12px; bottom: 7px; font-size: 0.66rem; color: var(--muted); pointer-events: none; }
.nxc-compose-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.nxc-compose-row select {
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-04); color: var(--text);
  font-family: inherit; font-size: 0.8rem; outline: none; max-width: 170px;
}
.nxc-anon {
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: none; color: var(--muted);
  font-family: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.nxc-anon.on { border-color: var(--rc); color: var(--text); background: color-mix(in srgb, var(--rc) 14%, transparent); }
.nxc-send {
  margin-left: auto; padding: 9px 22px; border: 0; border-radius: 10px; background: var(--rc); color: var(--rci);
  font-family: inherit; font-size: 0.86rem; font-weight: 700; cursor: pointer; transition: filter 0.15s, transform 0.12s;
}
.nxc-send:hover { filter: brightness(1.08); }
.nxc-send:active { transform: scale(0.97); }
.nxc-send:disabled { opacity: 0.55; cursor: default; }

/* feed */
.nxc-feed { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 24px 24px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.nxc-section { font-size: 0.64rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); padding: 8px 2px 0; }
.nxc-empty, .nxc-more-note { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 34px 12px; }
.nxc-more-note { padding: 10px; font-size: 0.74rem; }
.nxc-gate { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--muted); font-size: 0.88rem; max-width: 340px; padding: 40px 10px; }
.nxc-gate strong { color: var(--text); font-size: 1.15rem; }
.nxc-gate .nxc-send { margin: 8px 0 0; }

/* cards */
.nxc-card, .nxc-reply {
  position: relative; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--card);
  transition: border-color 0.15s, transform 0.15s;
}
.nxc-card[data-act="open"] { cursor: pointer; }
.nxc-card[data-act="open"]:hover { border-color: color-mix(in srgb, var(--rc) 55%, var(--border)); }
.nxc-card:focus-visible { outline: 2px solid var(--rc); outline-offset: 2px; }
.nxc-card.pinned { border-left: 3px solid var(--rc); }
.nxc-card.in-thread { background: var(--panel-03); }
.nxc-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.nxc-av { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.88rem; }
.nxc-av.anon { background: var(--panel-08); color: var(--muted); }
.nxc-who { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; margin-right: auto; }
.nxc-name { font-weight: 700; font-size: 0.88rem; color: var(--text); }
.nxc-name.anon { color: var(--muted); font-style: italic; font-weight: 600; }
.nxc-time { font-size: 0.72rem; color: var(--muted); }
.nxc-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 999px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.3px; }
.nxc-badge.ver { background: color-mix(in srgb, #3b82f6 16%, transparent); color: #60a5fa; }
.nxc-badge.team { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.nxc-chip { padding: 3px 9px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; background: color-mix(in srgb, var(--rc) 16%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--rc) 40%, transparent); white-space: nowrap; }
.nxc-pin { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 700; color: var(--rc); }
.nxc-more { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 8px; line-height: 0; }
.nxc-more:hover { background: var(--panel-06); color: var(--text); }
.nxc-text { font-size: 0.92rem; line-height: 1.6; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.nxc-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.nxc-rxs { display: flex; gap: 6px; flex-wrap: wrap; }
.nxc-rx {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: none; color: var(--muted); font-family: inherit; font-size: 0.74rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.nxc-rx b { font-weight: 700; color: var(--text); }
.nxc-rx:hover:not(.own) { border-color: var(--rc); color: var(--text); }
.nxc-rx.on { border-color: var(--rc); background: color-mix(in srgb, var(--rc) 18%, transparent); color: var(--text); }
.nxc-rx.own { opacity: 0.55; cursor: default; }
.nxc-replies {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 5px 10px; border: 0; border-radius: 9px;
  background: none; color: var(--muted); font-family: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.nxc-replies:hover { color: var(--text); background: var(--panel-05); }
.nxc-solved { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; background: color-mix(in srgb, #22c55e 16%, transparent); color: #22c55e; }
.nxc-card:not(.in-thread) .nxc-solved { margin-left: 0; }
.nxc-card.in-thread .nxc-solved { margin-left: auto; }

/* thread */
.nxc-thread { display: none; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--border); background: var(--panel-02); }
.nxc-shell.has-thread .nxc-thread { display: flex; }
.nxc-thread-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 700; }
.nxc-thread-head .nxc-chip { margin-left: auto; }
.nxc-thread-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.nxc-reply { background: var(--card); }
.nxc-reply.accepted { border-color: #22c55e; background: color-mix(in srgb, #22c55e 7%, var(--card)); }
.nxc-acc-label { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 8px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: #22c55e; }
.nxc-accept, .nxc-unaccept {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 9px; cursor: pointer;
  font-family: inherit; font-size: 0.74rem; font-weight: 700; transition: all 0.15s;
}
.nxc-accept { border: 1px solid #22c55e; background: none; color: #22c55e; }
.nxc-accept:hover { background: #22c55e; color: #052e16; }
.nxc-unaccept { border: 1px solid var(--border); background: none; color: var(--muted); }
.nxc-unaccept:hover { color: var(--text); border-color: var(--muted); }
.nxc-reply-compose { padding: 12px 18px 16px; border-top: 1px solid var(--border); }

/* menu */
.nxc-menu {
  position: absolute; z-index: 20; display: none; min-width: 190px; padding: 6px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.nxc-menu.open { display: flex; flex-direction: column; animation: nxcIn 0.12s ease; }
.nxc-menu button { text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font-family: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.nxc-menu button:hover { background: var(--panel-06); }
.nxc-menu button.danger { color: var(--danger); }

/* ---------- phone / small screens ---------- */
@media (max-width: 900px) {
  .nxc { padding: 0; }
  .nxc-shell, .nxc-shell.has-thread { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); border-radius: 0; border: 0; }
  .nxc-side { flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); overflow: hidden; }
  .nxc-brand { display: contents; }
  .nxc-title { font-size: 1.35rem; order: 1; flex: 0 0 auto; }
  .nxc-x-mobile { display: inline-flex; order: 3; flex: 0 0 34px; }
  .nxc-x-desk { display: none; }
  .nxc-rooms { flex: 1; flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
  .nxc-rooms::-webkit-scrollbar { display: none; }
  .nxc-room { width: auto; flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
  .nxc-room.on { box-shadow: none; border-color: var(--rc); }
  .nxc-side-foot { display: none; }
  .nxc-rooms { order: 2; }
  .nxc-head { padding: 14px 16px 8px; }
  .nxc-head h2 { font-size: 1.6rem; }
  .nxc-head p { display: none; }
  .nxc-bar { padding: 0 16px 10px; }
  .nxc-tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nxc-tabs button { flex: 1; padding: 7px 10px; }
  #nxc-search { width: 100%; }
  .nxc-compose { padding: 0 16px 12px; }
  .nxc-feed { padding: 4px 16px 20px; }
  .nxc-thread { position: absolute; inset: 0; z-index: 8; border-left: 0; background: var(--deep); }
  .nxc-shell.has-thread .nxc-thread { display: flex; }
  .nxc-rx-l { display: none; }
  .nxc-rx { padding: 6px 11px; }
}
