/* ============================================================
   QLUV V2 — Layout: app shell (sidebar + topbar + view), trang
   đăng nhập. Tên class KHỚP với markup trong shell.js.
   ============================================================ */

#app, .layout { height: 100vh; }

/* ---- Khung tổng: sidebar + main ---- */
.layout {
  display: grid;
  grid-template-columns: 256px 1fr;
  overflow: hidden;
}
.layout.collapsed { grid-template-columns: 76px 1fr; }

/* ---- Sidebar ---- */
.sidebar {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-2); border-right: 1px solid var(--line);
  overflow: hidden;
}
.sidebar-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5); min-height: 61px;
  border-bottom: 1px solid var(--line);
}
.sidebar-head .logo {
  width: 36px; height: 36px; flex: none; border-radius: var(--r-md);
  display: grid; place-items: center; font-size: 18px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff;
}
.sidebar-brand { overflow: hidden; white-space: nowrap; }
.brand-name { font-weight: 800; letter-spacing: .02em; line-height: 1.15; }
.brand-sub { font-size: var(--fs-xs); color: var(--muted); }
.layout.collapsed .sidebar-brand { display: none; }

.side-nav {
  flex: 1 1 auto; overflow-y: auto;
  padding: var(--sp-3); display: flex; flex-direction: column; gap: 2px;
}
.side-btn {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r-md);
  color: var(--text-2); font-weight: 600; font-size: var(--fs-md);
  text-align: left; width: 100%; white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.side-btn .si { width: 22px; flex: none; text-align: center; font-size: 1.15em; }
.side-btn .sl { overflow: hidden; text-overflow: ellipsis; }
.side-btn:hover { background: var(--primary-weak); color: var(--text); }
.side-btn.active { background: var(--primary-weak); color: var(--primary); }
.layout.collapsed .side-btn { justify-content: center; }
.layout.collapsed .side-btn .sl { display: none; }

.sidebar-foot {
  padding: var(--sp-3); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.user-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2); border-radius: var(--r-md); background: var(--surface-2);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: var(--fs-sm);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff;
}
.user-meta { overflow: hidden; min-width: 0; }
.user-name { font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: var(--fs-xs); color: var(--muted); }
.layout.collapsed .user-meta, .layout.collapsed #btnLogout { display: none; }
.layout.collapsed .user-chip { justify-content: center; }

/* ---- Main (topbar + view) ---- */
.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5); min-height: 61px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: var(--fs-xl); font-weight: 800; }
.topbar-actions { margin-left: auto; display: flex; gap: var(--sp-2); }

.view { flex: 1 1 auto; overflow-y: auto; padding: var(--sp-6); }

/* ---- Trang đăng nhập ---- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-4);
  background: radial-gradient(1200px 600px at 20% -10%, rgba(79,124,255,.16), transparent),
              radial-gradient(1000px 500px at 100% 110%, rgba(56,189,248,.10), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; padding: var(--sp-8); }
.auth-logo { width: 52px; height: 52px; border-radius: var(--r-lg); margin: 0 auto var(--sp-4);
  display: grid; place-items: center; font-size: 26px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; box-shadow: var(--shadow-2); }
.auth-title { text-align: center; margin-bottom: var(--sp-1); }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: var(--sp-6); font-size: var(--fs-sm); }
.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.auth-err { font-size: var(--fs-sm); color: var(--danger); min-height: 18px; }

/* ---- Mobile: sidebar thu về thanh icon ---- */
@media (max-width: 820px) {
  .layout { grid-template-columns: 76px 1fr; }
  .sidebar-brand, .side-btn .sl, .user-meta, #btnLogout { display: none; }
  .side-btn { justify-content: center; }
  .user-chip { justify-content: center; }
  .view { padding: var(--sp-4); }
}
