/* =============================================
   E-Book SMA — Professional Design System
   ============================================= */

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

/* --- CSS Variables --- */
:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #e0e7ff;
  --secondary: #6366f1;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --bg-base: #f1f5f9;
  --bg-white: #ffffff;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-topbar: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-white: #ffffff;

  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 8px 24px rgba(0,0,0,.05);
  --shadow-lg: 0 4px 6px rgba(0,0,0,.07), 0 20px 60px rgba(0,0,0,.1);
  --shadow-card: 0 2px 8px rgba(79,70,229,.08);

  --sidebar-w: 260px;
  --topbar-h: 70px;
  --transition: all .25s cubic-bezier(.4,0,.2,1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* =============================================
   AUTH PAGES
   ============================================= */
.auth-body { min-height: 100vh; background: #0f172a; overflow: hidden; }

.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.auth-bg::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(99,102,241,.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(6,182,212,.1) 0%, transparent 40%);
  pointer-events: none;
}

.auth-wrapper {
  display: flex;
  width: 100%; max-width: 980px;
  min-height: 600px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 25px 100px rgba(0,0,0,.5);
  position: relative;
  z-index: 1;
}

/* Auth Left Panel */
.auth-left {
  flex: 1;
  background: linear-gradient(160deg, #4f46e5 0%, #7c3aed 60%, #2563eb 100%);
  padding: 60px 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  top: -100px; right: -100px;
}
.auth-left::after {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  bottom: -60px; left: -60px;
}

.auth-left-content { position: relative; z-index: 1; color: white; }

.auth-logo-big {
  width: 80px; height: 80px;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: white;
  margin-bottom: 28px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
}

.auth-brand-title { font-size: 36px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.auth-brand-sub { font-size: 15px; opacity: .8; margin-bottom: 36px; line-height: 1.6; }

.auth-features { display: flex; flex-direction: column; gap: 12px; }
.auth-feature-item {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; opacity: .9;
}
.auth-feature-item i { color: #a5f3fc; font-size: 16px; }

/* Auth Right Panel */
.auth-right {
  width: 460px;
  background: var(--bg-white);
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-card { width: 100%; }
.auth-card-header { margin-bottom: 32px; }

.auth-mobile-logo {
  width: 56px; height: 56px;
  background: var(--primary-light);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--primary);
  margin-bottom: 20px;
}

.auth-title { font-size: 26px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); }

/* Form Inputs */
.form-floating-custom label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-floating-custom label i { margin-right: 6px; color: var(--primary); }

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  transition: var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-input::placeholder { color: var(--text-muted); }

.input-password-wrap { position: relative; }
.input-password-wrap .form-input { padding-right: 48px; }
.btn-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  transition: var(--transition);
}
.btn-eye:hover { color: var(--primary); }

.btn-primary-custom {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79,70,229,.4);
}
.btn-primary-custom:disabled { opacity: .7; transform: none; cursor: not-allowed; }

.auth-divider {
  text-align: center;
  position: relative;
  margin: 24px 0 16px;
}
.auth-divider::before {
  content: ''; position: absolute;
  top: 50%; left: 0; right: 0; height: 1px;
  background: var(--border);
}
.auth-divider span {
  background: white;
  padding: 0 12px;
  position: relative;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-switch { font-size: 14px; color: var(--text-secondary); }
.auth-link { color: var(--primary); font-weight: 600; }
.auth-link:hover { text-decoration: underline; }

.auth-demo-creds {
  margin-top: 20px;
  padding: 12px 16px;
  background: #f8faff;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.auth-demo-creds p { color: var(--primary); font-weight: 600; margin-bottom: 4px; }

/* Password Strength */
.password-strength {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  width: 0%;
  transition: width .4s, background .4s;
  border-radius: 2px;
}

/* =============================================
   APP LAYOUT — DASHBOARD
   ============================================= */
.app-body { background: var(--bg-base); min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white;
  flex-shrink: 0;
}
.admin-logo { background: linear-gradient(135deg, #7c3aed, #4f46e5); }

.sidebar-brand-name {
  font-size: 16px; font-weight: 700;
  color: white;
  white-space: nowrap;
}

.sidebar-nav { flex: 1; padding: 20px 12px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-section-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: rgba(255,255,255,.3);
  padding: 0 10px 8px;
  margin-top: 8px;
}

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.6);
  font-size: 14px; font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
}
.sidebar-link i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.sidebar-link:hover {
  background: rgba(255,255,255,.07);
  color: white;
  transform: translateX(4px);
}
.sidebar-link.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79,70,229,.4);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  margin-bottom: 10px;
}

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.admin-avatar { background: linear-gradient(135deg, #7c3aed, #4f46e5); }

.sidebar-user-name { font-size: 13px; font-weight: 600; color: white; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,.4); }
.admin-role { color: #fbbf24; }

.sidebar-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.5);
  font-size: 13px;
  transition: var(--transition);
}
.sidebar-logout:hover {
  background: rgba(239,68,68,.15);
  color: #fca5a5;
}

/* --- Main Wrapper --- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}

/* --- Topbar --- */
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.topbar-admin { border-bottom-color: rgba(79,70,229,.1); }

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: var(--transition);
  display: none;
}
.sidebar-toggle:hover { background: var(--bg-base); color: var(--primary); }

.topbar-title { flex: 1; }
.page-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
}
.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.admin-avatar-top { background: linear-gradient(135deg, #7c3aed, #4f46e5); }

.topbar-badge-admin {
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  padding: 28px 28px 40px;
  max-width: 1400px;
  width: 100%;
}

/* --- Welcome Banner --- */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 60%, var(--accent) 100%);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(79,70,229,.3);
}
.welcome-banner::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
  top: -100px; right: -60px;
}

.welcome-content { position: relative; z-index: 1; }
.welcome-title { font-size: 26px; font-weight: 800; color: white; margin-bottom: 8px; }
.welcome-text { font-size: 14px; color: rgba(255,255,255,.8); margin-bottom: 20px; }

.btn-welcome {
  display: inline-flex; align-items: center;
  padding: 11px 24px;
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(10px);
  color: white;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  border: 1px solid rgba(255,255,255,.3);
  transition: var(--transition);
}
.btn-welcome:hover {
  background: rgba(255,255,255,.3);
  transform: translateY(-2px);
}

.welcome-illustration {
  font-size: 80px;
  color: rgba(255,255,255,.15);
  position: relative; z-index: 1;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
}

.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.stat-blue::before { background: var(--info); }
.stat-purple::before { background: var(--primary); }
.stat-green::before { background: var(--success); }
.stat-orange::before { background: var(--warning); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-blue .stat-icon { background: #dbeafe; color: var(--info); }
.stat-purple .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-green .stat-icon { background: #d1fae5; color: var(--success); }

.stat-info { flex: 1; }
.stat-number { font-size: 30px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-trend {
  font-size: 11px; color: var(--success); font-weight: 600;
  background: #d1fae5; padding: 3px 8px; border-radius: 20px;
  white-space: nowrap; align-self: flex-start;
}

/* --- Section Header --- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.section-title i { color: var(--primary); }
.section-link { font-size: 13px; color: var(--primary); font-weight: 600; }
.section-link:hover { text-decoration: underline; }

/* --- Ebook Grid --- */
.ebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.ebook-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid var(--border-light);
}
.ebook-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.ebook-cover {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
}
.ebook-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.ebook-card:hover .ebook-cover img { transform: scale(1.05); }

.ebook-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: var(--primary);
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.ebook-overlay {
  position: absolute; inset: 0;
  background: rgba(79,70,229,.7);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: var(--transition);
}
.ebook-card:hover .ebook-overlay { opacity: 1; }

.btn-read {
  background: white;
  color: var(--primary);
  border: none;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  transform: translateY(10px);
  transition: all .3s;
}
.ebook-card:hover .btn-read { transform: translateY(0); }
.btn-read:hover { background: var(--primary); color: white; }

.ebook-info { padding: 14px; }
.ebook-kategori {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.ebook-title {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.ebook-author { font-size: 12px; color: var(--text-secondary); }

/* --- Filter Bar --- */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
  max-width: 480px;
}
.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}
.search-input {
  width: 100%;
  padding: 11px 40px 11px 38px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-white);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.search-clear {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px;
  transition: var(--transition);
}
.search-clear:hover { color: var(--danger); }

.filter-select {
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-white);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.filter-select:focus { border-color: var(--primary); }

.results-info { margin-bottom: 16px; font-size: 13px; color: var(--text-secondary); }
.results-badge {
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-base);
  padding: 4px 12px; border-radius: 20px;
}

/* --- Skeleton Loading --- */
.loading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  grid-column: 1 / -1;
}
.skeleton-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.skeleton-cover {
  aspect-ratio: 3/4;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-body { padding: 14px; }
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-40 { width: 40%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Pagination --- */
.pagination-wrapper {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}
.page-btn {
  min-width: 38px; height: 38px;
  border: 1.5px solid var(--border);
  background: var(--bg-white);
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  padding: 0 8px;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(79,70,229,.3);
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.empty-state i { font-size: 64px; color: var(--border); margin-bottom: 16px; display: block; }
.empty-state h4 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

.empty-state-inline {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.empty-state-inline i { font-size: 40px; display: block; margin-bottom: 12px; }

/* --- Modal Modern --- */
.modal-modern {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 80px rgba(0,0,0,.2);
  overflow: hidden;
}
.modal-header-modern {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
}
.modal-title-modern { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.btn-modal-close {
  width: 36px; height: 36px;
  background: var(--bg-base);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-modal-close:hover { background: #fee2e2; color: var(--danger); }
.btn-modal-action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.btn-download { background: #d1fae5; color: #065f46; }
.btn-download:hover { background: #10b981; color: white; }

.modal-footer-modern {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-white);
}

/* PDF Viewer */
.pdf-iframe {
  width: 100%;
  height: 75vh;
  border: none;
  display: block;
}
.pdf-loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 200px;
  color: var(--text-muted);
  gap: 12px;
}
.pdf-spinner { font-size: 32px; color: var(--primary); }

/* --- Admin Components --- */
.sidebar-admin .sidebar-link.active {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
}

.btn-add-ebook {
  display: inline-flex; align-items: center;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-add-ebook:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79,70,229,.4);
}

/* Admin Card */
.admin-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.admin-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.admin-card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.admin-card-title i { color: var(--primary); }
.btn-card-action {
  font-size: 13px; color: var(--primary); font-weight: 600;
  padding: 6px 14px; border-radius: 8px;
  background: var(--primary-light);
  transition: var(--transition);
}
.btn-card-action:hover { background: var(--primary); color: white; }

/* Admin Table */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table thead th {
  background: var(--bg-base);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafbff; }

.table-cover {
  width: 40px; height: 54px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: var(--shadow-card);
}
.table-cover-placeholder {
  width: 40px; height: 54px;
  background: var(--primary-light);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 16px;
}
.table-title {
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 240px;
}
.badge-kategori {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  white-space: nowrap;
}
.table-actions { display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-action {
  width: 32px; height: 32px;
  border: none; border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: var(--transition);
}
.btn-view  { background: #dbeafe; color: #1d4ed8; }
.btn-edit  { background: #fef3c7; color: #92400e; }
.btn-delete { background: #fee2e2; color: #991b1b; }
.btn-view:hover  { background: #1d4ed8; color: white; }
.btn-edit:hover  { background: #f59e0b; color: white; }
.btn-delete:hover { background: var(--danger); color: white; }

.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap; gap: 10px;
}
.table-info-text { font-size: 13px; color: var(--text-muted); }
.table-loading { color: var(--text-muted); font-size: 14px; }
.table-loading i { color: var(--primary); margin-right: 8px; }

/* Form Modal */
.form-group-modern { margin-bottom: 4px; }
.form-label-modern {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-label-modern i { color: var(--primary); }
.required { color: var(--danger); }
.form-input-modern {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  transition: var(--transition);
  outline: none;
}
.form-input-modern:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.textarea-modern { resize: vertical; min-height: 80px; }

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  background: var(--bg-base);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone-icon { font-size: 24px; color: var(--text-muted); display: block; margin-bottom: 8px; }
.upload-zone-text { font-size: 13px; color: var(--text-secondary); margin: 0; }
.upload-zone-sub { font-size: 11px; color: var(--text-muted); }
.upload-input {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}

.upload-preview {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #d1fae5;
  border-radius: 8px;
  margin-top: 8px;
  font-size: 13px; color: #065f46;
}
.upload-preview i { color: #059669; font-size: 18px; }
.upload-clear {
  background: none; border: none; cursor: pointer;
  color: #065f46; margin-left: auto;
  transition: var(--transition);
}
.upload-clear:hover { color: var(--danger); }

.cover-upload-row { display: flex; gap: 16px; align-items: flex-start; }
.cover-zone { flex: 1; padding: 20px; }
.cover-preview-wrap { position: relative; width: 100px; flex-shrink: 0; }
.cover-preview-img {
  width: 100px; height: 140px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.cover-preview-placeholder {
  width: 100px; height: 140px;
  background: var(--bg-base);
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--text-muted); font-size: 12px;
}
.cover-preview-placeholder i { font-size: 28px; }
.cover-clear {
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px;
  background: var(--danger); color: white;
  border: none; border-radius: 50%;
  cursor: pointer; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}

/* Modal Buttons */
.btn-modal-cancel {
  padding: 10px 20px;
  background: var(--bg-base); border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  transition: var(--transition);
}
.btn-modal-cancel:hover { border-color: var(--text-secondary); }
.btn-modal-save {
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; border: none; border-radius: 8px;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 8px;
}
.btn-modal-save:hover { box-shadow: 0 4px 15px rgba(79,70,229,.4); }
.btn-modal-save:disabled { opacity: .7; cursor: not-allowed; }
.btn-modal-delete {
  padding: 10px 24px;
  background: var(--danger); color: white; border: none; border-radius: 8px;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.btn-modal-delete:hover { background: #b91c1c; }

/* Delete Modal */
.delete-icon-wrap {
  width: 64px; height: 64px;
  background: #fee2e2;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--danger);
  margin: 0 auto;
}
.fw-700 { font-weight: 700; }

/* Category List (Admin Dashboard) */
.category-list { padding: 16px 20px; }
.category-item { margin-bottom: 16px; }
.category-item:last-child { margin-bottom: 0; }
.category-item-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.category-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.category-count { font-size: 13px; font-weight: 700; color: var(--primary); }
.category-bar-wrap { height: 6px; background: var(--bg-base); border-radius: 3px; overflow: hidden; }
.category-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

/* Quick Actions */
.quick-actions { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.quick-action-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  font-size: 14px; font-weight: 600;
  transition: var(--transition);
}
.quick-action-btn:hover { background: var(--primary); color: white; }
.quick-action-btn.secondary { background: var(--bg-base); color: var(--text-secondary); }
.quick-action-btn.secondary:hover { background: var(--text-secondary); color: white; }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  border-left: 4px solid var(--primary);
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1) both;
  transition: all .3s;
}
.toast-item.success { border-color: var(--success); }
.toast-item.danger  { border-color: var(--danger); }
.toast-item.warning { border-color: var(--warning); }
.toast-icon { font-size: 18px; margin-top: 2px; flex-shrink: 0; }
.toast-item.success .toast-icon { color: var(--success); }
.toast-item.danger  .toast-icon { color: var(--danger); }
.toast-item.warning .toast-icon { color: var(--warning); }
.toast-item:not(.success):not(.danger):not(.warning) .toast-icon { color: var(--primary); }
.toast-body { flex: 1; }
.toast-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.toast-text  { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px;
  padding: 0; transition: var(--transition);
}
.toast-close:hover { color: var(--danger); }
.toast-item.hiding { animation: toastOut .3s forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(110%); height: 0; padding: 0; margin: 0; }
}

/* --- Sidebar Overlay & Toggle --- */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* --- Utility --- */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.fw-600 { font-weight: 600; }
.text-primary-color { color: var(--primary) !important; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,.3);
  }
  .sidebar-overlay.show { display: block; }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .main-content { padding: 20px 16px; }
  .welcome-banner { flex-direction: column; gap: 20px; text-align: center; }
  .welcome-illustration { font-size: 50px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .ebook-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 14px; }
  .topbar { padding: 0 16px; }

  /* Auth responsive */
  .auth-wrapper { flex-direction: column; border-radius: 20px; }
  .auth-right { width: 100%; padding: 36px 28px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .ebook-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .filter-bar { flex-direction: column; }
  .search-box { max-width: 100%; min-width: auto; width: 100%; }
  .auth-right { padding: 28px 20px; }
  .auth-title { font-size: 22px; }
}
