/* NexaMed UI layer: theme pill, notifications, My Account, Community hub.
 * Loaded after main.css. Uses the existing theme variables, so every theme works.
 */

/* ========== THEME PILL ========== */
.nx-theme-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 6px 13px !important;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-03);
  color: var(--text) !important;
  font-size: 0.8rem !important;
  font-weight: 500;
  letter-spacing: 0.2px !important;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.nx-theme-pill:hover { background: var(--panel-06); border-color: var(--accent); }
.nx-theme-pill:active { transform: scale(0.97); }
.nx-theme-ic { display: inline-flex; width: 15px; height: 15px; color: var(--accent); }
.nx-theme-ic svg { width: 100%; height: 100%; }
.nx-theme-label { display: inline-block; min-width: 4.8em; text-align: left; }
.mobile-nav a.nx-theme-pill {
  display: flex !important;
  margin: 8px 0 4px;
  padding: 11px 16px !important;
  font-size: 0.95rem !important;
  border-radius: 12px;
}
html.nx-theme-anim *, html.nx-theme-anim *::before, html.nx-theme-anim *::after {
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease, fill 0.35s ease, stroke 0.35s ease !important;
}

/* ========== NAV BELL ========== */
nav .nav-links { margin-left: auto; }
.nx-bell {
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 16px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-03);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}
.nx-bell.show { display: inline-flex; }
.nx-bell:hover { background: var(--panel-06); border-color: var(--accent); }
.nx-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff3b5c;
  border: 2px solid var(--navy);
  display: none;
  pointer-events: none;
}
.nx-dot.show { display: block; }
.nx-dot-hero { top: 8px; right: 9px; }
@media (max-width: 900px) {
  .nx-bell { margin-left: auto; margin-right: 14px; }
}

/* ========== NOTIFICATION PANEL ========== */
.nx-notif {
  position: fixed;
  top: 76px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: min(70vh, 560px);
  display: none;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  z-index: 100000;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}
.nx-notif.open { display: flex; animation: nxPop 0.18s ease; }
@keyframes nxPop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.nx-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--text);
}
.nx-notif-x {
  background: none; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 4px;
}
.nx-notif-x:hover { color: var(--text); }
.nx-notif-list { flex: 1; overflow-y: auto; }
.nx-notif-empty {
  display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center;
  padding: 44px 24px; color: var(--muted); font-size: 0.85rem;
}
.nx-notif-empty strong { color: var(--text); font-size: 0.95rem; }
.nx-n-item { padding: 14px 18px; border-bottom: 1px solid var(--border); position: relative; }
.nx-n-item:last-child { border-bottom: 0; }
.nx-n-item.fresh { background: var(--panel-03); }
.nx-n-item.fresh::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.nx-n-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.nx-n-tag {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 2px 8px;
}
.nx-n-tag.sp { color: var(--gold); border-color: var(--gold); }
.nx-n-time { font-size: 0.7rem; color: var(--muted); }
.nx-n-title { font-weight: 700; font-size: 0.9rem; color: var(--text); margin-bottom: 3px; }
.nx-n-body { font-size: 0.82rem; color: var(--muted); line-height: 1.55; }
.nx-n-link { display: inline-block; margin-top: 8px; font-size: 0.78rem; font-weight: 700; color: var(--accent); text-decoration: none; }
.nx-n-link:hover { text-decoration: underline; }
.nx-notif-foot { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.nx-notif-foot button {
  background: none; border: 0; color: var(--muted); font-family: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 8px;
}
.nx-notif-foot button:hover { color: var(--text); background: var(--panel-05); }
@media (max-width: 600px) { .nx-notif { top: 72px; right: 12px; left: 12px; width: auto; max-width: none; } }

/* ========== MY ACCOUNT ========== */
.account-panel { background: var(--overlay); padding: 84px 18px 28px; }
.account-dialog {
  max-width: 1000px;
  padding: 0;
  overflow: hidden;
  border-radius: 20px;
  background: var(--deep);
}
.account-dialog .account-close {
  top: 16px; right: 16px; z-index: 3; width: 36px; height: 36px; font-size: 1.3rem; line-height: 1; padding: 0;
  transition: color 0.2s, border-color 0.2s;
}
.account-dialog .account-close:hover { color: var(--text); border-color: var(--accent); }

.nx-acc-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(210px, 290px) auto;
  gap: 24px;
  align-items: center;
  padding: 30px 64px 28px 32px;
  background: linear-gradient(135deg, var(--panel-05), transparent 65%);
  border-bottom: 1px solid var(--border);
}
.account-dialog .account-avatar {
  width: 88px; height: 88px; border: 0; padding: 0; border-radius: 50%;
  font-family: 'Bebas Neue', sans-serif; font-size: 2.4rem; font-weight: 400; letter-spacing: 1px;
  background: var(--accent); color: var(--navy);
  cursor: pointer; position: relative;
  box-shadow: 0 0 0 3px var(--deep), 0 0 0 4px var(--border);
  transition: box-shadow 0.2s, transform 0.2s;
}
.account-dialog .account-avatar:hover { box-shadow: 0 0 0 3px var(--deep), 0 0 0 5px var(--accent); transform: scale(1.03); }
.account-dialog .account-avatar.has-avatar { background: var(--nx-av-bg); }
.account-avatar svg { width: 48px; height: 48px; display: block; }
.nx-eyebrow {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 0.66rem !important; font-weight: 700; letter-spacing: 2px !important; text-transform: uppercase;
  color: var(--accent); line-height: 1.2 !important; margin-bottom: 6px;
}
.nx-acc-id { min-width: 0; }
.account-dialog .account-name { font-size: 1.5rem; font-weight: 800; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-dialog .account-email { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-acc-sub { margin-top: 8px; font-size: 0.8rem; color: var(--muted); line-height: 1.5; }

.nx-level { padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-03); }
.nx-level-top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: var(--text); font-size: 0.9rem; }
.nx-level-top span:last-child { font-size: 0.74rem; font-weight: 500; color: var(--muted); }
.nx-level-bar { height: 5px; border-radius: 99px; background: var(--panel-08); margin: 10px 0 8px; overflow: hidden; }
.nx-level-bar div { height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width 0.6s ease; }
.nx-level-sub { font-size: 0.72rem; color: var(--muted); }

.nx-acc-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.account-dialog .account-signout { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 20px; line-height: 1; border-radius: 10px; }
.nx-login-cta {
  height: 40px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--accent); color: var(--navy);
  font-family: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer; white-space: nowrap;
}
.nx-login-cta:hover { filter: brightness(1.08); }

/* tabs */
.nx-tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.nx-tabs::-webkit-scrollbar { display: none; }
.nx-tab {
  position: relative; padding: 14px 16px; background: none; border: 0; color: var(--muted);
  font-family: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: color 0.2s;
}
.nx-tab:hover { color: var(--text); }
.nx-tab.active { color: var(--text); }
.nx-tab.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.nx-tab-count {
  display: inline-block; min-width: 18px; margin-left: 6px; padding: 1px 6px; border-radius: 99px;
  background: rgba(255, 77, 109, 0.14); color: var(--danger); font-size: 0.68rem; font-weight: 700; text-align: center;
}

.nx-pane { display: none; padding: 26px 32px 32px; }
.nx-pane.active { display: block; animation: nxFade 0.22s ease; }
@keyframes nxFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.account-dialog .account-stats { grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.account-dialog .stat-box { padding: 18px; border-radius: 14px; background: var(--panel-03); }
.account-dialog .stat-box .num { font-size: 2.3rem; }
.account-dialog .account-box { border-radius: 14px; padding: 20px; background: var(--panel-02); }
.account-dialog .card-label { margin-bottom: 16px; }

.nx-next { display: flex; flex-direction: column; align-items: flex-start; }
.nx-next-title { font-size: 1.15rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.nx-next-text { font-size: 0.86rem; color: var(--muted); line-height: 1.6; margin-bottom: 18px; flex: 1; }
.nx-btn {
  padding: 10px 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--navy);
  font-family: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: filter 0.2s, transform 0.15s;
}
.nx-btn:hover { filter: brightness(1.08); }
.nx-btn:active { transform: scale(0.98); }
.nx-btn-ghost { background: var(--panel-05); color: var(--text); border: 1px solid var(--border); }

/* vault (same markup/classes the app JS fills in) */
.account-dialog .nx-vault-box { padding: 20px; }
.account-dialog .vault-list { max-height: 58vh; }

/* badges */
.nx-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.nx-badge { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-02); opacity: 0.62; transition: opacity 0.2s; }
.nx-badge.on { opacity: 1; border-color: var(--accent); background: var(--panel-04); }
.nx-badge-ic { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--panel-06); color: var(--muted); }
.nx-badge.on .nx-badge-ic { background: var(--accent); color: var(--navy); }
.nx-badge-ic svg { width: 20px; height: 20px; }
.nx-badge-body { min-width: 0; flex: 1; }
.nx-badge-name { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.nx-badge-desc { font-size: 0.74rem; color: var(--muted); margin: 2px 0 10px; line-height: 1.45; }
.nx-badge-bar { height: 3px; border-radius: 99px; background: var(--panel-08); overflow: hidden; }
.nx-badge-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.nx-badge-meta { font-size: 0.68rem; color: var(--muted); margin-top: 6px; font-weight: 600; }
.nx-badge.on .nx-badge-meta { color: var(--accent); }
.nx-note { margin-top: 14px; font-size: 0.74rem; color: var(--muted); }
.nx-empty { padding: 36px 0; text-align: center; color: var(--muted); font-size: 0.86rem; grid-column: 1 / -1; }

/* settings */
.nx-set-block { padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.nx-set-block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.nx-set-title { font-size: 0.66rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.nx-avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 10px; max-width: 640px; }
.nx-av-opt {
  width: 100%; aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 0 0 2px var(--deep), 0 0 0 3px var(--border); transition: transform 0.15s, box-shadow 0.15s;
}
.nx-av-opt svg { width: 52%; height: 52%; }
.nx-av-opt:hover { transform: scale(1.06); }
.nx-av-opt.sel { box-shadow: 0 0 0 2px var(--deep), 0 0 0 4px var(--accent); }
.nx-av-letter { background: var(--accent); color: var(--navy); font-family: 'Bebas Neue', sans-serif; font-size: 1.4rem; }
.nx-theme-opts { display: inline-flex; padding: 4px; gap: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-03); flex-wrap: wrap; }
.nx-theme-opts button {
  padding: 8px 16px; border: 0; border-radius: 9px; background: none; color: var(--muted);
  font-family: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.nx-theme-opts button:hover { color: var(--text); }
.nx-theme-opts button.sel { background: var(--accent); color: var(--navy); }
.nx-set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 0.86rem; color: var(--muted); }

@media (max-width: 800px) {
  .account-panel { padding: 72px 10px 16px; }
  .nx-acc-hero { grid-template-columns: auto minmax(0, 1fr); gap: 16px; padding: 22px 56px 20px 20px; }
  .account-dialog .account-avatar { width: 68px; height: 68px; font-size: 1.9rem; }
  .account-avatar svg { width: 38px; height: 38px; }
  .nx-level, .nx-acc-actions { grid-column: 1 / -1; }
  .nx-acc-actions { flex-direction: row; }
  .nx-acc-actions > * { flex: 1; }
  .account-dialog .account-name { font-size: 1.25rem; }
  .nx-tabs { padding: 0 10px; }
  .nx-pane { padding: 20px 18px 24px; }
  .account-dialog .account-stats { grid-template-columns: 1fr 1fr; }
  .account-dialog .stat-box .num { font-size: 1.8rem; }
  .nx-set-row { flex-direction: column; align-items: flex-start; }
}

/* ========== COMMUNITY HUB ========== */
#wr-widget #wr-expand {
  margin-left: auto; margin-right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: none; border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#wr-widget #wr-expand:hover { border-color: var(--accent); color: var(--accent); }
#wr-widget #nx-hub-side { display: none; }
#wr-widget .wr-msg.nx-hide { display: none; }

html.nx-lock { overflow: hidden; }
#wr-widget.wr-hub { inset: 0; right: 0; bottom: 0; display: block; }
#wr-widget.wr-hub::before {
  content: ''; position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(6px);
}
#wr-widget.wr-hub #wr-fab { display: none; }
#wr-widget.wr-hub #wr-panel {
  position: fixed; inset: 20px; width: auto; max-height: none; border-radius: 20px;
}
#wr-widget.wr-hub #wr-panel.open {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "head head" "side strip" "side feed" "side composer";
}
#wr-widget.wr-hub #wr-head { grid-area: head; padding: 18px 24px 14px; }
#wr-widget.wr-hub #wr-head-title { font-size: 1.6rem; }
#wr-widget.wr-hub #wr-head-sub { font-size: 0.8rem; }
#wr-widget.wr-hub #wr-challenge-strip { grid-area: strip; margin: 14px 20px 0; }
#wr-widget.wr-hub #wr-feed { grid-area: feed; min-height: 0; padding: 16px 20px 8px; }
#wr-widget.wr-hub #wr-gate { grid-area: feed; }
#wr-widget.wr-hub #wr-composer { grid-area: composer; padding: 14px 20px 18px; }
#wr-widget.wr-hub #wr-input { height: 84px; font-size: 0.9rem; }
#wr-widget.wr-hub .wr-msg { font-size: 0.9rem; max-width: 780px; padding: 12px 14px; }
#wr-widget.wr-hub #nx-hub-side {
  grid-area: side; display: flex; flex-direction: column; gap: 22px; padding: 20px;
  border-right: 1px solid var(--border); overflow-y: auto;
}
#wr-widget.wr-hub.wr-hub-guest #wr-panel.open {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "strip" "feed" "composer";
}
#wr-widget.wr-hub.wr-hub-guest #nx-hub-side { display: none; }

.nx-hs-block label { display: block; font-size: 0.64rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.nx-hs-block input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-04); color: var(--text); font-family: inherit; font-size: 0.85rem; outline: none;
}
.nx-hs-block input:focus { border-color: var(--accent); }
.nx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nx-chips button {
  padding: 6px 12px; border-radius: 999px; 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;
}
.nx-chips button:hover { color: var(--text); border-color: var(--accent); }
.nx-chips button.on { background: var(--accent); border-color: var(--accent); color: var(--navy); }
.nx-hs-count { font-size: 0.85rem; color: var(--text); }
.nx-hs-rules ul { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0; margin: 0; }
.nx-hs-rules li { font-size: 0.78rem; color: var(--muted); line-height: 1.5; padding-left: 14px; position: relative; }
.nx-hs-rules li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

@media (max-width: 800px) {
  #wr-widget.wr-hub #wr-panel { inset: 0; border-radius: 0; }
  #wr-widget.wr-hub #wr-panel.open {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "head" "side" "strip" "feed" "composer";
  }
  #wr-widget.wr-hub #nx-hub-side { flex-direction: row; flex-wrap: wrap; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  #wr-widget.wr-hub #nx-hub-side .nx-hs-rules, #wr-widget.wr-hub #nx-hub-side .nx-hs-block:nth-child(3) { display: none; }
  #wr-widget.wr-hub #nx-hub-side .nx-hs-block { flex: 1 1 100%; }
  #wr-widget.wr-hub #nx-hub-side .nx-hs-block label { display: none; }
  #wr-widget.wr-hub #wr-challenge-strip { margin: 10px 12px 0; }
  #wr-widget.wr-hub #wr-feed { padding: 12px; }
  #wr-widget.wr-hub #wr-composer { padding: 10px 12px 14px; }
}
