/* =====================================================
   BookFlow Website — Design System
   Dark theme: deep forest green + gold accent
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@700&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-primary:    #0c0f14;
  --bg-secondary:  #111820;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.08);
  --border-hover:  rgba(255,255,255,0.16);

  --green-dark:    #1a3a2a;
  --green-mid:     #2d6a4f;
  --green-bright:  #40916c;
  --green-light:   #74c69d;

  --gold:          #d4a843;
  --gold-light:    #f0c875;
  --gold-dim:      rgba(212,168,67,0.15);

  --text-primary:  #f0f4f8;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  --status-free:       #40916c;
  --status-borrowed:   #3b82f6;
  --status-lost:       #ef4444;
  --status-new:        #a855f7;
  --status-withdrawn:  #6b7280;

  --danger:        #ef4444;
  --danger-dim:    rgba(239,68,68,0.15);
  --success:       #22c55e;
  --success-dim:   rgba(34,197,94,0.12);

  --sidebar-w:     260px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 32px rgba(0,0,0,0.5);
  --shadow-gold:   0 0 24px rgba(212,168,67,0.18);
  --transition:    all 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--green-mid); border-radius: 3px; }

/* ════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════ */
.hidden  { display: none !important; }
.flex    { display: flex; }
.gap-8   { gap: 8px; }
.gap-16  { gap: 16px; }
.gap-24  { gap: 24px; }
.mt-8    { margin-top: 8px; }
.mt-16   { margin-top: 16px; }
.mt-24   { margin-top: 24px; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.w-full  { width: 100%; }

/* ── Glassmorphism card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  transition: var(--transition);
}
.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--green-mid), var(--green-bright));
  color: #fff;
  box-shadow: 0 4px 16px rgba(64,145,108,0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(64,145,108,0.5);
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #1a1a1a;
  box-shadow: 0 4px 16px rgba(212,168,67,0.35);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: var(--shadow-gold); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-hover); }
.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: 50%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ── Badge / Status pill ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.badge-free       { background: rgba(64,145,108,0.18); color: var(--status-free); border: 1px solid rgba(64,145,108,0.3); }
.badge-borrowed   { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }
.badge-lost       { background: var(--danger-dim);     color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.badge-new        { background: rgba(168,85,247,0.15); color: #c084fc; border: 1px solid rgba(168,85,247,0.25); }
.badge-withdrawn  { background: rgba(107,114,128,0.15);color: #9ca3af; border: 1px solid rgba(107,114,128,0.2); }
.badge-superuser  { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(212,168,67,0.3); }

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label  { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}
.form-input:focus { border-color: var(--green-bright); background: rgba(255,255,255,0.07); box-shadow: 0 0 0 3px rgba(64,145,108,0.15); }
.form-input::placeholder { color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── Spinner ── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--green-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: #1e2a35;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: slideInRight 0.3s ease, fadeOut 0.4s ease 3.6s forwards;
  max-width: 320px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger);  }
.toast-info    { border-left: 3px solid var(--green-bright); }
.toast .toast-icon { font-size: 18px; }
@keyframes slideInRight { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeOut      { to   { opacity: 0; transform: translateX(110%); } }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: #151d28;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-body  { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 22px; line-height: 1; transition: var(--transition); }
.modal-close:hover { color: var(--text-primary); }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn  { from { transform: scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }

/* ═══════════════════════════════════════
   NAVIGATION BAR (public)
   ═══════════════════════════════════════ */
#public-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 64px;
  background: rgba(12,15,20,0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.nav-logo .logo-icon { font-size: 26px; }
.nav-logo span { background: linear-gradient(135deg, var(--green-light), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-link { font-size: 14px; font-weight: 500; color: var(--text-secondary); transition: var(--transition); }
.nav-link:hover { color: var(--text-primary); }

.lang-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lang-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.lang-select {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  padding: 6px 28px 6px 12px;
  font-size: 12px;
  font-weight: 700;
  outline: none;
  transition: var(--transition);
}

.lang-select:hover,
.lang-select:focus {
  border-color: var(--green-bright);
  background: rgba(255,255,255,0.08);
}

.sidebar-lang-select {
  margin: 0 12px 10px;
  justify-content: space-between;
}

/* ═══════════════════════════════════════
   APP LAYOUT (authenticated)
   ═══════════════════════════════════════ */
#app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform 0.3s ease;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
  font-weight: 800;
}
.sidebar-logo .logo-icon { font-size: 24px; }
.sidebar-logo span { background: linear-gradient(135deg, var(--green-light), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-mid), var(--green-bright));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sidebar-user-info .name { font-weight: 600; font-size: 14px; }
.sidebar-user-info .email { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar-section-title {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 8px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-item:hover { background: var(--bg-card); color: var(--text-primary); }
.sidebar-item.active { background: rgba(64,145,108,0.15); color: var(--green-light); }
.sidebar-item .item-icon { font-size: 18px; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-item.superuser-item .item-icon { color: var(--gold); }
.sidebar-item.superuser-item.active { background: var(--gold-dim); color: var(--gold-light); }
.sidebar-item.superuser-item:hover { background: rgba(212,168,67,0.1); color: var(--gold-light); }

.sidebar-footer {
  padding: 16px 10px;
  border-top: 1px solid var(--border);
}

/* Main content */
#main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 32px 36px;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ═══════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ═══════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════ */
#page-landing {
  min-height: 100vh;
  padding-top: 64px;
}

/* Hero */
.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 80px 40px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(45,106,79,0.45) 0%, transparent 70%),
              radial-gradient(ellipse 60% 40% at 80% 80%, rgba(212,168,67,0.1) 0%, transparent 60%);
  pointer-events: none;
}
.hero-books {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.floating-book {
  position: absolute;
  font-size: 32px;
  opacity: 0.12;
  animation: floatBook linear infinite;
  user-select: none;
}
@keyframes floatBook {
  0%   { transform: translateY(110vh) rotate(-15deg); opacity: 0; }
  10%  { opacity: 0.12; }
  90%  { opacity: 0.12; }
  100% { transform: translateY(-10vh) rotate(15deg); opacity: 0; }
}
.hero-content {
  position: relative;
  text-align: center;
  max-width: 720px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold-dim);
  border: 1px solid rgba(212,168,67,0.25);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 20px;
}
.hero-title .accent {
  background: linear-gradient(135deg, var(--green-light), var(--gold-light));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 560px;
  margin-inline: auto;
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Global counter strip */
.stats-strip {
  display: flex;
  justify-content: center;
  gap: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat-pill {
  flex: 1;
  max-width: 220px;
  padding: 24px 32px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.stat-pill:last-child { border-right: none; }
.stat-pill .stat-value {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--green-light), var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-pill .stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* How it works */
.section { padding: 90px 40px; max-width: 1100px; margin: 0 auto; }
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}
.section-subtitle { text-align: center; color: var(--text-secondary); font-size: 16px; margin-bottom: 56px; }

.steps-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 24px; }
.step-card {
  padding: 32px 24px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.step-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green-bright), var(--gold));
  opacity: 0;
  transition: var(--transition);
}
.step-card:hover::before { opacity: 1; }
.step-card:hover { transform: translateY(-4px); border-color: var(--border-hover); }
.step-number {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
  border: 1px solid rgba(64,145,108,0.3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 18px;
  margin: 0 auto 16px;
  color: var(--green-light);
}
.step-icon { font-size: 36px; margin-bottom: 16px; display: block; }
.step-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.step-desc  { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* CTA section */
.cta-section {
  background: linear-gradient(135deg, var(--green-dark) 0%, rgba(45,106,79,0.4) 100%);
  border-top: 1px solid rgba(64,145,108,0.2);
  border-bottom: 1px solid rgba(64,145,108,0.2);
  padding: 80px 40px;
  text-align: center;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.footer-logo {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}
.footer-logo span { background: linear-gradient(135deg, var(--green-light), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ═══════════════════════════════════════
   AUTH PAGE
   ═══════════════════════════════════════ */
#page-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(45,106,79,0.3) 0%, transparent 70%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #121923;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
  animation: scaleIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.auth-logo {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}
.auth-logo span { background: linear-gradient(135deg, var(--green-light), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 32px; }
.auth-tabs { display: flex; gap: 0; margin-bottom: 28px; background: var(--bg-primary); border-radius: var(--radius-sm); padding: 4px; }
.auth-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  transition: var(--transition);
}
.auth-tab.active { background: var(--green-mid); color: #fff; }
.auth-divider { height: 1px; background: var(--border); margin: 20px 0; position: relative; }
.auth-divider span {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #121923;
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.google-btn:hover { background: rgba(255,255,255,0.1); }

/* ═══════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 16px; margin-bottom: 28px; }
.kpi-card {
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: attr(data-icon);
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
  opacity: 0.07;
}
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 8px; }
.kpi-value { font-size: 36px; font-weight: 800; line-height: 1; }
.kpi-change { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.kpi-card.green  .kpi-value { color: var(--green-light); }
.kpi-card.gold   .kpi-value { color: var(--gold); }
.kpi-card.blue   .kpi-value { color: #60a5fa; }
.kpi-card.purple .kpi-value { color: #c084fc; }

/* Activity feed */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.activity-text { flex: 1; font-size: 13px; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* Grid 2 col */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════
   BOOKS TABLE
   ═══════════════════════════════════════ */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px 9px 38px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  position: relative;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--green-bright); }
.search-wrapper { position: relative; flex: 1; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; pointer-events: none; }
.filter-select {
  padding: 9px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.filter-select option { background: #1e2a35; }

.data-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.025); }
.data-table .book-title { font-weight: 600; font-size: 13px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table .book-author { font-size: 12px; color: var(--text-muted); }
.book-cover-sm {
  width: 36px; height: 50px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--green-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  border: 1px solid var(--border);
}
img.book-cover-sm { display: block; }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 52px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

/* ═══════════════════════════════════════
   SUPERUSER PANEL
   ═══════════════════════════════════════ */
.su-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.su-tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: none; background: none;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  margin-bottom: -1px;
}
.su-tab:hover { color: var(--text-primary); }
.su-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.user-row-actions { display: flex; gap: 6px; align-items: center; }
.action-select {
  padding: 5px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.action-select option { background: #1e2a35; }

/* Global stats for superuser */
.global-stat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 16px; }
.global-stat-card { padding: 24px; }
.global-stat-card .stat-icon { font-size: 32px; margin-bottom: 10px; }
.global-stat-card .stat-number { font-size: 38px; font-weight: 800; color: var(--gold); line-height: 1; }
.global-stat-card .stat-name { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 1200px), (hover: none) and (pointer: coarse) {
  #app-layout {
    display: block;
    overflow-x: hidden;
  }
  #sidebar {
    width: min(82vw, 320px);
    max-width: 320px;
    transform: translateX(-100%);
  }
  #sidebar:not(.open) { visibility: hidden; }
  #sidebar.open { visibility: visible; }
  #sidebar.open { transform: none; }
  #main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 76px 16px 20px;
    overflow-x: hidden;
  }
  #main-content > * { max-width: 100%; }
  .hero { padding: 60px 20px; }
  .section { padding: 60px 20px; }
  .stats-strip { flex-wrap: wrap; }
  .stat-pill { max-width: 50%; border-bottom: 1px solid var(--border); }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card { padding: 16px 14px; }
  .kpi-value { font-size: 28px; }
  .kpi-label { font-size: 10px; }
  .kpi-change { font-size: 11px; }
  .activity-item { gap: 10px; padding: 12px 0; }
  .activity-text { min-width: 0; }
  .activity-text strong { line-height: 1.25; display: block; }
  .activity-time {
    font-size: 10px;
    min-width: 64px;
    text-align: right;
    white-space: normal;
  }
  .page-header-dashboard {
    display: none;
  }
  #public-nav { padding: 0 20px; }
  .nav-links { gap: 12px; }
  .mobile-menu-btn { display: flex; }
  .mobile-sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 49;
    display: none;
  }
  .mobile-sidebar-overlay.visible { display: block; }
}
@media (max-width: 480px), (hover: none) and (pointer: coarse) and (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  .page-title { font-size: 20px; }
}

/* ── Topbar (mobile) ── */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100vw;
  z-index: 60;
}
@media (max-width: 1200px), (hover: none) and (pointer: coarse) {
  .mobile-topbar {
    display: flex;
  }
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-mid), var(--green-bright));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.topbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#topbar-username {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html, body {
  overflow-x: hidden;
}

.hamburger {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 300% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer { to { background-position: -300% 0; } }

/* ═══════════════════════════════════════
   PRINT STYLES FOR LABELS
   ═══════════════════════════════════════ */
@media print {
  body > *:not(#print-overlay) {
    display: none !important;
  }
  #print-overlay {
    display: flex !important;
    visibility: visible !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #fff;
    color: #000;
    flex-wrap: wrap;
    gap: 15px;
    align-content: flex-start;
    justify-content: flex-start;
  }
  @page { margin: 1cm; margin-bottom: 0px; }
  .print-label-box {
    border: 2px dashed #000;
    padding: 15px;
    width: 250px;
    height: 310px;
    text-align: center;
    page-break-inside: avoid;
    box-sizing: border-box;
  }
  .print-logo { font-size: 24px; font-weight: bold; margin-bottom: 12px; }
  .print-title { font-size: 16px; font-weight: bold; margin-bottom: 5px; max-height:40px; overflow:hidden;}
  .print-author { font-size: 13px; margin-bottom: 15px; }
  .print-qr img { width: 140px; height: 140px; margin: 0 auto; }
  .print-instr { font-size: 11px; margin-top: 10px; color: #555; }
}

/* ═══════════════════════════════════════
   MODAL BACKDROP (App specifically)
   ═══════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal-container {
  background: #111823;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: scaleIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
#modal-cover-placeholder {
  width: 44px; height: 60px;
  border-radius: 4px;
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; border: 1px solid var(--border);
}

/* Timeline specific */
.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 24px;
  border-left: 2px solid var(--border);
  position: relative;
  margin-left: 10px;
  padding-left: 20px;
}
.timeline-item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}
.timeline-dot {
  position: absolute;
  left: -8px;
  top: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #111823;
}

/* ── Custom Tabs for Borrowed View ── */
.tabs-group {
  display: flex;
  background: var(--bg-primary);
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
  margin-left: auto;
}
.btn-tab {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: var(--radius-sm);
}
.btn-tab:hover {
  color: var(--text-primary);
}
.btn-tab.active {
  background: var(--bg-card);
  color: var(--green-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}


