/* ==========================================================================
   Ebookanda - Stylesheet utama
   1. Pembolehubah & asas
   2. Laman awam (landing page, produk)
   3. Shell dashboard (sidebar + kandungan)
   4. Komponen dashboard (stat card, panel, jadual)
   5. Halaman auth (login/daftar)
   6. Responsif
   ========================================================================== */

/* 1. PEMBOLEHUBAH & ASAS ================================================== */
:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --brand-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --staff-grad: linear-gradient(135deg, #0f172a 0%, #334155 100%);

  --ink: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e9ecf1;
  --page: #f4f6f9;
  --card: #ffffff;

  --radius: 14px;
  --sidebar-w: 264px;
}

body {
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
}

.btn-brand {
  background: var(--brand);
  color: #fff;
  border: none;
}
.btn-brand:hover,
.btn-brand:focus {
  background: var(--brand-dark);
  color: #fff;
}

/* 2. LAMAN AWAM =========================================================== */
.navbar-brand {
  letter-spacing: .3px;
}

.hero-landing {
  background: var(--brand-grad);
  color: #fff;
  padding: 60px 0;
}

.landing-section {
  padding: 48px 0;
}
.landing-section h2 {
  font-weight: 700;
  margin-bottom: 24px;
}

.card-product {
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
  transition: transform .15s ease;
}
.card-product:hover {
  transform: translateY(-4px);
}

.price-tag {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand);
}

footer.site-footer {
  padding: 24px 0;
  color: var(--faint);
  font-size: .9rem;
  text-align: center;
}

/* 3. SHELL DASHBOARD ====================================================== */
body.app-body {
  background: var(--page);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--line);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 1040;
}

.brand-card {
  margin: 14px;
  padding: 16px;
  border-radius: 12px;
  background: var(--brand-grad);
  color: #fff;
}
.brand-card.staff {
  background: var(--staff-grad);
}
.brand-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
}
.brand-sub {
  font-size: 11.5px;
  opacity: .82;
  margin-top: 4px;
}

.side-nav {
  padding: 2px 10px 10px;
  flex: 1;
}

.nav-section {
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
  margin: 16px 10px 6px;
}

.nav-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: #f6f7f9;
  color: var(--ink);
}
.nav-item.active {
  background: var(--brand-soft);
}
.nav-item.active .ni-label {
  color: var(--brand-dark);
}
.nav-item.danger .ni-label {
  color: #dc2626;
}

.ni-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #f3f4f6;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex: none;
}
.nav-item.active .ni-icon {
  background: #fff;
}
.ni-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
}
.ni-desc {
  display: block;
  font-size: 11px;
  color: var(--faint);
  margin-top: 2px;
}

.side-foot {
  padding: 14px 18px 18px;
  font-size: 10.5px;
  color: var(--faint);
  border-top: 1px solid var(--line);
  line-height: 1.6;
}

.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 22px 26px 44px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.crumb {
  font-size: 12px;
  color: var(--faint);
  margin-bottom: 2px;
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
}
.page-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}

.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.sb-toggle {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 17px;
  line-height: 1;
}
.topbar-title {
  font-weight: 700;
}
.sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 1035;
}

/* 4. KOMPONEN DASHBOARD =================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.stat-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex: none;
}
.stat-num {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}
.stat-label {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.i-purple { background: #ede9fe; }
.i-green  { background: #dcfce7; }
.i-pink   { background: #fce7f3; }
.i-blue   { background: #dbeafe; }
.i-orange { background: #ffedd5; }
.i-yellow { background: #fef9c3; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-title {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0;
}
.panel-body {
  padding: 16px;
}

.panel .table {
  margin: 0;
}
.panel .table thead th {
  font-size: 10.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}
.panel .table td {
  font-size: 13.5px;
  vertical-align: middle;
  padding: 12px 16px;
  border-color: #f1f3f6;
}

.empty-state {
  text-align: center;
  color: var(--faint);
  font-size: 13.5px;
  padding: 34px 16px;
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.pill-green  { background: #dcfce7; color: #15803d; }
.pill-grey   { background: #f1f3f6; color: #4b5563; }
.pill-red    { background: #fee2e2; color: #b91c1c; }
.pill-amber  { background: #fef3c7; color: #a16207; }

.thumb {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 8px;
  flex: none;
}

/* 5. HALAMAN AUTH ========================================================= */
body.auth-body {
  background: var(--page);
  display: flex;
  align-items: center;
  min-height: 100vh;
}
.auth-wrap {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 24px 16px;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.auth-brand {
  text-align: center;
  margin-bottom: 20px;
}
.auth-brand .mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--brand-grad);
  display: inline-grid;
  place-items: center;
  font-size: 24px;
  margin-bottom: 10px;
}
.auth-brand .mark.staff {
  background: var(--staff-grad);
}
.auth-brand h1 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
}
.auth-brand p {
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0 0;
}
.auth-foot {
  text-align: center;
  font-size: 13px;
  margin-top: 18px;
  color: var(--muted);
}

/* 6. RESPONSIF ============================================================ */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  body.sidebar-open .sidebar {
    transform: none;
  }
  body.sidebar-open .sb-backdrop {
    display: block;
  }
  .app-main {
    margin-left: 0;
    padding: 16px 16px 40px;
  }
  .topbar {
    display: flex;
  }
  .page-title {
    font-size: 22px;
  }
}
