/* ═══════════════════════════════════════════════════════
   Layout — Topbar, Sidebar, Grid, Responsive
   ═══════════════════════════════════════════════════════ */

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,246,240,.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-h);
}
.logo {
  background: none; border: none;
  font-family: var(--font-heading); font-style: italic;
  font-size: 1.35rem; color: var(--ink); cursor: pointer;
  letter-spacing: .02em; white-space: nowrap;
}
.topbar nav { display: flex; align-items: center; gap: 8px; }

.nb {
  background: none; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 6px 18px; font-size: .82rem;
  transition: all .2s var(--ease); white-space: nowrap;
}
.nb:hover { border-color: var(--gold); color: var(--gold); }
.nb.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.topbar-right {
  display: flex; align-items: center; gap: 12px;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm);
  transition: background .15s;
}
.topbar-user:hover { background: var(--warm); }
.topbar-username {
  font-size: .88rem; font-weight: 500; color: var(--ink);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Main content wrapper ── */
.wrap {
  max-width: 720px; margin: 0 auto;
  padding: 44px 24px;
  animation: fadeUp .45s ease both;
}

/* ── Grid ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── Invite page background ── */
.invite-bg {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: 20px 16px;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(201,146,42,.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(45,122,79,.06) 0%, transparent 60%),
    var(--paper);
}
.invite-envelope {
  margin: auto;
  max-width: 360px; width: 100%;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop .5s cubic-bezier(.34,1.56,.64,1) both;
  display: flex;
  flex-direction: column;
}
.envelope-top {
  background: linear-gradient(135deg, #1a120a 0%, #2d2010 100%);
  padding: 20px 20px 28px;
  text-align: center; position: relative;
}
.envelope-top::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 20px; background: var(--card);
  clip-path: ellipse(55% 100% at 50% 100%);
}
.envelope-emoji {
  font-size: 3rem; display: block; margin-bottom: 8px;
  animation: heartbeat 2s ease-in-out infinite;
}
.envelope-type {
  font-size: .68rem; letter-spacing: .18em;
  color: rgba(255,255,255,.5); text-transform: uppercase;
  font-weight: 500; margin-bottom: 14px;
}
.envelope-to {
  font-family: var(--font-heading); font-style: italic;
  font-size: 1.6rem; color: #fff; font-weight: 400;
}
.envelope-body {
  padding: 18px 20px;
}
.answer-wrap { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }

/* ── Message block ── */
.msg-block {
  background: var(--warm); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 16px;
  border-left: 3px solid var(--gold); position: relative;
  overflow-wrap: break-word; word-break: break-word;
}
.msg-block::before {
  content: '\201C'; font-family: var(--font-heading);
  font-size: 3.5rem; color: var(--gold); opacity: .25;
  position: absolute; top: -8px; left: 12px; line-height: 1;
}
.msg-text {
  font-family: var(--font-heading); font-style: italic;
  font-size: .92rem; line-height: 1.7; color: var(--ink); padding-left: 8px;
  overflow-wrap: break-word; word-break: break-word; min-width: 0;
}
.msg-block .toggle-more-btn {
  margin-top: 6px;
}

/* ── Result screen ── */
.result-screen { text-align: center; padding: 12px 0 4px; }
.result-icon {
  font-size: 3.5rem; margin-bottom: 10px; display: block;
  animation: pop .5s cubic-bezier(.34,1.56,.64,1) both;
}
.result-title {
  font-family: var(--font-heading); font-size: 1.7rem; margin-bottom: 8px;
}
.result-sub { color: var(--muted); font-size: .95rem; line-height: 1.5; }

/* ── Page header ── */
.page-title {
  font-family: var(--font-heading); font-weight: 400;
  font-style: italic; font-size: 2.2rem; margin-bottom: 6px;
  line-height: 1.2;
}
.page-subtitle {
  color: var(--muted); margin-bottom: 26px; font-size: .95rem;
}

/* ── Section ── */
.section { margin-bottom: 32px; }
.section-title {
  font-size: .75rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

/* ── Sidebar (for dashboard) ── */
.app-with-sidebar { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg);
  color: var(--sidebar-text); padding: 0;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 150; transition: transform .3s var(--ease);
}
.sidebar-logo {
  padding: 20px 24px; font-family: var(--font-heading);
  font-style: italic; font-size: 1.3rem; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-section {
  padding: 16px 16px 6px;
  font-size: .65rem; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.6);
  font-weight: 600;
}
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; margin: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: .9rem; cursor: pointer;
  transition: all .15s var(--ease);
  background: none; border: none; width: calc(100% - 16px);
  text-align: left;
}
.sidebar-item:hover { background: var(--sidebar-bg-hover); color: #fff; }
.sidebar-item.active {
  background: var(--sidebar-active); color: #fff;
  font-weight: 500;
}
.sidebar-item-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.sidebar-content {
  flex: 1; margin-left: var(--sidebar-w);
  height: 100dvh; background: var(--paper);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-content .wrap { max-width: 1100px; }

/* ── Mobile hamburger ── */
.hamburger {
  display: none; background: none; border: none;
  font-size: 1.4rem; color: var(--ink); padding: 4px;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 140;
}

/* ══════════════════════════════════════════════════
   Bottom Navigation (Mobile)
   ══════════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(250,246,240,.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 8px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  z-index: 100;
  justify-content: space-around;
  align-items: flex-end;
}
.bn-item {
  display: flex; flex-direction: column; align-items: center;
  background: none; border: none; color: var(--muted);
  font-size: 1.2rem; gap: 2px; cursor: pointer; transition: color .2s;
  padding: 4px 6px;
  -webkit-tap-highlight-color: transparent;
}
.bn-item span {
  font-size: 0.62rem; font-family: var(--font-body);
  font-weight: 500; letter-spacing: .01em;
}
.bn-item.on { color: var(--gold); }
.bn-fab {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #c9922a, #e0a830);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 300;
  margin-top: -22px;
  box-shadow: 0 4px 16px rgba(201, 146, 42, 0.45);
  transition: transform .2s, box-shadow .2s;
}
.bn-fab:active { transform: scale(.92); }

/* ══════════════════════════════════════════════════
   In-App Notification Popup (Toast-like)
   ══════════════════════════════════════════════════ */
.notif-popup {
  position: fixed;
  top: 16px; left: 16px; right: 16px;
  max-width: 420px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 600;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  animation: notifSlideDown .4s var(--ease) both;
  -webkit-tap-highlight-color: transparent;
}
.notif-popup.removing {
  animation: notifSlideUp .3s var(--ease) forwards;
}
.notif-popup-icon { font-size: 1.5rem; flex-shrink: 0; }
.notif-popup-body { flex: 1; min-width: 0; }
.notif-popup-title {
  font-weight: 600; font-size: .88rem; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-popup-text {
  font-size: .82rem; color: var(--muted); line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-popup-close {
  background: none; border: none; color: var(--muted);
  font-size: 1.1rem; padding: 4px; cursor: pointer; flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  /* Dashboard: content takes full width when sidebar is hidden */
  .sidebar-content {
    margin-left: 0;
    height: 100dvh;
    padding-bottom: 64px;
  }
  .app-with-sidebar { display: block; }
  .hamburger { display: block; }
  .grid3 { grid-template-columns: 1fr 1fr; }

  /* ── Mobile: hide topbar nav, show bottom nav ── */
  .topbar { padding: 0 16px; }
  .topbar-right > .nb, .topbar-right > .pill-wrap { display: none !important; }
  .wrap { padding: 24px 16px 90px; }
  .page-title { font-size: 1.7rem; }
  .topbar-username { display: none; }
  .bottom-nav { display: flex; }

  /* Invite envelope mobile */
  .invite-bg { min-height: 100dvh; height: auto; overflow-y: auto; padding: 16px 10px; align-items: flex-start; padding-top: 24px; }
  .invite-envelope { border-radius: var(--radius-lg); max-width: 100% !important; }
  .envelope-top { padding: 24px 20px 22px; }
  .envelope-to { font-size: 1.6rem; }
  .envelope-body { padding: 20px 16px; }

  /* Modal mobile */
  .overlay { padding: 12px; align-items: flex-end; }
  .modal {
    border-radius: var(--radius-lg);
    max-height: 85vh;
    padding: 24px 20px;
    animation: slideUpModal .3s var(--ease);
  }
}

@media (max-width: 480px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .wrap { padding: 20px 14px 90px; }
  .page-title { font-size: 1.5rem; }
}

/* ── SEO Footer ── */
.seo-footer {
  text-align: center;
  padding: 32px 24px 24px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.seo-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.seo-footer-links a {
  color: var(--gold);
  text-decoration: none;
  font-size: .88rem;
  transition: opacity .2s;
}
.seo-footer-links a:hover { opacity: .7; }
.seo-footer-links span { color: var(--muted); font-size: .8rem; }
.seo-footer-copy {
  color: var(--muted);
  font-size: .78rem;
}
