:root {
    --bg-dark: #0d0d16;
    --bg-card: #171727;
    --bg-card-hover: #212136;
    --bg-header: rgba(15, 15, 26, 0.96);
    --purple-deep: #280a3e;
    --purple-accent: #9d50ff;
    --purple-glow: rgba(157, 80, 255, 0.4);
    --pink-accent: #ff4785;
    --gold-accent: #fbc02d;
    --text-primary: #f8f9fa;
    --text-muted: #cbd5e1; /* Jauh lebih terang dari sebelumnya (9595ad) agar kontras dan sangat jelas terbaca */
    --border-color: #383854;
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography & Contrast Enhancement */
h1, h2, h3, h4, h5, h6 {
    color: #ffffff !important;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Paksa text-muted di tema gelap agar tetap kontras dan mudah dibaca */
.text-muted {
    color: #cbd5e1 !important; /* Abu-abu terang high contrast */
}

.text-light {
    color: #f1f5f9 !important;
}

.text-gold {
    color: var(--gold-accent) !important;
}

.text-purple {
    color: #c084fc !important;
}

.text-pink {
    color: var(--pink-accent) !important;
}

.bg-gradient-purple {
    background: linear-gradient(135deg, #1f0b35 0%, #0d0617 100%);
}

.gradient-text {
    background: linear-gradient(135deg, #ff65a5, #c084fc, #fbc02d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navbar */
.navbar-custom {
    background-color: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-link {
    color: #e2e8f0 !important;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    padding: 0.5rem 0.85rem !important;
    border-radius: 8px;
}

.nav-link:hover, .nav-link.active {
    color: #ffffff !important;
    background-color: rgba(157, 80, 255, 0.2);
}

/* Buttons */
.btn-premium {
    background: linear-gradient(135deg, var(--purple-accent), var(--pink-accent));
    color: #fff;
    border: none;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--purple-glow);
    transition: all 0.3s ease;
}

.btn-premium:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 51, 119, 0.45);
}

.btn-gold {
    background: linear-gradient(135deg, #f5b041, #e67e22);
    color: #1a0f00;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 15px rgba(245, 176, 65, 0.3);
    transition: all 0.3s ease;
}

.btn-gold:hover {
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(245, 176, 65, 0.5);
}

.btn-outline-custom {
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.btn-outline-custom:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: var(--purple-accent);
}

/* Cards & Book Covers */
.card-ebook {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-ebook:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 20px var(--purple-glow);
    border-color: rgba(139, 61, 255, 0.4);
}

.cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 6;
    background-color: #12121a;
    overflow: hidden;
}

/* Stats Overlay on Covers (View, Like, Shared) */
.cover-stats-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(10, 10, 18, 0.95) 0%, rgba(10, 10, 18, 0.7) 65%, transparent 100%);
    padding: 1.4rem 0.5rem 0.45rem 0.5rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 600;
    z-index: 3;
    pointer-events: none;
    letter-spacing: 0.02em;
    backdrop-filter: blur(2px);
}

.cover-stats-overlay .stat-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0.95;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.cover-stats-overlay .stat-item.views i {
    color: #38bdf8; /* Cyan / Blue */
}

.cover-stats-overlay .stat-item.likes i {
    color: #fb7185; /* Pink / Rose */
}

.cover-stats-overlay .stat-item.shares i {
    color: #34d399; /* Emerald / Green */
}

/* Interaction Button Styles in Detail Page */
.stat-interactive-btn {
    transition: all 0.2s ease;
    cursor: pointer;
}

.stat-interactive-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.stat-interactive-btn:active {
    transform: scale(0.96);
}

.stat-interactive-btn.active {
    background: rgba(251, 113, 133, 0.25) !important;
    border-color: rgba(251, 113, 133, 0.6) !important;
}

.cover-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card-ebook:hover .cover-image {
    transform: scale(1.04);
}

.badge-featured {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, var(--gold-accent), #d35400);
    color: #111;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

/* Ticker / Running Text Peringatan 18+ */
.ticker-18plus {
    background: linear-gradient(90deg, #1f0808 0%, #3b0d0d 50%, #1f0808 100%);
    border-bottom: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    font-size: 0.8rem;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    padding: 0.45rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.ticker-inner {
    display: inline-block;
    padding-left: 100%;
    animation: ticker-slide 28s linear infinite;
}

.ticker-inner:hover {
    animation-play-state: paused;
}

@keyframes ticker-slide {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

.badge-genre {
    display: inline-block;
    background: rgba(139, 61, 255, 0.15);
    color: #d1b3ff;
    border: 1px solid rgba(139, 61, 255, 0.3);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.18rem 0.45rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.badge-pill-free {
    display: inline-block;
    background: rgba(40, 167, 69, 0.2);
    color: #4ade80;
    border: 1px solid rgba(40, 167, 69, 0.4);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.18rem 0.45rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.badge-pill-featured {
    display: inline-block;
    background: rgba(245, 176, 65, 0.2);
    color: #fbc02d;
    border: 1px solid rgba(245, 176, 65, 0.4);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.18rem 0.45rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.card-body-ebook {
    padding: 0.85rem 0.95rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-ebook-title-catalog {
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-top: 0.35rem;
    margin-bottom: 0;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    line-height: 1.35;
    transition: color 0.2s ease;
}

.card-ebook-title-catalog:hover {
    color: var(--purple-accent);
}

.card-ebook-desc {
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.45;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hero Section */
.hero-banner {
    position: relative;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(40, 10, 62, 0.95), rgba(15, 8, 28, 0.95)), url('../images/hero-bg-pattern.svg');
    background-size: cover;
    border: 1px solid rgba(139, 61, 255, 0.3);
    padding: 3rem 2.5rem;
    margin-bottom: 3.5rem;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.hero-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--purple-glow) 0%, transparent 70%);
    pointer-events: none;
}

/* Forms & Inputs */
.form-control-custom, .form-select-custom {
    background-color: #1a1a2e;
    border: 1px solid var(--border-color);
    color: #ffffff !important;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.form-control-custom::placeholder {
    color: #94a3b8 !important;
}

.form-control-custom:focus, .form-select-custom:focus {
    background-color: #21213b;
    border-color: var(--purple-accent);
    color: #ffffff !important;
    box-shadow: 0 0 0 0.25rem rgba(157, 80, 255, 0.25);
}

.form-label {
    color: #f1f5f9 !important;
    font-weight: 600;
}

/* Breadcrumb readability */
.breadcrumb-item a {
    color: #cbd5e1 !important;
}
.breadcrumb-item a:hover {
    color: #ffffff !important;
}
.breadcrumb-item.active {
    color: #f8fafc !important;
}

/* Table Text Contrast */
.table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: #f1f5f9;
}
.table-dark th {
    color: #cbd5e1 !important;
    font-weight: 600;
}
.table-dark td {
    color: #f8fafc !important;
}

/* Protection against Copy/Paste and Selection in Reader */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Footer */
footer {
    background-color: #08080d;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Mobile Optimizations */
@media (max-width: 576px) {
    .hero-banner {
        padding: 2rem 1.25rem;
        border-radius: 18px;
    }
    .card-body-ebook {
        padding: 0.65rem 0.75rem;
    }
    .card-ebook-title {
        font-size: 0.95rem;
    }
    .card-ebook-title-catalog {
        font-size: 0.72rem;
        margin-top: 0.25rem;
    }
    .card-ebook-desc {
        display: none; /* Hide desc on extra small screens to keep covers prominent */
    }
    .btn-mobile-full {
        width: 100%;
        display: block;
    }
}

/* Horizontal Genre Scroll Strip (Mobile Optimization) */
.genre-filter-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.genre-scroll-strip {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x !important;
    scroll-behavior: smooth;
    gap: 0.5rem;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 4px 2px 8px 2px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    cursor: grab;
}
.genre-scroll-strip:active {
    cursor: grabbing;
}
.genre-scroll-strip::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}
.genre-scroll-strip .btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-size: 0.82rem !important;
    padding: 0.35rem 0.85rem !important;
    user-select: none;
    -webkit-user-select: none;
}

/* Badge Penanda E-book Sudah Pernah Dibaca (Untuk Member) */
.read-marker-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(13, 13, 22, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2.5px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
    letter-spacing: 0.02em;
}

