/* ═══════════════════════════════════════════════════════
   BookVerse — Desktop Web Design System
   ═══════════════════════════════════════════════════════ */

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

:root {
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;

    /* Colors — deep purple/gold theme */
    --bg:           #FAFAFA;
    --bg-white:     #ffffff;
    --bg-surface:   #F5F5F8;
    --bg-card:      #ffffff;
    --border:       #EAE5F0;
    --border-light: #F4EFF7;

    --text:         #1F1A2A;
    --text-secondary: #5C556A;
    --text-muted:   #9893A5;

    --primary:      #5234A2;
    --primary-dark: #3a2278;
    --primary-light:#EFEAFB;
    --accent:       #C49856;
    --accent-light: #FDF9F2;
    --success:      #16a34a;
    --danger:       #dc2626;
    --warning:      #d97706;
    --info:         #0284c7;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 64px;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 999px;

    --shadow-xs: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.10);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.15);
    --shadow-card: 0 2px 12px rgba(79,60,201,0.08);

    --navbar-h: 68px;
    --max-w: 1200px;
    --sidebar-w: 240px;
    --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
    --transition-slow: 0.35s cubic-bezier(0.4,0,0.2,1);

    --gradient-hero: linear-gradient(135deg, #ede9fb 0%, #f5f0f0 60%, #fdf3e3 100%);
    --gradient-light: linear-gradient(135deg, #F8F5FF 0%, #EFEAFB 100%);
    --gradient-donasi: linear-gradient(135deg, #f5f3ff 0%, #e0e7ff 50%, #f8fafc 100%);
    --gradient-warning: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
}

/* ── Dark Mode ── */
[data-theme="dark"] {
    --bg:           #121212;
    --bg-white:     #1e1e1e;
    --bg-surface:   #252525;
    --bg-card:      #1e1e1e;
    --border:       #333333;
    --border-light: #2c2c2c;

    --text:         #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted:   #71717a;

    --primary:      #a78bfa;
    --primary-dark: #8b5cf6;
    --primary-light:#2e1065;
    --accent:       #fbbf24;
    --accent-light: #78350f;

    --gradient-hero: linear-gradient(135deg, #1e1b2e 0%, #201e23 60%, #292419 100%);
    --gradient-light: linear-gradient(135deg, #16141c 0%, #1e192a 100%);
    --gradient-donasi: linear-gradient(135deg, #1b1929 0%, #171b29 50%, #16181b 100%);
    --gradient-warning: linear-gradient(135deg, #2a2512 0%, #28210f 100%);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
button { cursor: pointer; font-family: var(--font-sans); }

/* ── Utility ── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--space-lg); }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.ml-sm { margin-left: var(--space-sm); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.w-full { width: 100%; }
.inline-form { display: inline; }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-md); }

/* ── Placeholder ── */
.placeholder-img {
    background: var(--gradient-hero);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 8px;
    font-size: 2rem;
    color: var(--text-muted);
    width: 100%;
    position: relative;
    overflow: hidden;
}
.placeholder-img::before {
    content: '';
    position: absolute;
    top: -30%; left: -20%;
    width: 80%; height: 80%;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
}
.book-no-cover {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 8px;
    padding: 12px;
    text-align: center;
    width: 100%; height: 100%;
}
.book-no-cover .no-cover-icon { font-size: 1.8rem; opacity: 0.7; }
.book-no-cover .no-cover-title {
    font-size: 0.72rem; font-weight: 600;
    color: var(--primary-dark);
    line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    max-width: 100%;
}
.book-no-cover .no-cover-author {
    font-size: 0.63rem; color: var(--text-secondary); opacity: 0.8;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   NAVBAR — Desktop Top Navigation
   ══════════════════════════════════════════════════════ */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-h);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}
.navbar.scrolled {
    box-shadow: var(--shadow-sm);
}
.navbar-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    gap: var(--space-lg);
}

/* ── Logo ── */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    flex-shrink: 0;
}
.logo-img {
    width: 44px; height: 44px;
    object-fit: contain;
    border-radius: 8px;
}
.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.logo-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}
.logo-name span { color: var(--primary); }
.logo-tagline {
    font-size: 0.65rem;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ── Nav Links ── */
.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex: 1;
    justify-content: center;
}
.nav-link {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    position: relative;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-link.active { color: var(--primary); font-weight: 600; }
.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 50%;
    transform: translateX(-50%);
    width: 20px; height: 2px;
    background: var(--primary);
    border-radius: var(--radius-full);
}

/* ── Nav Actions ── */
.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}
.nav-search-btn {
    width: 36px; height: 36px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    text-decoration: none;
}
.nav-search-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ── User Avatar in Nav ── */
.nav-user {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: 6px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
}
.nav-user:hover { background: var(--primary-light); }
.nav-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}
.nav-user-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.notif-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

/* ── Notification Badge ── */
.notif-btn {
    position: relative;
    width: 36px; height: 36px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-size: 1rem;
}
.notif-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.notif-badge {
    position: absolute;
    top: -3px; right: -3px;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: var(--radius-full);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid white;
}
.notif-badge.show { display: flex; }

/* ── Mobile Hamburger ── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}
.hamburger span {
    display: block; width: 22px; height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ══════════════════════════════════════════════════════
   SEARCH OVERLAY
   ══════════════════════════════════════════════════════ */
.search-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26,16,48,0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}
.search-overlay.open { opacity: 1; pointer-events: auto; }
.search-box {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-md);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--text);
    font-family: var(--font-sans);
    background: none;
}
.search-box input::placeholder { color: var(--text-muted); }

/* ══════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════ */
.page-wrapper {
    padding-top: var(--navbar-h);
    min-height: 100vh;
}
.page-content {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: var(--space-xl) var(--space-xl);
}

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--space-sm);
    padding: 9px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem; font-weight: 600;
    border: none; cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font-sans);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-xl { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }

.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(79,60,201,0.3); }
.btn-primary:hover { background: var(--primary-dark); color: white; box-shadow: 0 4px 16px rgba(79,60,201,0.4); }

.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); color: var(--primary); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-white { background: white; color: var(--primary); border: 1px solid var(--border); }
.btn-white:hover { background: var(--primary-light); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #b07d30; color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; color: white; }

/* ══════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-card); }
.card-body { padding: var(--space-lg); }
.card-img { width: 100%; object-fit: cover; display: block; }

/* ── Book Card ── */
.book-card {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.book-card .book-cover {
    aspect-ratio: 2/3;
    width: 100%;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.book-card .book-info { padding: var(--space-md); }
.book-genre-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.book-title { font-weight: 600; font-size: 0.875rem; line-height: 1.4; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 3px; }
.book-author { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }

/* ── Community Card ── */
.community-card { cursor: pointer; text-decoration: none; color: inherit; }
.community-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.community-banner { width: 100%; height: 110px; object-fit: cover; display: block; }
.community-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.community-desc { font-size: 0.8rem; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.community-meta { display: flex; align-items: center; gap: var(--space-sm); margin-top: var(--space-sm); font-size: 0.78rem; color: var(--text-muted); }

/* ── Preloved Card ── */
.preloved-card { cursor: pointer; text-decoration: none; color: inherit; }
.preloved-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.preloved-card .price { font-weight: 700; color: var(--primary); font-size: 1rem; margin-bottom: 4px; }
.preloved-card .condition-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
}

/* ── Post Card ── */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    transition: var(--transition);
}
.post-card:hover { box-shadow: var(--shadow-sm); }
.post-header { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.post-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 0.9rem; }
.post-meta .username { font-weight: 600; font-size: 0.875rem; color: var(--text); }
.post-meta .time { font-size: 0.75rem; color: var(--text-muted); }
.post-title { font-weight: 700; font-size: 1rem; margin-bottom: var(--space-sm); color: var(--text); }
.post-content { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.post-actions { display: flex; gap: var(--space-lg); margin-top: var(--space-md); padding-top: var(--space-sm); border-top: 1px solid var(--border-light); }
.post-action-btn { font-size: 0.8rem; color: var(--text-muted); transition: var(--transition); cursor: pointer; background: none; border: none; display: flex; align-items: center; gap: 4px; font-family: var(--font-sans); }
.post-action-btn:hover { color: var(--primary); }

.comment { display: flex; gap: var(--space-sm); padding: var(--space-md) 0; border-bottom: 1px solid var(--border-light); }
.comment:last-child { border-bottom: none; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-body .username { font-weight: 600; font-size: 0.8rem; color: var(--text); }
.comment-body .time { font-size: 0.7rem; color: var(--text-muted); margin-left: 6px; }
.comment-body .text { font-size: 0.875rem; color: var(--text-secondary); margin-top: 3px; }

/* ── Scroll Row ── */
.scroll-row { display: flex; gap: var(--space-md); overflow-x: auto; padding-bottom: var(--space-sm); scrollbar-width: none; }
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-card { flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════ */
.form-group { margin-bottom: var(--space-md); }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; display: block; }

.form-input, .form-textarea, .form-select {
    width: 100%;
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 10px 14px;
    transition: var(--transition);
    outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,60,201,0.12);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { appearance: none; cursor: pointer; }

/* ── File Input ── */
.file-input-wrapper { position: relative; }
.file-input-wrapper input[type=file] { opacity: 0; position: absolute; inset: 0; cursor: pointer; z-index: 2; }
.file-input-label {
    display: flex; align-items: center; gap: var(--space-sm);
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 12px var(--space-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.file-input-wrapper:hover .file-input-label { border-color: var(--primary); color: var(--primary); }

/* ══════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════ */
.alert {
    display: flex; align-items: flex-start; gap: var(--space-sm);
    padding: 12px var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: var(--space-md);
    border: 1px solid transparent;
    animation: slideDown 0.3s ease;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #16a34a; }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.close-alert { margin-left: auto; background: none; border: none; color: inherit; cursor: pointer; opacity: 0.6; font-size: 1rem; }

/* ══════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════ */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-success  { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-danger   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-warning  { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge-info     { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-primary  { background: var(--primary-light); color: var(--primary); border: 1px solid #c4b5fd; }
.badge-secondary { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════
   TABS & CHIPS
   ══════════════════════════════════════════════════════ */
.tabs {
    display: flex; gap: var(--space-sm);
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-lg);
}
.tab {
    padding: 10px var(--space-md);
    font-size: 0.875rem; font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.chip-group { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.chip {
    padding: 6px 16px;
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.82rem; font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ══════════════════════════════════════════════════════
   SECTION TITLE
   ══════════════════════════════════════════════════════ */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-md);
    display: flex; align-items: center; gap: var(--space-sm);
}
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-md);
}
.section-header .view-all {
    font-size: 0.8rem; font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.section-header .view-all:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════
   AUTH PAGES
   ══════════════════════════════════════════════════════ */
.auth-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--gradient-hero);
    padding: var(--space-lg);
}
.auth-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-md);
}
.auth-logo { text-align: center; margin-bottom: var(--space-xl); }
.auth-logo img { margin-bottom: var(--space-md); }
.auth-logo h1 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--text); }
.auth-logo h1 span { color: var(--primary); }
.auth-logo p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 4px; }
.auth-footer { text-align: center; margin-top: var(--space-lg); font-size: 0.875rem; color: var(--text-secondary); }
.auth-footer a { color: var(--primary); font-weight: 600; }

/* ══════════════════════════════════════════════════════
   BOOK DETAIL
   ══════════════════════════════════════════════════════ */
.book-detail-layout { display: grid; grid-template-columns: 240px 1fr; gap: var(--space-xl); align-items: start; }
.book-detail-cover {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}
.book-detail-title { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; margin-bottom: var(--space-sm); line-height: 1.3; }
.book-detail-author { font-size: 1rem; color: var(--text-secondary); margin-bottom: var(--space-md); }
.book-detail-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.sinopsis-section { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-lg); }
.sinopsis-text { font-size: 0.9rem; line-height: 1.85; color: var(--text-secondary); }
.sinopsis-text.collapsed { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.sinopsis-toggle { background: none; border: none; color: var(--primary); font-size: 0.85rem; cursor: pointer; margin-top: var(--space-sm); font-weight: 600; }

/* ── Star Rating ── */
.star-rating .star { font-size: 0.95rem; }
.star.filled { color: #f59e0b; }
.star.half   { color: #f59e0b; opacity: 0.5; }
.star.empty  { color: #d1d5db; }
.rating-number { font-size: 0.82rem; color: var(--text-muted); margin-left: 3px; }

.star-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.star-input input { display: none; }
.star-input label { font-size: 1.8rem; color: #d1d5db; cursor: pointer; transition: var(--transition); }
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label { color: #f59e0b; }

/* ══════════════════════════════════════════════════════
   COMMUNITY GATE
   ══════════════════════════════════════════════════════ */
.gate-page { max-width: 640px; margin: 0 auto; text-align: center; }
.gate-lock { font-size: 4rem; margin-bottom: var(--space-md); }
.gate-title { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: var(--space-sm); }
.gate-description { color: var(--text-secondary); margin-bottom: var(--space-xl); font-size: 0.95rem; }
.rules-box { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-lg); text-align: left; margin-bottom: var(--space-xl); }
.rules-box h4 { margin-bottom: var(--space-sm); color: var(--text); }
.rules-box p { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.7; }

/* ══════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: var(--space-2xl) var(--space-lg); color: var(--text-secondary); }
.empty-state .emoji { font-size: 3.5rem; display: block; margin-bottom: var(--space-md); }
.empty-state h3 { font-size: 1.1rem; margin-bottom: var(--space-sm); color: var(--text); }
.empty-state p { font-size: 0.875rem; }

/* ══════════════════════════════════════════════════════
   ADMIN LAYOUT — Sidebar + Main
   ══════════════════════════════════════════════════════ */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: var(--space-md) 0;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 10;
    overflow-y: auto;
    box-shadow: var(--shadow-xs);
}
.admin-logo-wrap {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-md);
    text-decoration: none;
}
.admin-logo-text { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--text); }
.admin-logo-text span { color: var(--primary); }

.admin-nav-section { padding: 0 var(--space-sm); margin-bottom: var(--space-sm); }
.admin-nav-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 6px var(--space-md); margin-bottom: 2px; }
.admin-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem; font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    text-decoration: none;
    margin-bottom: 2px;
}
.admin-nav-item:hover { background: var(--primary-light); color: var(--primary); }
.admin-nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.admin-nav-item .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: var(--space-xl);
    background: var(--bg);
    min-height: 100vh;
}
.admin-header { margin-bottom: var(--space-xl); }
.admin-header h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.admin-header p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 4px; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); margin-bottom: var(--space-xl); }
.stat-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-lg); display: flex; align-items: center; gap: var(--space-md); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-icon.purple { background: var(--primary-light); }
.stat-icon.amber  { background: var(--accent-light); }
.stat-icon.green  { background: #f0fdf4; }
.stat-icon.blue   { background: #eff6ff; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

/* ── Data Table ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 2px solid var(--border); background: var(--bg-surface); }
.data-table td { padding: 14px 16px; font-size: 0.875rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg-surface); }
.data-table tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════════════
   HERO SECTION (Home)
   ══════════════════════════════════════════════════════ */
.hero {
    background: var(--gradient-hero);
    padding: var(--space-2xl) 0;
    margin-bottom: var(--space-xl);
}
.hero-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--space-xl);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    align-items: center;
}
.hero-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: var(--space-md);
}
.hero-title em { color: var(--primary); font-style: normal; }
.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--space-sm);
}
.hero-tagline {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: var(--space-xl);
    display: flex; align-items: center; gap: var(--space-sm);
}
.hero-tagline::before, .hero-tagline::after {
    content: '—';
    color: var(--accent);
    opacity: 0.5;
}
.hero-actions { display: flex; gap: var(--space-md); flex-wrap: wrap; }
.hero-image {
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-image img {
    max-width: 100%;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

/* ── Features Bar ── */
.features-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--space-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}
.feature-item {
    background: var(--bg-white);
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    transition: var(--transition);
}
.feature-item:hover { background: var(--primary-light); }
.feature-icon { font-size: 1.5rem; margin-bottom: var(--space-sm); }
.feature-title { font-weight: 600; font-size: 0.875rem; color: var(--text); margin-bottom: 4px; }
.feature-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

/* ══════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════ */
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.fade-in-up { animation: fadeInUp 0.5s ease forwards; }

.stagger-in > * { opacity: 0; animation: fadeInUp 0.4s ease forwards; }
.stagger-in > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.30s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.40s; }

/* ── Click Star Effect ── */
.click-star-center {
    position: fixed;
    pointer-events: none;
    font-size: 1rem;
    z-index: 9999;
    animation: starPulse 0.15s ease-out forwards;
}
.click-star-particle {
    position: fixed;
    pointer-events: none;
    font-size: 0.8rem;
    z-index: 9999;
    animation: starExplode 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes starPulse {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}
@keyframes starExplode {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    20% { opacity: 1; transform: translate(calc(-50% + var(--tx) * 0.2), calc(-50% + var(--ty) * 0.2)) scale(1); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0); }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .hero-title { font-size: 2.2rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .features-bar { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .book-detail-layout { grid-template-columns: 200px 1fr; gap: var(--space-lg); }
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero-actions { justify-content: center; }
    .hero-image { display: none; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .book-detail-layout { grid-template-columns: 1fr; }
    .admin-sidebar { transform: translateX(-100%); transition: var(--transition-slow); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; padding: var(--space-md); }
    .page-content { padding: var(--space-md); }
    .navbar-inner { padding: 0 var(--space-md); }
}

@media (max-width: 480px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .hero-title { font-size: 1.8rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .features-bar { grid-template-columns: repeat(2, 1fr); }
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.table-responsive table {
    width: 100%;
    min-width: 600px;
    margin: 0;
    border: none;
}
