:root {
    /* New Theme: Leafy Emerald */
    --primary-color: #10b981;
    --primary-hover: #059669;
    --primary-light: #ecfdf5;
    --blue-primary: #2563eb;
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;

    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --radius-xl: 24px;
    --radius-md: 16px;
}

body.dark-mode {
    --primary-color: #10b981;
    --primary-light: #064e3b;
    --bg-main: #040c1e;
    --bg-card: #1f2937;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    --blue-primary: #3b82f6;
}

section {
    padding: 0 !important;
}

.leafy-main-container {
    min-height: 90vh;
    padding: 2rem 1rem;
    background-color: var(--bg-main);
    font-family: 'Inter', system-ui, sans-serif;
    /* Cleaner font stack */
}

/* Card Layout */
.book-details-wrapper {
    background-color: var(--bg-card);
    width: 100%;
    max-width: 95%;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: 3rem;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 3.5rem;
    align-items: start;
    border: 1px solid var(--border-color);
}

/* --- SIDEBAR --- */
.cover-container {
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    transition: transform 0.3s ease;
    height: 300px;
}

.book-cover {
    width: 100%;
    height: 100%;
}


.cover-container:hover {
    transform: scale(1.05) translateY(-8px) rotateZ(1deg);
}

.badge-overlay {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary-color);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Stats Box */
.book-stats {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    border-right: 1px solid var(--border-color);
}

.stat-item:last-child {
    border-right: none;
}

.stat-item .count {
    font-weight: 800;
    color: var(--text-main);
    font-size: 1.1rem;
}

.stat-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    font-weight: 600;
}

/* Share Button Area */
.share-row {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
    width: 100%;
}

.btn-chip {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn {
    background-color: var(--bg-main);
}

.btn-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--primary-light);
}

/* --- MAIN CONTENT --- */
.book-header {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.book-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--text-main), var(--blue-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Metadata Grid */
.book-credits {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: #eff6ff;
    border-radius: 12px;
    padding: 15px;

}

body.dark-mode .book-credits {
    background-color: #23354d;

}

.credit-row {
    display: flex;
    flex-direction: column;
}

.credit-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.credit-value {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

/* Description */
.book-description h4 {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 1rem;
    font-weight: 700;
    display: flex;
    padding: 5px;
    align-items: center;
    border-left: 5px solid #12c543;
    border-radius: 4px;
}


.book-description p {
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
}

/* CTA Button */
.action-area {
    margin-top: 1rem;
}

.btn-primary.btn-lg {
    background-color: var(--primary-color);
    color: white;
    padding: 16px 48px;
    font-size: 1.1rem;
    border-radius: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    /* Green shadow */
    transition: transform 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
}

/* Explore Section */
.explore-section {
    width: 100%;
    max-width: 95%;
    margin: 3rem auto 0;
}

.explore-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.explore-header h3 {
    font-size: 1.6rem;
    color: var(--text-main);
    font-weight: 700;
}

.explore-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.mobile-title-inline {
    display: none;
}

.smallbookdescframe{
     display: block;
        position: absolute;
        left: -3px;
        top: -2px;
        width: 104%;
        height: 102%;
}




/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .book-details-wrapper {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 2rem;
    }

    .book-sidebar {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1.25rem;
        max-width: 100%;
        margin: 0;
        text-align: left;
    }

    .cover-container {
        width: 150px;
        height: 200px;
        flex-shrink: 0;
        margin: 0;
    }

    .sidebar-right-content {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
    }

    .mobile-title-inline {
        display: inline-block;
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
        white-space: normal;
        word-wrap: break-word;
    }

    .book-header.mobile-hidden {
        display: none;
    }

    .book-stats {
        margin-top: 0;
        padding: 0.75rem 0.5rem;
    }

    .stat-item .count {
        font-size: 0.9rem;
    }

    .stat-item .label {
        font-size: 0.6rem;
    }

    .share-row {
        margin-top: 0.75rem;
    }

    .btn-chip {
        padding: 8px;
        font-size: 0.85rem;
    }

    .book-header {
        text-align: center;
    }

    .book-title {
        font-size: 2rem;
    }

    .btn-primary.btn-lg {
        width: 100%;
        justify-content: center;
        align-items: center;
    }
}

@media (max-width: 600px) {
    .leafy-main-container {
        padding: 0 0 90px 0;
        /* Space for sticky bottom bar */
        background-color: var(--bg-card);
        /* Make background match card on mobile */
    }

    .book-details-wrapper {
        padding: 1.25rem 0rem;
        border-radius: 0;
        border: none;
        box-shadow: none;
        gap: 1.5rem;
    }

    .share-row {
        flex-wrap: wrap;
    }

    .btn-chip {
        width: 100%;
    }

    /* Sticky Bottom CTA */
    .action-area {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0);
        width: 65%;
        justify-content: center;
        padding: 10px;
        margin: 5px auto;
        z-index: 50;
        display: flex;
        border-radius: 16px;
        backdrop-filter: blur(1px);
        border: 1px solid #d8d8d8;
    }

    body.dark-mode .action-area {
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    }

    .btn-primary.btn-lg {
        width: 100%;
        justify-content: center;
        padding: 10px;
        margin: auto;
        box-shadow: none;
    }

    /* Refined Credits */
    .book-credits {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        background: #49494924;
        padding: 10px;
    }

    .credit-row {
        background: var(--bg-main);
        padding: 5px 10px;
        border-radius: 10px;
    }

    .explore-section {
        padding: 0 1rem;
    }

    .explore-section .books-grid {
        padding-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }


    .explore-section .book-item {
        flex: 0 0 140px;
        scroll-snap-align: start;
    }

    .book-description h4 {
        font-size: 1.1rem;
    }

    .book-title {
        font-size: 1.5rem;
    }

    .credit-value {
        font-size: 0.8rem;
    }

    .book-description p {
        line-height: 1.9;
        font-size: 0.9rem;
    }

    .smallbookdescframe {
        display: block;
        position: absolute;
        left: -3px;
        top: -2px;
        width: 104%;
        height: 204px;
        transform: perspective(1000px) rotateY(15deg);
    }

    .book-cover {
        transform: perspective(1000px) rotateY(15deg);
    }

    .mobile-bottom-nav {
        display: none !important;
    }

    .explore-header h3 {
        font-size: 1.3rem;
    }

    .explore-section {
        margin: 0rem auto 0;

    }
}