/* ========================================
   EBooks Digital — Dashboard Layout
   Matches real app sidebar & topbar exactly
   ======================================== */

.dashboard-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: hsl(var(--background));
}

/* --- Sidebar --- */
.sidebar {
  width: 250px;
  background: hsl(var(--sidebar-background));
  border-right: 1px solid hsl(var(--sidebar-border));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid hsl(var(--sidebar-border));
}
.sidebar-toggle {
  margin-left: auto; padding: 0.375rem;
  border-radius: 0.75rem; border: none; background: transparent;
  cursor: pointer; color: hsl(var(--muted-foreground));
  font-size: 1rem;
}
.sidebar-toggle:hover { background: hsl(var(--muted)); }

.sidebar-user {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--sidebar-border));
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-weight: 700; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: hsl(var(--foreground)); }
.sidebar-user-role { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }

/* --- Admin/Member Toggle --- */
.sidebar-toggle-section {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid hsl(var(--sidebar-border));
}
.toggle-group {
  display: flex; border-radius: 0.75rem;
  background: hsl(var(--muted)); padding: 0.25rem; gap: 0.25rem;
}
.toggle-btn {
  flex: 1; padding: 0.375rem; border: none; border-radius: 0.5rem;
  font-size: 0.75rem; font-weight: 700; cursor: pointer;
  background: transparent; color: hsl(var(--muted-foreground));
  transition: all 0.15s;
}
.toggle-btn:hover { color: hsl(var(--foreground)); }
.toggle-btn.active {
  background: hsl(var(--card)); color: hsl(var(--foreground));
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* --- Sidebar Nav Items (matches real .nav-link-item) --- */
.sidebar-nav { flex: 1; padding: 0.75rem; overflow-y: auto; }

.nav-link-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.8125rem; font-weight: 600;
  color: hsl(var(--sidebar-foreground));
  transition: all 0.15s;
  margin-bottom: 0.125rem;
  cursor: pointer;
}
.nav-link-item:hover { background: hsl(var(--muted)); }
.nav-link-item.active {
  background: hsl(var(--sidebar-accent));
  color: hsl(var(--foreground));
}
.nav-link-item.nav-link-danger { color: hsl(var(--destructive)); }
.nav-link-item.nav-link-danger:hover { background: hsl(var(--destructive) / 0.1); }

/* Nav icon box (matches real app's rounded-xl bordered icon containers) */
.nav-icon-box {
  width: 2rem; height: 2rem; border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  font-size: 0.875rem; flex-shrink: 0;
  color: hsl(var(--muted-foreground));
}
.nav-icon-box.active {
  border-color: hsl(var(--accent) / 0.3);
  background: hsl(var(--accent) / 0.1);
}

.nav-chevron {
  margin-left: auto; font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid hsl(var(--sidebar-border));
}

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
}

.topbar-left { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.topbar-title { font-size: 1.125rem; font-weight: 800; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-subtitle { font-size: 0.75rem; color: hsl(var(--muted-foreground)); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

.mobile-menu-btn {
  display: none;
  padding: 0.5rem;
  border: none; border-radius: 0.75rem;
  background: transparent;
  cursor: pointer;
  font-size: 1.25rem;
  color: hsl(var(--muted-foreground));
}
.mobile-menu-btn:hover { background: hsl(var(--muted)); }

/* --- Main Content --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
}

/* --- Mobile Bottom Nav --- */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: hsl(var(--card));
  border-top: 1px solid hsl(var(--border));
  z-index: 50;
}
.mobile-nav-inner {
  display: flex;
}
.mobile-nav-link {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.125rem;
  padding: 0.625rem 0.5rem;
  font-size: 0.625rem; font-weight: 700;
  color: hsl(var(--muted-foreground));
  transition: color 0.15s;
}
.mobile-nav-link.active { color: hsl(var(--accent)); }
.mobile-nav-link .nav-icon { font-size: 1.375rem; }

/* --- Auth Page Layouts (matched to real app) --- */
.auth-page-centered {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: hsl(var(--background));
}

/* Login split card */
.auth-split-card {
  width: 100%; max-width: 56rem; border-radius: 1.5rem; overflow: hidden;
  border: 1px solid hsl(var(--border)); box-shadow: var(--shadow-elevated);
  display: flex;
}
.auth-split-left {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 45%; padding: 3rem; position: relative; overflow: hidden;
  background: conic-gradient(from 210deg, hsl(var(--pink-dark)), hsl(var(--yellow)), hsl(var(--blue-dark)), hsl(var(--pink-dark)));
}
.auth-radial-overlay {
  position: absolute; inset: 0; opacity: 0.2;
  background: radial-gradient(circle at 30% 70%, white 0%, transparent 60%), radial-gradient(circle at 80% 20%, white 0%, transparent 50%);
}
.auth-split-left-content { position: relative; z-index: 1; text-align: center; }
.auth-split-left-content h2 { font-size: 1.5rem; font-weight: 900; color: hsl(var(--foreground)); margin-bottom: 0.5rem; }
.auth-split-left-content > p { font-size: 0.875rem; font-weight: 600; color: hsl(var(--foreground) / 0.8); }
.auth-brand-icon {
  width: 4rem; height: 4rem; border-radius: 1rem;
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
}
.auth-brand-icon span { font-size: 1.5rem; font-weight: 900; color: hsl(var(--foreground)); }
.auth-features { margin-top: 2rem; }
.auth-feature-item {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.875rem; font-weight: 600; color: hsl(var(--foreground) / 0.9);
  margin-bottom: 0.75rem;
}
.auth-check {
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  background: rgba(255,255,255,0.3); display: flex; align-items: center; justify-content: center;
  font-size: 0.625rem;
}
.auth-security-card {
  margin-top: 2.5rem; padding: 1rem; border-radius: 1rem;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  text-align: left;
}
.auth-security-title { font-size: 0.75rem; font-weight: 700; color: hsl(var(--foreground) / 0.7); margin-bottom: 0.5rem; }
.auth-security-desc { font-size: 0.75rem; color: hsl(var(--foreground) / 0.6); font-weight: 500; }

.auth-split-right {
  flex: 1; background: hsl(var(--card)); padding: 2rem 3rem;
  display: flex; align-items: center; justify-content: center;
}
.auth-form-inner { width: 100%; max-width: 24rem; }
.auth-heading { font-size: 1.5rem; font-weight: 800; color: hsl(var(--foreground)); letter-spacing: -0.01em; margin-bottom: 0.25rem; }
.auth-subheading { font-size: 0.875rem; color: hsl(var(--muted-foreground)); font-weight: 500; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-notice-card {
  margin-top: 1.25rem; padding: 0.75rem; border-radius: 1rem;
  background: hsl(var(--muted) / 0.5); border: 1px solid hsl(var(--border));
}
.auth-notice-title { font-size: 0.75rem; font-weight: 700; color: hsl(var(--muted-foreground)); margin-bottom: 0.25rem; }
.auth-notice-desc { font-size: 0.75rem; color: hsl(var(--muted-foreground)); font-weight: 500; }
.auth-link-center { text-align: center; font-size: 0.75rem; color: hsl(var(--muted-foreground)); font-weight: 500; margin-top: 1rem; }
.auth-accent-link { color: hsl(var(--accent)); font-weight: 700; }
.auth-accent-link:hover { text-decoration: underline; }
.auth-bold-link { font-weight: 700; color: hsl(var(--foreground)); text-decoration: underline; text-underline-offset: 2px; }
.auth-back-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.875rem; font-weight: 700; color: hsl(var(--muted-foreground));
  margin-bottom: 2rem;
}
.auth-back-link:hover { color: hsl(var(--foreground)); }
.auth-icon-circle {
  width: 3.5rem; height: 3.5rem; border-radius: 1rem;
  background: hsl(var(--accent) / 0.1); display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; margin: 0 auto 1rem;
}
.auth-centered-card { padding: 2rem; }

/* Referrer invite card (register page) */
.referrer-invite-card {
  padding: 1rem; border-radius: 1rem;
  background: hsl(var(--accent) / 0.1); border: 1px solid hsl(var(--accent) / 0.2);
  margin-bottom: 1.5rem;
}
.referrer-invite-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.referrer-invite-icon {
  width: 1.125rem; height: 1.125rem; border-radius: 50%;
  background: hsl(var(--accent)); color: #fff; font-size: 0.625rem;
  display: flex; align-items: center; justify-content: center;
}
.referrer-invite-label { font-size: 0.875rem; font-weight: 700; color: hsl(var(--foreground)); }
.referrer-invite-details { padding-left: 1.625rem; }
.referrer-invite-name { font-weight: 800; color: hsl(var(--foreground)); }
.referrer-invite-username { font-size: 0.75rem; color: hsl(var(--muted-foreground)); font-weight: 500; }

/* --- Sidebar Overlay (mobile) --- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 49;
}
.sidebar-overlay.active { display: block; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.mobile-open {
    display: flex; position: fixed; z-index: 50;
    top: 0; left: 0; bottom: 0; width: 280px;
    box-shadow: var(--shadow-elevated);
  }
  .mobile-menu-btn { display: block; }
  .mobile-nav { display: block; }
  .main-scroll { padding: 1rem; padding-bottom: 5rem; }
  .auth-split-left { display: none; }
  .auth-split-card { max-width: 100%; border-radius: 1rem; }
  .auth-split-right { padding: 1.5rem; }
}
