*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

:root {
    --bg-dark: #0F172A;
    --bg-dark-rgb: 15, 23, 42;
    --bg-deep: #1E1B4B;
    --bg-deep-rgb: 30, 27, 75;
    --bg-section: #111827;
    --bg-section-rgb: 17, 24, 39;
    --bg-footer: #0A0F1C;
    --primary: #8B5CF6;
    --primary-rgb: 139, 92, 246;
    --secondary: #06B6D4;
    --secondary-rgb: 6, 182, 212;
    --accent: #F59E0B;
    --free: #10B981;
    --text: #F8FAFC;
    --text-rgb: 248, 250, 252;
    --muted: #CBD5E1;
    --border: rgba(255, 255, 255, 0.1);
    --glow-p: rgba(139, 92, 246, .3);
    --glow-c: rgba(6, 182, 212, .3)
}

:root.light-mode {
    --bg-dark: #F8FAFC;
    --bg-dark-rgb: 248, 250, 252;
    --bg-deep: #F1F5F9;
    --bg-deep-rgb: 241, 245, 249;
    --bg-section: #FFFFFF;
    --bg-section-rgb: 255, 255, 255;
    --bg-footer: #F1F5F9;
    --text: #0F172A;
    --text-rgb: 15, 23, 42;
    --muted: #64748B;
    --border: rgba(0, 0, 0, 0.1);
    --glow-p: rgba(139, 92, 246, .1);
    --glow-c: rgba(6, 182, 212, .1)
}

html {
    scroll-behavior: smooth;
    transition: background-color .4s ease, color .4s ease;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    font-size: 16px;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color .4s ease, color .4s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    line-height: 1.2
}

a {
    text-decoration: none;
    color: inherit
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit
}

ul {
    list-style: none
}

input,
textarea,
select {
    font-family: inherit;
    background: none;
    border: none;
    outline: none;
    color: inherit
}

/* Page system */
.page {
    display: none;
    opacity: 0;
    transition: opacity .4s ease
}

.page.active {
    display: block;
    opacity: 1
}

/* ========== NAVBAR ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 0 1.5rem;
    transition: all .35s cubic-bezier(.4, 0, .2, 1)
}

.navbar.scrolled {
    background: rgba(var(--bg-dark-rgb), .75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3), 0 0 0 1px rgba(139, 92, 246, .15)
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px
}

.nav-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: .375rem;
    cursor: pointer
}

.logo-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: logoPulse 2.5s ease-in-out infinite
}

@keyframes logoPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 2px var(--glow-p))
    }

    50% {
        filter: drop-shadow(0 0 8px var(--primary))
    }
}

.nav-links {
    display: flex;
    gap: 1.75rem
}

.nav-link {
    font-weight: 500;
    font-size: .875rem;
    color: var(--muted);
    position: relative;
    padding: .25rem 0;
    transition: color .25s ease;
    cursor: pointer
}

.nav-link:hover {
    color: var(--text)
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width .3s cubic-bezier(.4, 0, .2, 1)
}

.nav-link:hover::after {
    width: 100%
}

.nav-right {
    display: flex;
    align-items: center;
    gap: .75rem
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--muted);
    transition: all .25s ease
}

.icon-btn:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--text)
}

.icon-btn svg {
    width: 20px;
    height: 20px
}

.nav-login {
    font-weight: 600;
    font-size: .875rem;
    color: var(--muted);
    padding: 0 .5rem;
    transition: color .2s ease;
    cursor: pointer
}

.nav-login:hover {
    color: var(--text)
}

.btn-glow {
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    color: #fff;
    padding: .5rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .8125rem;
    transition: all .25s ease;
    box-shadow: 0 2px 10px var(--glow-p)
}

.btn-glow:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--glow-p)
}

.btn-glow:active {
    transform: scale(.97)
}

.hamburger {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text)
}

.hamburger svg {
    width: 24px;
    height: 24px;
    transition: transform .3s ease
}

.hamburger.open svg {
    transform: rotate(90deg)
}

/* Mobile drawer */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all .3s ease
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible
}

.drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: rgba(15, 23, 42, .97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1001;
    padding: 5rem 1.5rem 2rem;
    transition: right .35s cubic-bezier(.4, 0, .2, 1);
    border-left: 1px solid rgba(139, 92, 246, .2)
}

.drawer.open {
    right: 0
}

.drawer-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    color: var(--text)
}

.drawer-close svg {
    width: 20px;
    height: 20px
}

.drawer-links {
    display: flex;
    flex-direction: column;
    gap: .25rem
}

.drawer-links a {
    display: block;
    padding: .875rem 1rem;
    font-weight: 500;
    color: var(--muted);
    border-radius: 12px;
    transition: all .2s ease;
    cursor: pointer
}

.drawer-links a:hover {
    background: rgba(139, 92, 246, .15);
    color: var(--text)
}

/* ========== HERO ========== */
.hero {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0F172A, #1E1B4B, #1a1a4e, #0F172A);
    background-size: 400% 400%;
    animation: heroGrad 15s ease infinite
}

@keyframes heroGrad {
    0% {
        background-position: 0% 50%
    }

    25% {
        background-position: 100% 0%
    }

    50% {
        background-position: 100% 100%
    }

    75% {
        background-position: 0% 100%
    }

    100% {
        background-position: 0% 50%
    }
}

.hero-particles::before,
.hero-particles::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none
}

.hero-particles::before {
    background: radial-gradient(2px 2px at 20% 30%, rgba(139, 92, 246, .4), transparent), radial-gradient(2px 2px at 60% 20%, rgba(6, 182, 212, .3), transparent), radial-gradient(1px 1px at 80% 60%, rgba(245, 158, 11, .2), transparent), radial-gradient(2px 2px at 40% 70%, rgba(139, 92, 246, .3), transparent), radial-gradient(1px 1px at 10% 80%, rgba(6, 182, 212, .2), transparent), radial-gradient(2px 2px at 90% 10%, rgba(139, 92, 246, .3), transparent);
    animation: particleDrift 20s linear infinite
}

.hero-particles::after {
    background: radial-gradient(1px 1px at 25% 45%, rgba(6, 182, 212, .3), transparent), radial-gradient(2px 2px at 75% 25%, rgba(139, 92, 246, .2), transparent), radial-gradient(1px 1px at 55% 85%, rgba(245, 158, 11, .2), transparent), radial-gradient(2px 2px at 35% 5%, rgba(6, 182, 212, .3), transparent);
    animation: particleDrift 25s linear infinite reverse
}

@keyframes particleDrift {
    0% {
        transform: translateY(0) translateX(0)
    }

    50% {
        transform: translateY(-30px) translateX(15px)
    }

    100% {
        transform: translateY(0) translateX(0)
    }
}

.hero-content {
    text-align: center;
    z-index: 2;
    padding: 0 1.5rem;
    max-width: 800px
}

.hero-title {
    font-size: clamp(3rem, 7vw, 5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: .75rem;
    letter-spacing: -.02em
}

.hero-subtitle {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
    color: var(--muted);
    margin-bottom: 2.5rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    opacity: 0;
    animation: fadeUp .8s ease .3s forwards
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.search-wrap {
    position: relative;
    max-width: 520px;
    margin: 0 auto 2rem;
    opacity: 0;
    animation: fadeUp .8s ease .5s forwards
}

.search-input {
    width: 100%;
    padding: 1rem 1.25rem 1rem 3rem;
    background: rgba(17, 24, 39, .7);
    border-radius: 14px;
    color: var(--text);
    font-size: .9375rem;
    backdrop-filter: blur(8px);
    position: relative;
    z-index: 2
}

.search-input::placeholder {
    color: #64748B
}

.search-border {
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    background: conic-gradient(var(--primary), var(--secondary), var(--accent), var(--primary));
    animation: rotateBorder 4s linear infinite;
    z-index: 1;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    padding: 2px
}

@keyframes rotateBorder {
    to {
        transform: rotate(360deg)
    }
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748B;
    width: 18px;
    height: 18px;
    z-index: 3
}

.stats-pill {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(255, 255, 255, .06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 999px;
    padding: .625rem 1.5rem;
    font-size: .875rem;
    color: var(--muted);
    opacity: 0;
    animation: fadeUp .8s ease .7s forwards
}

.stats-pill strong {
    color: var(--text);
    font-weight: 700
}

.stat-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, .1)
}

.floating-book {
    position: absolute;
    z-index: 1;
    opacity: .12;
    animation: floatBook var(--dur, 6s) ease-in-out infinite;
    animation-delay: var(--del, 0s)
}

.floating-book:nth-child(1) {
    top: 12%;
    left: 5%;
    --dur: 7s;
    --del: 0s;
    transform: rotate(-12deg)
}

.floating-book:nth-child(2) {
    top: 20%;
    right: 6%;
    --dur: 9s;
    --del: 1s;
    transform: rotate(8deg)
}

.floating-book:nth-child(3) {
    bottom: 18%;
    left: 10%;
    --dur: 8s;
    --del: 2s;
    transform: rotate(5deg)
}

.floating-book:nth-child(4) {
    bottom: 25%;
    right: 4%;
    --dur: 10s;
    --del: .5s;
    transform: rotate(-8deg)
}

@keyframes floatBook {

    0%,
    100% {
        transform: translateY(0) rotate(var(--r, 0deg))
    }

    50% {
        transform: translateY(-20px) rotate(var(--r, 0deg))
    }
}

.scroll-chevron {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: bounceChev 2s ease-in-out infinite;
    cursor: pointer;
    z-index: 5
}

.scroll-chevron svg {
    width: 28px;
    height: 28px;
    color: var(--primary)
}

@keyframes bounceChev {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1
    }

    50% {
        transform: translateX(-50%) translateY(10px);
        opacity: .5
    }
}

/* Sections */
.section {
    max-width: 1280px;
    margin: 0 auto;
    padding: 5rem 1.5rem
}

.reading-page,
.detail-page {
    padding-bottom: 2rem;
}

.section-alt {
    background: var(--bg-section)
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem
}

.section-title {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 700;
    letter-spacing: -.02em
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.cyan-text {
    color: var(--secondary)
}

.section-link {
    font-weight: 600;
    font-size: .875rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: .25rem;
    transition: gap .2s ease;
    cursor: pointer
}

.section-link:hover {
    gap: .5rem
}

.title-underline {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
    margin-top: .5rem
}

/* Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all .6s cubic-bezier(.4, 0, .2, 1)
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0)
}

/* ========== FEATURED BOOKS CAROUSEL ========== */
.carousel-wrapper {
    position: relative
}

.carousel {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 1rem .5rem 1.5rem
}

.carousel::-webkit-scrollbar {
    display: none
}

.book-card {
    flex: 0 0 240px;
    scroll-snap-align: center;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 16px;
    border-bottom: 3px solid var(--primary);
    overflow: hidden;
    transition: all .3s cubic-bezier(.4, 0, .2, 1)
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .3), 0 0 0 1px var(--glow-p);
    border-bottom-color: var(--primary)
}

.book-cover {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden
}

.book-cover-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem
}

.book-cover-inner h4 {
    color: #fff;
    font-size: .875rem;
    font-weight: 600
}

.book-cover-inner p {
    color: rgba(255, 255, 255, .7);
    font-size: .75rem
}

.epub-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(4px);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: .625rem;
    font-weight: 700;
    color: rgba(255, 255, 255, .8);
    letter-spacing: .05em
}

.lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px)
}

.lock-overlay svg {
    width: 28px;
    height: 28px;
    color: #fff
}

.book-info {
    padding: 1rem
}

.book-info-title {
    font-size: .9375rem;
    font-weight: 700;
    margin-bottom: .125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.book-info-author {
    font-size: .8125rem;
    color: var(--muted);
    margin-bottom: .5rem
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2rem .625rem;
    border-radius: 999px;
    font-size: .6875rem;
    font-weight: 700
}

.badge-free {
    background: rgba(16, 185, 129, .15);
    color: var(--free)
}

.badge-premium {
    background: rgba(245, 158, 11, .15);
    color: var(--accent);
    animation: badgePulse 2s ease-in-out infinite
}

@keyframes badgePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0)
    }

    50% {
        box-shadow: 0 0 8px 2px rgba(245, 158, 11, .2)
    }
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(139, 92, 246, .15);
    border: 1px solid rgba(139, 92, 246, .2);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all .25s ease
}

.carousel-btn:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 16px var(--glow-p)
}

.carousel-btn.prev {
    left: -8px
}

.carousel-btn.next {
    right: -8px
}

.carousel-btn svg {
    width: 20px;
    height: 20px
}

/* Summaries */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem
}

.summary-card {
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 16px;
    border-top: 3px solid var(--primary);
    padding: 1.25rem;
    transition: all .3s ease
}

.summary-card:nth-child(2n) {
    border-top-color: var(--secondary)
}

.summary-card:nth-child(3n) {
    border-top-color: var(--accent)
}

.summary-card:hover {
    box-shadow: 0 4px 20px var(--glow-p);
    border-color: rgba(139, 92, 246, .3)
}

.summary-card:nth-child(2n):hover {
    box-shadow: 0 4px 20px var(--glow-c);
    border-color: rgba(6, 182, 212, .3)
}

.summary-thumb {
    width: 70px;
    height: 100px;
    min-width: 70px;
    border-radius: 10px;
    overflow: hidden
}

.summary-thumb-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem
}

.summary-body {
    flex: 1;
    min-width: 0
}

.summary-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .25rem;
    flex-wrap: wrap
}

.pill {
    padding: .1875rem .625rem;
    border-radius: 999px;
    font-size: .6875rem;
    font-weight: 600
}

.pill-time {
    background: rgba(139, 92, 246, .15);
    color: var(--primary)
}

.pill-cat {
    background: rgba(6, 182, 212, .15);
    color: var(--secondary)
}

.summary-title {
    font-size: .9375rem;
    font-weight: 700;
    margin-bottom: .125rem
}

.summary-author {
    font-size: .8125rem;
    color: var(--muted);
    margin-bottom: .5rem
}

.summary-excerpt {
    font-size: .8125rem;
    color: var(--muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: .625rem
}

.summary-link {
    font-weight: 600;
    font-size: .875rem;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    transition: gap .25s ease;
    cursor: pointer
}

.summary-link:hover {
    gap: .5rem
}

/* Reading Preview */
.reading-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center
}

.device-mockup {
    width: 260px;
    height: 440px;
    background: rgba(17, 24, 39, .9);
    border-radius: 28px;
    border: 3px solid rgba(139, 92, 246, .3);
    padding: 1.25rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .4), 0 0 30px var(--glow-p);
    margin: 0 auto;
    opacity: 0;
    transform: translateX(40px);
    transition: all .7s cubic-bezier(.4, 0, .2, 1)
}

.device-mockup.revealed {
    opacity: 1;
    transform: translateX(0)
}

.device-notch {
    width: 70px;
    height: 5px;
    background: rgba(139, 92, 246, .4);
    border-radius: 3px;
    margin: 0 auto 1rem
}

.device-content {
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.8
}

.device-content h4 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: .5rem
}

.device-content p {
    margin-bottom: .75rem
}

.preview-features {
    opacity: 0;
    transform: translateX(-40px);
    transition: all .7s cubic-bezier(.4, 0, .2, 1)
}

.preview-features.revealed {
    opacity: 1;
    transform: translateX(0)
}

.preview-features h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 1.5rem
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem
}

.feature-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(139, 92, 246, .12);
    border: 1px solid rgba(139, 92, 246, .2)
}

.feature-icon.cyan {
    background: rgba(6, 182, 212, .12);
    border-color: rgba(6, 182, 212, .2)
}

.feature-icon.amber {
    background: rgba(245, 158, 11, .12);
    border-color: rgba(245, 158, 11, .2)
}

.feature-text h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .125rem
}

.feature-text p {
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.6
}

/* Premium CTA */
.premium-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1040, #0c2340, #1a1040);
    background-size: 200% 200%;
    animation: premiumBg 10s ease infinite
}

@keyframes premiumBg {
    0% {
        background-position: 0% 50%
    }

    50% {
        background-position: 100% 50%
    }

    100% {
        background-position: 0% 50%
    }
}

.premium-bg-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden
}

.premium-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .12
}

.premium-shape:nth-child(1) {
    width: 300px;
    height: 300px;
    background: var(--primary);
    top: -50px;
    left: -100px;
    animation: shapeFloat 12s ease-in-out infinite
}

.premium-shape:nth-child(2) {
    width: 250px;
    height: 250px;
    background: var(--secondary);
    bottom: -80px;
    right: -60px;
    animation: shapeFloat 15s ease-in-out infinite reverse
}

@keyframes shapeFloat {

    0%,
    100% {
        transform: translate(0, 0)
    }

    33% {
        transform: translate(30px, -20px)
    }

    66% {
        transform: translate(-20px, 30px)
    }
}

.premium-card {
    max-width: 640px;
    margin: 0 auto;
    background: rgba(15, 23, 42, .6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, .2);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    text-align: center;
    position: relative;
    z-index: 2;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3)
}

.premium-card h2 {
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
    margin-bottom: 1.5rem;
    letter-spacing: -.02em
}

.premium-bullets {
    text-align: left;
    margin-bottom: 2rem
}

.premium-bullet {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
    font-size: .9375rem
}

.check-svg {
    width: 24px;
    height: 24px;
    min-width: 24px
}

.check-svg path {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: drawCheck .6s ease forwards
}

.premium-bullet:nth-child(1) .check-svg path {
    animation-delay: .2s
}

.premium-bullet:nth-child(2) .check-svg path {
    animation-delay: .4s
}

.premium-bullet:nth-child(3) .check-svg path {
    animation-delay: .6s
}

@keyframes drawCheck {
    to {
        stroke-dashoffset: 0
    }
}

.btn-amber {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: linear-gradient(135deg, var(--accent), #D97706);
    color: #0F172A;
    padding: 1rem 2.5rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 4px 20px rgba(245, 158, 11, .3);
    position: relative;
    overflow: hidden;
    min-height: 48px
}

.btn-amber:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 30px rgba(245, 158, 11, .4)
}

.btn-amber:active {
    transform: scale(.97)
}

.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .35);
    transform: scale(0);
    animation: ripple .6s linear;
    pointer-events: none
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0
    }
}

/* Categories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem
}

.category-card {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    cursor: pointer
}

.category-card:hover {
    transform: rotate(2deg) scale(1.04);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .3)
}

.category-card:nth-child(1) {
    background: rgba(139, 92, 246, .08)
}

.category-card:nth-child(2) {
    background: rgba(6, 182, 212, .08)
}

.category-card:nth-child(3) {
    background: rgba(245, 158, 11, .08)
}

.category-card:nth-child(4) {
    background: rgba(239, 68, 68, .08)
}

.category-card:nth-child(5) {
    background: rgba(16, 185, 129, .08)
}

.category-card:nth-child(6) {
    background: rgba(168, 85, 247, .08)
}

.category-card:nth-child(7) {
    background: rgba(59, 130, 246, .08)
}

.category-card:nth-child(8) {
    background: rgba(236, 72, 153, .08)
}

.category-card:nth-child(9) {
    background: rgba(234, 179, 8, .08)
}

.category-card:nth-child(10) {
    background: rgba(20, 184, 166, .08)
}

.category-icon {
    font-size: 2.25rem;
    margin-bottom: .5rem;
    display: block
}

.category-name {
    font-size: .9375rem;
    font-weight: 700;
    margin-bottom: .125rem
}

.category-count {
    font-size: .8125rem;
    color: var(--muted)
}

/* Footer */
.footer {
    background: var(--bg-footer);
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--primary), var(--secondary)) 1;
    padding: 3rem 1.5rem 1.5rem
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr .8fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem
}

.footer-brand h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .375rem
}

.footer-brand h3 span {
    color: var(--primary)
}

.footer-brand p {
    font-size: .875rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.7;
    margin-top: 0.25rem;
}

.footer-links h4,
.footer-social h4 {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin-bottom: .75rem
}

.footer-links ul {
    display: flex;
    flex-direction: column;
    gap: .25rem
}

.footer-links a {
    font-size: .875rem;
    color: var(--muted);
    transition: color .2s ease;
    display: block;
    padding: .25rem 0;
    cursor: pointer
}

.footer-links a:hover {
    color: var(--primary)
}

.social-row {
    display: flex;
    gap: .5rem
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    transition: all .25s ease;
    flex-shrink: 0;
}

.social-btn:hover {
    background: var(--primary);
    box-shadow: 0 4px 15px var(--glow-p);
    transform: translateY(-2px)
}

.footer-bottom {
    max-width: 1280px;
    margin: 0 auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, .06);
    text-align: center
}

.footer-bottom p {
    font-size: .8125rem;
    color: var(--muted)
}

/* ========== BOOK DETAIL ========== */
.detail-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 5rem 1.5rem 4rem
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    color: var(--muted);
    font-weight: 500;
    font-size: .875rem;
    margin-bottom: 2rem;
    transition: color .2s ease;
    cursor: pointer
}

.back-link:hover {
    color: var(--text)
}

.detail-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
    align-items: start
}

.detail-cover-wrap {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5), 0 0 30px var(--glow-p)
}

.detail-cover {
    width: 100%;
    aspect-ratio: 2/3;
    position: relative
}

.detail-cover-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.25rem
}

.detail-cover-inner h3 {
    color: #fff;
    font-size: 1.125rem;
    font-weight: 700
}

.detail-cover-inner p {
    color: rgba(255, 255, 255, .7);
    font-size: .8125rem
}

.detail-title {
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: .5rem
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: .625rem;
    flex-wrap: wrap;
    margin-bottom: .75rem
}

.detail-author {
    color: var(--muted);
    font-size: .9375rem;
    margin-bottom: 1rem
}

.detail-desc {
    color: var(--muted);
    line-height: 1.8;
    margin-bottom: 1.5rem
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    margin-bottom: 1.5rem
}

.detail-stat {
    padding: .75rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06)
}

.detail-stat-label {
    font-size: .75rem;
    color: var(--muted);
    margin-bottom: .125rem
}

.detail-stat-value {
    font-size: .875rem;
    font-weight: 600
}

.detail-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: .75rem
}

.btn-filled {
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    color: #fff;
    padding: .75rem 1.75rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .9375rem;
    transition: all .25s ease;
    box-shadow: 0 4px 14px var(--glow-p);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem
}

.btn-filled:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px var(--glow-p)
}

.btn-filled:active {
    transform: scale(.97)
}

.btn-gradient-border {
    position: relative;
    padding: .75rem 1.75rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .9375rem;
    color: var(--text);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    overflow: hidden
}

.btn-gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 999px;
    background: conic-gradient(var(--primary), var(--secondary), var(--accent), var(--primary));
    animation: rotateBorder 4s linear infinite;
    z-index: -1
}

.btn-gradient-border::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 999px;
    background: var(--bg-dark);
    z-index: -1
}

.btn-gradient-border:hover {
    transform: translateY(-2px) scale(1.03)
}

.btn-gradient-border:active {
    transform: scale(.97)
}

.premium-lock-msg {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: rgba(245, 158, 11, .1);
    border: 1px solid rgba(245, 158, 11, .2);
    color: var(--accent);
    font-size: .875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem
}

.premium-lock-msg a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline
}

.related-section {
    margin-top: 3rem
}

.related-section h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1.25rem
}

.related-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem
}

.related-card .book-cover {
    aspect-ratio: 2/3
}

/* ========== SUMMARY READING ========== */
.reading-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 5rem 1.5rem 4rem
}

.reading-header {
    text-align: center;
    margin-bottom: 2rem
}

.reading-header h1 {
    font-size: clamp(1.375rem, 3.5vw, 1.875rem);
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: .5rem
}

.reading-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    flex-wrap: wrap
}

.reading-cover {
    width: 120px;
    height: 170px;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 auto 2rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4)
}

.reading-body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px;
    line-height: 1.9;
    color: #E2E8F0;
    margin-bottom: 2.5rem
}

.reading-body p {
    margin-bottom: 1.25rem
}

.reading-full-book {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
    cursor: pointer;
    transition: all .25s ease
}

.reading-full-book:hover {
    border-color: rgba(139, 92, 246, .3);
    box-shadow: 0 4px 20px var(--glow-p)
}

.reading-full-book-thumb {
    width: 60px;
    height: 85px;
    min-width: 60px;
    border-radius: 8px;
    overflow: hidden
}

.reading-full-book-info h4 {
    font-size: .9375rem;
    font-weight: 700;
    margin-bottom: .25rem
}

.reading-full-book-info p {
    font-size: .8125rem;
    color: var(--muted)
}

.others-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem
}

/* ========== AUTH PAGES ========== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #0F172A, #1E1B4B, #1a1a4e, #0F172A);
    background-size: 400% 400%;
    animation: heroGrad 15s ease infinite
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, .06);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 20px;
    padding: 2.5rem 2rem
}

.auth-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.375rem;
    text-align: center;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .375rem
}

.auth-logo span {
    color: var(--primary);
    animation: logoPulse 2.5s ease-in-out infinite
}

.auth-heading {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: .25rem
}

.auth-sub {
    text-align: center;
    color: var(--muted);
    font-size: .875rem;
    margin-bottom: 1.75rem
}

.form-group {
    margin-bottom: 1.25rem
}

.form-label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .375rem
}

.form-input {
    width: 100%;
    padding: .75rem 1rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    color: var(--text);
    font-size: .9375rem;
    transition: all .25s ease
}

.form-input::placeholder {
    color: #64748B
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--glow-p)
}

.btn-full {
    width: 100%;
    justify-content: center
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: .875rem;
    color: var(--muted)
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer
}

.auth-footer a:hover {
    text-decoration: underline
}

/* ========== USER DASHBOARD ========== */
.dash-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 5rem 1.5rem 4rem
}

.dash-profile {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem
}

.dash-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 0 0 3px var(--glow-p)
}

.dash-avatar.free {
    background: linear-gradient(135deg, var(--free), #059669);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .3)
}

.dash-name {
    font-size: 1.25rem;
    font-weight: 700
}

.dash-email {
    font-size: .875rem;
    color: var(--muted)
}

.upgrade-banner {
    background: linear-gradient(135deg, rgba(139, 92, 246, .15), rgba(6, 182, 212, .1));
    border: 1px solid rgba(139, 92, 246, .2);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem
}

.upgrade-banner p {
    font-weight: 600;
    color: var(--text);
    font-size: .9375rem
}

.dash-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    padding-bottom: .5rem
}

.dash-tab {
    padding: .5rem 1rem;
    font-weight: 600;
    font-size: .875rem;
    color: var(--muted);
    border-radius: 8px;
    transition: all .2s ease;
    cursor: pointer;
    position: relative
}

.dash-tab.active {
    color: var(--primary)
}

.dash-tab.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 1px
}

.dash-tab:not(.active):hover {
    color: var(--text)
}

.dash-tab-content {
    display: none
}

.dash-tab-content.active {
    display: block
}

.dash-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem
}

.dash-summary-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 12px;
    margin-bottom: .75rem;
    transition: all .25s ease
}

.dash-summary-item:hover {
    border-color: rgba(139, 92, 246, .3)
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, .06);
    border-radius: 2px;
    overflow: hidden;
    margin-top: .5rem
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px
}

/* ========== ADMIN DASHBOARD ========== */
.admin-layout {
    display: flex;
    min-height: 100vh
}

.admin-sidebar {
    width: 240px;
    background: rgba(15, 23, 42, .95);
    border-right: 1px solid rgba(255, 255, 255, .06);
    padding: 1.25rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width .3s ease
}

.admin-sidebar.collapsed {
    width: 64px
}

.admin-sidebar.collapsed .sidebar-text {
    display: none
}

.admin-sidebar.collapsed .sidebar-logo-text {
    display: none
}

.admin-sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: .75rem
}

.admin-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    padding: .5rem .75rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .375rem
}

.admin-logo span {
    color: var(--primary)
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .25rem
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem .75rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: .875rem;
    color: var(--muted);
    transition: all .2s ease;
    cursor: pointer;
    min-height: 44px;
    position: relative
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, .06);
    color: var(--text)
}

.sidebar-item.active {
    color: var(--primary);
    background: rgba(139, 92, 246, .1)
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px var(--glow-p)
}

.sidebar-item svg {
    width: 20px;
    height: 20px;
    min-width: 20px
}

.sidebar-toggle {
    margin-top: auto;
    padding: .625rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    transition: all .2s ease;
    min-height: 44px;
    font-size: .8125rem
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, .1)
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px
}

.admin-main {
    flex: 1;
    margin-left: 240px;
    transition: margin-left .3s ease
}

.admin-sidebar.collapsed~.admin-main {
    margin-left: 64px
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, .85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, .06)
}

.admin-topbar h2 {
    font-size: 1.125rem;
    font-weight: 700
}

.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: .75rem
}

.admin-search {
    padding: .5rem 1rem .5rem 2.25rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    font-size: .8125rem;
    width: 200px;
    transition: all .25s ease
}

.admin-search::placeholder {
    color: #64748B
}

.admin-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--glow-p)
}

.admin-search-wrap {
    position: relative
}

.admin-search-wrap svg {
    position: absolute;
    left: .625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #64748B
}

.admin-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #fff
}

.admin-content {
    padding: 1.5rem
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem
}

.admin-stat-card {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all .25s ease
}

.admin-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .2)
}

.admin-stat-card.purple {
    border-color: rgba(139, 92, 246, .2);
    box-shadow: 0 0 12px rgba(139, 92, 246, .1)
}

.admin-stat-card.cyan {
    border-color: rgba(6, 182, 212, .2);
    box-shadow: 0 0 12px rgba(6, 182, 212, .1)
}

.admin-stat-card.green {
    border-color: rgba(16, 185, 129, .2);
    box-shadow: 0 0 12px rgba(16, 185, 129, .1)
}

.admin-stat-card.amber {
    border-color: rgba(245, 158, 11, .2);
    box-shadow: 0 0 12px rgba(245, 158, 11, .1)
}

.admin-stat-icon {
    font-size: 1.5rem;
    margin-bottom: .5rem
}

.admin-stat-value {
    font-size: 1.75rem;
    font-weight: 700
}

.admin-stat-label {
    font-size: .8125rem;
    color: var(--muted);
    margin-top: .125rem
}

.admin-stat-change {
    font-size: .75rem;
    font-weight: 600;
    margin-top: .25rem
}

.admin-stat-change.up {
    color: var(--free)
}

.admin-grid-2 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem
}

.admin-card {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 16px;
    padding: 1.25rem
}

.admin-card h3 {
    font-size: .9375rem;
    font-weight: 700;
    margin-bottom: 1rem
}

.chart-placeholder {
    width: 100%;
    height: 180px;
    background: rgba(255, 255, 255, .03);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: .8125rem;
    border: 1px dashed rgba(255, 255, 255, .1)
}

.ranked-list {
    display: flex;
    flex-direction: column;
    gap: .5rem
}

.ranked-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .625rem .75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
    font-size: .8125rem
}

.ranked-item:last-child {
    font-weight: 600
}

.ranked-item span:last-child {
    font-size: .75rem;
    color: var(--muted)
}

.admin-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap
}

.filter-input {
    padding: .5rem .75rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    font-size: .8125rem;
    flex: 1;
    min-width: 150px;
    color: var(--text)
}

.filter-input::placeholder {
    color: #64748B
}

.filter-input:focus {
    border-color: var(--primary)
}

.filter-select {
    padding: .5rem .75rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    font-size: .8125rem;
    color: var(--text);
    appearance: none
}

.admin-table-wrap {
    overflow-x: auto
}

.admin-table {
    width: 100%;
    border-collapse: collapse
}

.admin-table th {
    text-align: left;
    padding: .625rem .75rem;
    font-size: .75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    white-space: nowrap
}

.admin-table td {
    padding: .625rem .75rem;
    font-size: .8125rem;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
    vertical-align: middle
}

.admin-table tbody tr:hover td {
    background: rgba(139, 92, 246, .04)
}

.cover-thumb {
    width: 32px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden
}

.cover-thumb-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .625rem
}

.table-actions {
    display: flex;
    gap: .25rem
}

.table-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--muted);
    transition: all .2s ease
}

.table-action-btn:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--text)
}

.table-action-btn.danger:hover {
    background: rgba(239, 68, 68, .15);
    color: #EF4444
}

.table-action-btn svg {
    width: 16px;
    height: 16px
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    display: inline-block
}

.toggle-switch input {
    display: none
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .1);
    border-radius: 999px;
    cursor: pointer;
    transition: all .3s ease
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    left: 3px;
    top: 3px;
    transition: all .3s ease
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary)
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(22px)
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all .3s ease;
    padding: 1.5rem
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible
}

.modal-card {
    background: rgba(21, 29, 47, .95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    transform: translateY(20px);
    transition: transform .3s ease
}

.modal-overlay.open .modal-card {
    transform: translateY(0)
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: var(--muted);
    transition: all .2s ease
}

.modal-close:hover {
    background: rgba(255, 255, 255, .1);
    color: var(--text)
}

.modal-close svg {
    width: 18px;
    height: 18px
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem
}

.form-textarea {
    width: 100%;
    padding: .75rem 1rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    color: var(--text);
    font-size: .9375rem;
    min-height: 120px;
    resize: vertical
}

.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--glow-p)
}

.modal-actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    margin-top: 1.5rem
}

.file-upload {
    width: 100%;
    padding: 1.25rem;
    background: rgba(255, 255, 255, .03);
    border: 2px dashed rgba(255, 255, 255, .08);
    border-radius: 10px;
    text-align: center;
    color: var(--muted);
    font-size: .8125rem;
    cursor: pointer;
    transition: all .2s ease
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, .05)
}

.admin-page {
    display: none
}

.admin-page.active {
    display: block
}

/* ========== RESPONSIVE ========== */
@media(max-width:1024px) {
    .nav-links {
        display: none
    }

    .hamburger {
        display: flex
    }

    .hero-content {
        padding-top: 2rem
    }

    .floating-book {
        display: none
    }

    .reading-preview {
        grid-template-columns: 1fr;
        text-align: center
    }

    .device-mockup {
        order: -1
    }

    .preview-features {
        text-align: left
    }

    .feature-item {
        text-align: left
    }

    .summary-grid {
        grid-template-columns: 1fr
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr)
    }

    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center
    }

    .social-row {
        justify-content: center
    }

    .detail-grid {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center
    }

    .detail-cover-wrap {
        width: 100%;
        max-width: 260px
    }

    .detail-meta {
        justify-content: center
    }

    .detail-actions {
        justify-content: center
    }

    .related-row {
        grid-template-columns: repeat(2, 1fr)
    }

    .admin-stats {
        grid-template-columns: repeat(2, 1fr)
    }

    .admin-grid-2 {
        grid-template-columns: 1fr
    }
}

@media(max-width:768px) {
    .hero {
        min-height: 70vh
    }

    .section {
        padding: 3.5rem 1.25rem
    }

    .carousel-btn {
        display: none
    }

    .book-card {
        flex: 0 0 200px
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    /* Admin sidebar: slide-in drawer on mobile (full rules in the mobile block below) */
    .admin-sidebar {
        width: 260px;
    }

    .admin-sidebar .sidebar-text,
    .admin-sidebar .sidebar-logo-text {
        display: inline;
    }

    .admin-sidebar .sidebar-item {
        justify-content: flex-start;
        padding: .625rem .75rem;
    }

    .admin-main {
        margin-left: 0;
    }

    .form-row {
        grid-template-columns: 1fr
    }

    .upgrade-banner {
        flex-direction: column;
        text-align: center
    }

    .summary-card {
        flex-direction: column;
        text-align: center
    }

    .summary-thumb {
        width: 100%;
        height: 120px
    }

    .stats-pill {
        flex-direction: column;
        gap: .5rem;
        padding: .75rem 1rem
    }

    .stat-divider {
        width: 100%;
        height: 1px
    }
}

@media(max-width:640px) {
    .hero-title {
        font-size: 2.5rem
    }

    .related-row {
        grid-template-columns: 1fr 1fr
    }

    .admin-stats {
        grid-template-columns: 1fr
    }

    .dash-profile {
        flex-direction: column;
        text-align: center
    }

    .reading-body {
        font-size: 16px
    }

    .premium-card {
        padding: 2rem 1.5rem
    }
}

@media(max-width:480px) {
    /* Sidebar is hidden off-screen (slide-in), NOT display:none — handled by mobile block */
    .admin-main {
        margin-left: 0
    }

    .admin-search {
        width: 120px
    }

    .admin-toolbar {
        flex-direction: column;
        align-items: stretch
    }
}

/* =========================================
   ADMIN CRUD COMPONENTS & FORMS (Responsive)
   ========================================= */

/* ---- Grid System for Forms (Flex-based) ---- */
.admin-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

.admin-col-8 {
    flex: 0 0 calc(66.666% - 0.75rem);
    max-width: calc(66.666% - 0.75rem);
}

.admin-col-6 {
    flex: 0 0 calc(50% - 0.75rem);
    max-width: calc(50% - 0.75rem);
}

.admin-col-4 {
    flex: 0 0 calc(33.333% - 0.75rem);
    max-width: calc(33.333% - 0.75rem);
}

@media (max-width: 900px) {

    .admin-col-8,
    .admin-col-6,
    .admin-col-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ---- Stat Cards (Flex children for the admin-grid) ---- */
.admin-stat-card {
    flex: 1 1 200px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    min-height: 110px;
}

.admin-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.admin-stat-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 0.5rem 0;
}

.admin-stat-val {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    margin: 0.25rem 0 0.625rem;
}

.admin-stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary);
}

.admin-stat-trend svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.admin-stat-trend.up {
    color: #34d399;
    background: rgba(16, 185, 129, 0.12);
}

.admin-stat-trend.down {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
}

/* ---- Form Elements ---- */
.admin-form-group {
    margin-bottom: 1.5rem;
}

.admin-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--muted);
}

.admin-input,
.admin-textarea,
.admin-select {
    width: 100%;
    background: var(--bg-input) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    padding: 0.75rem 1rem !important;
    border-radius: 8px !important;
    outline: none !important;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.admin-input:focus,
.admin-textarea:focus,
.admin-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-alpha) !important;
}

.admin-select option {
    background: var(--bg-dark);
    color: var(--text);
}

.admin-file-text {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.5rem;
}

/* Switch Toggle */
.admin-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.admin-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.admin-switch-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: var(--border);
    border-radius: 24px;
    transition: .4s;
}

.admin-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text);
    border-radius: 50%;
    transition: .4s;
}

.admin-switch input:checked+.admin-switch-slider {
    background-color: var(--primary);
}

.admin-switch input:checked+.admin-switch-slider:before {
    transform: translateX(20px);
}

/* ---- Tables ---- */
.admin-table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.admin-table th {
    padding: 1rem;
    text-align: left;
    background: var(--bg-header);
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.875rem;
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: var(--bg-hover);
}

/* ---- Buttons & Badges ---- */
.btn-admin-primary {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    border: none;
}

.btn-admin-primary:hover {
    background: var(--primary-hover);
}

.btn-admin-secondary {
    background: var(--bg-secondary);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    border: none;
}

.btn-admin-secondary:hover {
    background: var(--bg-hover);
}

.btn-admin-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--muted);
    transition: all 0.2s;
    cursor: pointer;
}

.btn-admin-icon:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-admin-icon.danger {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.05);
}

.btn-admin-icon.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.badge,
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-active {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.badge-premium {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-free {
    background: rgba(6, 182, 212, 0.1);
    color: #22d3ee;
}

.badge-secondary {
    background: var(--border);
    color: var(--muted);
}

.pill-cat {
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* ---- Alerts & Panels ---- */
.admin-alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.admin-alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.admin-alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.admin-card,
.admin-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
}

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.875rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-panel-header h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.admin-content {
    padding: 1.5rem;
}

.admin-topbar h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0;
}

/* ---- Animations ---- */
.reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

@keyframes badgePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(139, 92, 246, 0);
    }
}

/* ---- Mobile & Responsiveness Fixes ---- */

/* Modern Bottom Navigation (Mobile Only) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(var(--bg-dark-rgb), 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000;
    padding-bottom: env(safe-area-inset-bottom);
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 500;
    gap: 4px;
    height: 100%;
    flex: 1;
    transition: all 0.3s ease;
}

.bottom-nav-item svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
    min-height: 20px;
    max-width: 20px;
    max-height: 20px;
    flex-shrink: 0;
    overflow: visible;
    transition: transform 0.3s ease;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active svg {
    transform: translateY(-2px);
    filter: drop-shadow(0 0 5px var(--glow-p));
}

/* Tablet & Smaller (<= 1024px) */
@media (max-width: 1024px) {
    .nav-links {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .section {
        padding: 4rem 1.5rem;
    }

    .footer-inner {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-brand {
        grid-column: span 2;
    }
}

/* Mobile Large (<= 768px) */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }

    .nav-inner {
        height: 56px;
    }

    .nav-logo {
        font-size: 1.15rem;
    }

    .hero {
        min-height: 70vh;
    }

    .hero-title {
        font-size: 3rem;
    }

    .stats-pill {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        padding: 1.25rem;
        width: fit-content;
        margin: 0 auto 2.5rem;
    }

    .stat-divider {
        width: 100%;
        height: 1px;
    }

    .summary-grid {
        grid-template-columns: 1fr !important;
    }

    .reading-preview {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .device-mockup {
        order: -1;
        margin-bottom: 1.5rem;
    }

    .preview-features {
        text-align: center;
    }

    .feature-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .detail-cover-wrap {
        max-width: 220px;
        margin: 0 auto;
    }

    .detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .dash-profile {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2.5rem;
    }

    .footer-brand {
        grid-column: 1;
    }

    .footer-links ul {
        align-items: center;
    }

    .social-row {
        justify-content: center;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .footer {
        padding-bottom: 100px;
        /* Space for bottom nav */
    }

    /* Hide header auth buttons on mobile - bottom nav handles it */
    .nav-right .btn-glow,
    .nav-right .nav-login {
        display: none;
    }

    /* ADMIN PANEL — slide-in drawer on mobile */
    .admin-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 260px !important;
        height: 100vh !important;
        transform: translateX(-260px) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
        border-bottom: none !important;
        margin-bottom: 0 !important;
        z-index: 200;
        overflow-y: auto;
    }

    .admin-sidebar.active {
        transform: translateX(0) !important;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
    }

    /* Restore full sidebar text on mobile (not icon-only mode) */
    .admin-sidebar .sidebar-text,
    .admin-sidebar .sidebar-logo-text {
        display: inline !important;
    }

    .admin-sidebar .sidebar-item {
        justify-content: flex-start !important;
        padding: 0.625rem 0.75rem !important;
    }

    .admin-main {
        margin-left: 0 !important;
        padding: 0;
    }
}

/* Mobile Small (<= 480px) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .section-link {
        margin-left: 0;
    }

    .premium-card {
        padding: 2rem 1rem;
    }

    /* Only make CTA buttons full width, not all .btn-glow (navbar uses btn-glow too) */
    .premium-card .btn-amber,
    .reading-page .btn-filled,
    .detail-page .btn-filled {
        width: 100%;
        justify-content: center;
    }
}
/* ============================================================
   ADMIN PANEL — FULL MOBILE RESPONSIVENESS
   Phone-first slide-in sidebar drawer system
   ============================================================ */

/* ---- Hamburger / Toggle Button ---- */
.admin-mobile-toggle {
    display: none; /* hidden on desktop */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
    padding: 0;
}

.admin-mobile-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.admin-mobile-toggle svg {
    width: 20px;
    height: 20px;
}

/* ---- Overlay (darkens main content when sidebar is open on mobile) ---- */
.admin-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.admin-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: all;
}

/* ============================================================
   TABLET (≤ 1024px) — sidebar still visible, minor tweaks
   ============================================================ */
@media (max-width: 1024px) {
    .admin-content {
        padding: 1.25rem;
    }

    .admin-search {
        width: 160px;
    }
}

/* ============================================================
   MOBILE LARGE (≤ 768px) — slide-in sidebar drawer
   ============================================================ */
@media (max-width: 768px) {

    /* Show the hamburger toggle */
    .admin-mobile-toggle {
        display: flex;
    }

    /* Hide desktop-only search bar */
    .admin-search-desktop {
        display: none;
    }

    /* Sidebar becomes a slide-in drawer */
    .admin-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 260px !important;
        height: 100vh;
        z-index: 200;
        transform: translateX(-260px);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        /* Override any collapsed/icon-only state */
        padding: 1.25rem 1rem;
        overflow-y: auto;
        /* Show all text — no collapsed mode on mobile */
    }

    /* Fully open state */
    .admin-sidebar.active {
        transform: translateX(0) !important;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
    }

    /* Restore full sidebar text & item layout on mobile (not icon-only) */
    .admin-sidebar .sidebar-text,
    .admin-sidebar .sidebar-logo-text {
        display: inline !important;
    }

    .admin-sidebar .sidebar-item {
        justify-content: flex-start !important;
        padding: 0.625rem 0.75rem !important;
    }

    /* Main area takes full width — no margin for sidebar */
    .admin-main {
        margin-left: 0 !important;
    }

    /* Topbar: ensure title is visible and doesn't overflow */
    .admin-topbar {
        padding: 0.625rem 1rem;
        gap: 0.5rem;
    }

    .admin-topbar h2 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 120px);
    }

    /* Content padding */
    .admin-content {
        padding: 1rem;
    }

    /* Stat cards: 2 columns on tablet-ish mobile */
    .admin-grid {
        gap: 1rem;
    }

    /* Admin grid stat cards — 2 per row */
    .admin-stat-card {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 0;
    }

    /* All column wrappers go full width */
    .admin-col-8,
    .admin-col-6,
    .admin-col-4,
    .admin-col-3 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Page header rows (title + add button) */
    .admin-page-header,
    [style*="justify-content: space-between"][style*="align-items: center"] {
        flex-wrap: wrap !important;
        gap: 0.75rem !important;
    }

    /* Form rows (2-col grids inside modals/forms) */
    .form-row {
        grid-template-columns: 1fr !important;
    }

    /* Dashboard grid-2 (engagement + recent users) goes to 1 col */
    .admin-grid-2 {
        grid-template-columns: 1fr !important;
    }

    /* Sidebar toggle button (desktop collapse button) — hide on mobile since we use hamburger */
    .sidebar-toggle {
        display: none;
    }

    /* Tables: ensure horizontal scrolling */
    .admin-table-container,
    .admin-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-table {
        min-width: 560px;
    }

    /* Table action buttons — slightly larger tap targets */
    .btn-admin-icon {
        width: 36px;
        height: 36px;
    }

    /* Toolbar (filter inputs + buttons) */
    .admin-toolbar {
        flex-wrap: wrap;
    }

    .filter-input,
    .filter-select {
        min-width: 0;
        flex: 1 1 140px;
    }
}

/* ============================================================
   MOBILE SMALL (≤ 480px) — single column everything
   ============================================================ */
@media (max-width: 480px) {

    /* Stat cards go single column */
    .admin-stat-card {
        flex: 1 1 100% !important;
    }

    /* Tighter content padding */
    .admin-content {
        padding: 0.75rem;
    }

    /* Smaller stat values */
    .admin-stat-val {
        font-size: 1.625rem;
    }

    /* Settings two-column panels (when using inline style) */
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Primary action buttons */
    .btn-admin-primary {
        width: 100%;
        justify-content: center;
    }

    /* Table: even narrower min-width so content is readable */
    .admin-table {
        min-width: 440px;
        font-size: 0.78rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.625rem 0.5rem;
    }

    /* Topbar title even smaller */
    .admin-topbar h2 {
        font-size: 0.9375rem;
    }

    /* Insight items on mobile */
    .insight-actions {
        flex-direction: row;
        min-width: 0;
    }

    .insight-actions a,
    .insight-actions button {
        flex: 1;
    }

    /* Modal card full-screen */
    .modal-card {
        border-radius: 12px;
        padding: 1.25rem;
    }
}

/* ============================================================
   MOBILE XS (≤ 375px) — edge cases
   ============================================================ */
@media (max-width: 375px) {
    .admin-topbar {
        padding: 0.5rem 0.75rem;
    }

    .admin-content {
        padding: 0.625rem;
    }

    .admin-stat-val {
        font-size: 1.5rem;
    }

    .admin-avatar-sm {
        width: 28px;
        height: 28px;
        font-size: 0.6875rem;
    }
}
