/* Forge | app.css — shell for logged-in screens + animations */

.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }

.app-header {
  position: sticky; top: 0; z-index: 40;
  min-height: 56px;
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-4);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.app-header .title {
  flex: 1; font-size: 18px; font-weight: 700;
  color: var(--text-strong); letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-header .icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); position: relative;
  transition: background var(--t-fast) var(--ease-in), color var(--t-fast) var(--ease-in);
}
.app-header .icon-btn:hover { background: var(--surface-2); color: var(--text); }
.app-header .icon-btn svg { width: 20px; height: 20px; }

.app-header .bell-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; background: var(--accent-pink); border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg);
  animation: bell-pulse 1.6s ease-in-out infinite;
}
@keyframes bell-pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.15);opacity:.85} }

.app-main {
  flex: 1; padding: var(--s-4);
  padding-bottom: calc(64px + var(--s-6) + env(safe-area-inset-bottom));
  animation: page-enter 260ms var(--ease-in);
}
@keyframes page-enter { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

.app-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: 64px; display: flex; align-items: stretch;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.app-nav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10px; font-weight: 600;
  letter-spacing: 0.02em; position: relative;
  transition: color var(--t-fast) var(--ease-in);
}
.app-nav a svg { width: 22px; height: 22px; transition: transform var(--t-normal) var(--ease-in); }
.app-nav a[aria-current="page"] { color: var(--primary); }
.app-nav a[aria-current="page"] svg { transform: translateY(-1px) scale(1.05); }
.app-nav a[aria-current="page"]::before {
  content: ''; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 3px; border-radius: 999px;
  background: var(--gradient-forge); box-shadow: 0 0 10px rgba(79,126,255,0.5);
}
.app-nav a:active svg { transform: scale(0.9); }
.app-nav .nav-badge {
  position: absolute; top: 6px; right: calc(50% - 20px);
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent-pink); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--surface);
}

@media (min-width: 900px) {
  .app-shell { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: auto 1fr;
    grid-template-areas: "sidebar header" "sidebar main"; }
  .app-header { grid-area: header; }
  .app-main { grid-area: main; padding: var(--s-6); padding-bottom: var(--s-6);
    max-width: 1100px; margin: 0 auto; width: 100%; }
  .app-nav { display: none; }
}

/* TABS */
.tabs {
  display: flex; gap: var(--s-1); padding: 4px;
  background: var(--surface-2); border-radius: var(--r-pill);
  margin-bottom: var(--s-5); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1; min-width: 72px; padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-align: center; white-space: nowrap;
  transition: background var(--t-normal) var(--ease-in), color var(--t-normal) var(--ease-in);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab.on { background: var(--surface); color: var(--text-strong); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.tab .tab-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent-pink); color: #fff;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.tab.on .tab-badge { box-shadow: 0 0 0 2px var(--surface); }

/* LIST ROWS */
.list { display: flex; flex-direction: column; gap: var(--s-2); }
.list-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
  animation: row-in 340ms var(--ease-in) both;
  animation-delay: calc(var(--i, 0) * 40ms);
  transition: transform var(--t-fast) var(--ease-in),
              border-color var(--t-fast) var(--ease-in),
              box-shadow var(--t-fast) var(--ease-in);
}
@media (hover: hover) { .list-row:hover { border-color: var(--border-strong); box-shadow: var(--sh-sm); } }
.list-row:active { transform: scale(0.995); }
@keyframes row-in { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.list-row .row-body { flex: 1; min-width: 0; }
.list-row .row-title {
  font-weight: 600; color: var(--text-strong); font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-row .row-sub { color: var(--muted); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-mini {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: var(--surface-2);
  transition: background var(--t-fast) var(--ease-in),
              color var(--t-fast) var(--ease-in),
              transform var(--t-fast) var(--ease-in);
}
.btn-mini:active { transform: scale(0.94); }
.btn-mini svg { width: 16px; height: 16px; }
.btn-mini.accept { color: #fff; background: var(--primary); }
.btn-mini.decline { color: var(--error); background: rgba(239,68,68,0.12); }
.btn-mini.warn { color: var(--warning); background: rgba(245,158,11,0.12); }

/* EMPTY */
.empty { text-align: center; padding: var(--s-8) var(--s-4); animation: page-enter 320ms var(--ease-in); }
.empty-icon {
  width: 72px; height: 72px; margin: 0 auto var(--s-4);
  border-radius: 50%; background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.empty-icon svg { width: 32px; height: 32px; }
.empty-title { font-size: 17px; font-weight: 700; color: var(--text-strong); margin-bottom: var(--s-1); }
.empty-sub { color: var(--muted); font-size: 14px; margin-bottom: var(--s-5); }

/* ============================================================
   Side drawer + drawer items — added this stage
   ============================================================ */

/* Hamburger — always visible on phone */
.app-header .burger { flex-shrink: 0; }

/* Overlay behind the drawer */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 6, 12, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease-in);
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

/* The drawer itself */
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 70;
  width: min(82vw, 320px);
  background: var(--surface);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 280ms var(--ease-drawer);
  display: flex; flex-direction: column;
  padding: 18px 12px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer.open { transform: translateX(0); }
.drawer::-webkit-scrollbar { width: 4px; }
.drawer::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Brand at top */
.drawer-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.drawer-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--gradient-forge);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 18px rgba(79,126,255,0.35);
}
.drawer-brand-text {
  font-size: 17px; font-weight: 800; letter-spacing: 0.18em;
  background: var(--gradient-forge);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* User card (profile shortcut) */
.drawer-user {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  margin-bottom: 14px;
  color: var(--text);
  transition: background var(--t-fast) var(--ease-in);
}
.drawer-user:active { background: var(--surface-3); }
.drawer-user .du-info { min-width: 0; flex: 1; }
.drawer-user .du-name {
  font-weight: 600; font-size: 14px; color: var(--text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drawer-user .du-handle {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Section headers */
.drawer-section {
  font-size: 10px; font-weight: 700;
  color: var(--muted-2);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 14px 12px 6px;
}

/* Nav items */
.drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--text);
  font-size: 14px; font-weight: 500;
  transition: background var(--t-fast) var(--ease-in),
              color var(--t-fast) var(--ease-in);
  background: none; border: none; cursor: pointer;
  text-align: left; width: 100%;
}
.drawer-item:active { background: var(--surface-2); }
.drawer-item .di-icon {
  width: 22px; height: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.drawer-item .di-icon svg { width: 20px; height: 20px; }
.drawer-item[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
}
.drawer-item[aria-current="page"] .di-icon { color: var(--primary); }
.drawer-item.danger { color: var(--error); margin-top: 10px; }
.drawer-item.danger .di-icon { color: var(--error); }

/* Desktop — drawer becomes a permanent sidebar */
@media (min-width: 900px) {
  .app-shell {
    grid-template-columns: 260px 1fr;
    grid-template-areas: "sidebar header" "sidebar main";
  }
  .drawer {
    position: sticky;
    top: 0;
    transform: none !important;
    width: auto;
    height: 100vh;
    grid-area: sidebar;
    border-right: 1px solid var(--border);
    border-radius: 0;
  }
  .drawer-overlay { display: none !important; }
  .app-header .burger { display: none; }
  .app-nav { display: none; }
}
