/* App shell: top bar, left option table, footer, drawers and modals. */

.app {
  position: relative;
  z-index: 1;
}

/* ---------- Top bar ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: rgba(8, 7, 11, 0.82);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.topbar__burger {
  display: none;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-2);
}

.topbar__burger:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  padding: 4px;
}

.topbar__spacer {
  flex: 1;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__promo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 45, 120, 0.4);
  background: linear-gradient(
    90deg,
    rgba(255, 45, 120, 0.16),
    rgba(168, 56, 255, 0.16)
  );
  font-size: 0.78rem;
  font-family: var(--font-display);
  color: #ffd0e2;
}

.topbar__promo strong {
  color: #fff;
}

/* ---------- Sidebar (option table, left hand side) ---------- */

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  z-index: 55;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  gap: 22px;
  background: rgba(11, 10, 15, 0.9);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar__label {
  padding: 0 12px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.navlink {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 500;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}

.navlink svg {
  width: 24px;
  height: 24px;
  flex: none;
}

.navlink:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.navlink.is-active {
  color: #fff;
  background: linear-gradient(
    90deg,
    rgba(255, 45, 120, 0.18),
    rgba(255, 45, 120, 0.02)
  );
}

.navlink.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  translate: -6px -50%;
  width: 3px;
  height: 26px;
  border-radius: var(--r-pill);
  background: var(--pink);
  box-shadow: 0 0 12px rgba(255, 45, 120, 0.9);
}

.navlink__count {
  margin-left: auto;
  padding: 1px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  color: var(--text-2);
}

.sidebar__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sidebar__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.76rem;
  color: var(--text-3);
}

.sidebar__legal a:hover {
  color: var(--text-2);
}

.sidebar__note {
  font-size: 0.7rem;
  color: var(--text-3);
}

/* ---------- Main region ---------- */

.main {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main--fixed {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 28px 60px;
}

.page--flush {
  max-width: none;
  padding: 0;
  min-height: 0;
}

.page-head {
  margin-bottom: 26px;
}

.page-head__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--pink-soft);
}

.page-head__sub {
  margin-top: 10px;
  max-width: 62ch;
  color: var(--text-2);
}

.grad-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  background: rgba(10, 9, 13, 0.7);
  padding: 34px 28px 40px;
}

.footer__inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 24px 40px;
  align-items: flex-start;
  justify-content: space-between;
}

.footer__brand {
  max-width: 34ch;
}

.footer__brand p {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-3);
}

.footer__meta {
  width: 100%;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--text-3);
}

/* ---------- Mobile bottom nav + drawer ---------- */

.tabbar {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  z-index: 60;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 9, 13, 0.92);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}

.tabbar__row {
  display: flex;
  justify-content: space-around;
}

.tabbar a {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 0.66rem;
}

.tabbar a svg {
  width: 22px;
  height: 22px;
}

.tabbar a.is-active {
  color: var(--pink);
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 54;
  background: rgba(4, 3, 6, 0.72);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease);
}

body.drawer-open .scrim {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(4, 3, 6, 0.78);
  backdrop-filter: blur(8px);
}

.modal[hidden] {
  display: none;
}

.modal__card {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 30px 28px 26px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #17151f 0%, #0e0d13 100%);
  box-shadow: var(--shadow-md);
  animation: pop 0.24s var(--ease);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.modal__title {
  font-size: 1.4rem;
}

.modal__sub {
  margin: 8px 0 22px;
  font-size: 0.88rem;
  color: var(--text-2);
}

.modal__switch {
  margin-top: 18px;
  font-size: 0.84rem;
  color: var(--text-3);
  text-align: center;
}

.modal__switch button {
  color: var(--pink-soft);
  font-weight: 500;
}

.modal__switch button:hover {
  text-decoration: underline;
}

.notice {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 45, 120, 0.28);
  background: rgba(255, 45, 120, 0.08);
  font-size: 0.78rem;
  color: #ffc4dc;
}

.notice--ok {
  border-color: rgba(120, 220, 170, 0.32);
  background: rgba(120, 220, 170, 0.09);
  color: #bdf0d6;
}

/* ---------- Auth ---------- */

.topbar__account {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.86rem;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.topbar__account:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.28);
}

.topbar__avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.84rem;
}

.topbar__account-name {
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal__card--auth {
  width: min(452px, 100%);
}

.auth__gate {
  margin: -8px 0 20px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 45, 120, 0.3);
  background: rgba(255, 45, 120, 0.09);
  font-size: 0.84rem;
  color: #ffd2e3;
}

.auth__providers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.auth__provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.82rem;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.auth__provider:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.28);
}

.auth__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 16px;
  color: var(--text-3);
  font-size: 0.76rem;
}

.auth__divider::before,
.auth__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth__aside {
  margin-top: 12px;
  text-align: center;
  font-size: 0.82rem;
}

.auth__aside button {
  color: var(--text-2);
}

.auth__aside button:hover {
  color: var(--text);
  text-decoration: underline;
}

.auth__aside--danger {
  margin-top: 16px;
}

.auth__aside--danger button {
  color: #ff9ab6;
}

.auth__meta {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.auth__meta li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  font-size: 0.84rem;
}

.auth__meta li + li {
  border-top: 1px solid var(--line);
}

.auth__meta span {
  color: var(--text-3);
}

.auth__danger {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 45, 120, 0.3);
  background: rgba(255, 45, 120, 0.07);
}

.auth__danger p {
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: #ffc4dc;
}

@media (max-width: 520px) {
  .topbar__account-name {
    display: none;
  }

  .auth__providers {
    grid-template-columns: 1fr;
  }

  .auth__provider {
    justify-content: flex-start;
    padding-left: 16px;
  }
}

/* ---------- Fullscreen (intimate) chat mode ---------- */

body.chat-immersive .topbar,
body.chat-immersive .sidebar,
body.chat-immersive .tabbar {
  display: none;
}

body.chat-immersive .main {
  margin-left: 0;
  padding-top: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  :root {
    --sidebar-w: 220px;
  }

  .topbar__promo {
    display: none;
  }
}

@media (max-width: 860px) {
  .topbar__burger {
    display: grid;
  }

  .sidebar {
    top: 0;
    height: 100vh;
    width: min(292px, 84vw);
    padding-top: 18px;
    translate: -102% 0;
    transition: translate 0.26s var(--ease);
    z-index: 70;
  }

  body.drawer-open .sidebar {
    translate: 0 0;
  }

  .main {
    margin-left: 0;
    padding-bottom: 76px;
  }

  .main--fixed {
    height: auto;
    overflow: visible;
  }

  .tabbar {
    display: block;
  }

  .page {
    padding: 22px 16px 40px;
  }

  /* Restated after the .page override above, which would otherwise re-pad the feed. */
  .page--flush {
    padding: 0;
  }

  .footer {
    padding: 28px 16px 88px;
  }
}
