:root {
    /* Hệ thống biến số Nàng Journey */
    --sidebar-width: 260px;
    --header-height: 70px;
    --bg-main: #fbfaf8;
    --bg-elevated: #ffffff;
    --bg-secondary: #f3f0ec;
    --border-light: #eeeae5;

    --text-primary: #2d2d2d;
    --text-secondary: #5a5a5a;
    --text-muted: #9a938c;

    --peach-100: #fff0eb;
    --peach-300: #ffd8cc;
    --peach-400: #ff9a7b;
    --peach-500: #ff7c52;
    /* Màu chủ đạo */

    --gold: #d4a853;
    --gold-glow: rgba(212, 168, 83, 0.1);

    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --sp-4: 4px;
    --sp-8: 8px;
    --sp-12: 12px;
    --sp-16: 16px;
    --sp-20: 20px;
    --sp-24: 24px;
    --sp-32: 32px;

    --duration-fast: 0.2s;
    --duration-normal: 0.3s;
    --duration-slow: 0.5s;
    --ease-out: cubic-bezier(0.34, 1.56, 0.64, 1);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 20px rgba(255, 124, 82, 0.08);
    --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.1);

    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* --- Layout --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: var(--sp-32);
    animation: fadeIn var(--duration-slow) var(--ease-out);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Hero Card --- */
.heroCard {
    background: linear-gradient(135deg, #fff5f0, #fcecd5);
    border-radius: var(--radius-xl);
    padding: var(--sp-32) var(--sp-32);
    margin-bottom: var(--sp-24);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.heroBlob {
    position: absolute;
    width: 250px;
    height: 250px;
    background: var(--peach-300);
    border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%;
    opacity: 0.2;
    top: -80px;
    right: -60px;
    animation: blobFloat 12s ease-in-out infinite;
}

@keyframes blobFloat {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(-20px, 30px) rotate(5deg);
    }

    66% {
        transform: translate(10px, -20px) rotate(-5deg);
    }
}

.heroTitle {
    font-size: 2rem;
    margin: 0;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.heroSub {
    color: var(--text-secondary);
    margin-top: var(--sp-8);
    font-size: 1.1rem;
    max-width: 600px;
    position: relative;
    z-index: 1;
}

/* --- Filters --- */
.filterRow {
    display: flex;
    gap: var(--sp-12);
    margin-bottom: var(--sp-20);
    flex-wrap: wrap;
}

.filterBtn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-8);
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    border: 1px solid var(--border-light);
    transition: all var(--duration-normal);
    box-shadow: var(--shadow-sm);
}

.filterBtn:hover {
    border-color: var(--peach-400);
    color: var(--peach-500);
    transform: translateY(-2px);
}

.filterBtnActive {
    background: var(--peach-500);
    color: white;
    border-color: var(--peach-500);
    box-shadow: 0 8px 15px rgba(255, 124, 82, 0.2);
}

.bookCount {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: var(--sp-24);
    padding-left: var(--sp-4);
}

/* --- Book Grid --- */
.bookGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--sp-24);
}

.bookCard {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    display: flex;
    flex-direction: column;
}

.bookCard:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-6px);
    border-color: var(--peach-300);
}

.bookBadge {
    position: absolute;
    top: var(--sp-12);
    right: var(--sp-12);
    padding: 6px 14px;
    background: var(--gold);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    z-index: 2;
    box-shadow: 0 4px 10px rgba(212, 168, 83, 0.3);
}

.bookCover {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    border-bottom: 1px solid var(--border-light);
}

.bookEmoji {
    font-size: 4.5rem;
    transition: transform var(--duration-normal);
}

.bookCard:hover .bookEmoji {
    transform: scale(1.1) rotate(5deg);
}

.bookInfo {
    padding: var(--sp-20);
    flex: 1;
}

.bookTitle {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--sp-4) 0;
    line-height: 1.4;
}

.bookAuthor {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--sp-12);
}

.bookMeta {
    display: flex;
    align-items: center;
    gap: var(--sp-12);
    margin-bottom: var(--sp-16);
}

.bookCategoryTag {
    padding: 4px 12px;
    background: var(--peach-100);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--peach-500);
}

.bookYear {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bookDescription {
    margin-top: var(--sp-8);
    padding-top: var(--sp-12);
    border-top: 1px dotted var(--border-light);
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.bookExpandBtn {
    width: 100%;
    padding: var(--sp-12);
    margin-top: auto;
    font-weight: 700;
    color: var(--peach-500);
    background: transparent;
    border: none;
    border-top: 1px solid var(--border-light);
    cursor: pointer;
}

/* --- Sidebar & Header Placeholders (cho giao diện đồng nhất) --- */
header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    z-index: 10;
    display: flex;
    align-items: center;
    padding: 0 32px;
}

aside {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-light);
}

@media (max-width: 768px) {
    aside {
        display: none;
    }

    header {
        left: 0;
    }

    .app-main {
        margin-left: 0;
        padding: var(--sp-16);
    }

    .bookGrid {
        grid-template-columns: 1fr;
    }
}

.bookCover {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    overflow: hidden;
    position: relative;
}

.bookImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-normal) var(--ease-out);
}

.bookCard:hover .bookImage {
    transform: scale(1.08);
}

.bookEmoji {
    font-size: 4rem;
    opacity: 0.5;
}

.detail-container {
    max-width: 1000px;
    margin: 0 auto;
    animation: fadeIn 0.6s var(--ease-out);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: var(--sp-24);
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--peach-500);
}

.book-hero {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--sp-32);
    background: var(--bg-elevated);
    padding: var(--sp-32);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.book-visual {
    position: relative;
}

.book-main-cover {
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-light);
}

.detail-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--peach-500);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(255, 124, 82, 0.3);
}

.book-header-info h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin: 0 0 var(--sp-12) 0;
    color: var(--text-primary);
    line-height: 1.2;
}

.book-full-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: var(--sp-24);
    padding-bottom: var(--sp-24);
    border-bottom: 1px solid var(--border-light);
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.meta-value {
    font-weight: 600;
    color: var(--text-primary);
}

.book-content-section {
    margin-top: var(--sp-32);
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1.1rem;
    white-space: pre-line;
}

.action-bar {
    margin-top: var(--sp-32);
    display: flex;
    gap: 16px;
}

.btn-primary {
    background: var(--peach-500);
    color: white;
    padding: 12px 32px;
    border-radius: var(--radius-full);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 124, 82, 0.3);
}

@media (max-width: 768px) {
    .book-hero {
        grid-template-columns: 1fr;
        padding: var(--sp-16);
    }

    .book-main-cover {
        font-size: 6rem;
    }

    .book-header-info h1 {
        font-size: 1.8rem;
    }
}

.book-main-cover {
    width: 100%;
    aspect-ratio: 3/4;
    background: #f8f9fa;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.shadow-cover {
    box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.15),
        inset 15px 0 20px rgba(0, 0, 0, 0.05);
}

.shadow-cover::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 10px;
    height: 100%;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.2), transparent);
    z-index: 2;
}

.book-main-cover img {
    transition: transform 0.5s ease;
}

.book-main-cover:hover img {
    transform: scale(1.05);
}

.book-reader-section {
    margin-top: 40px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #eee;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.reader-header {
    background: #fdfdfd;
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reader-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: 0;
}

/* Vùng chứa nội dung chữ */
.reader-body {
    padding: 32px;
    max-height: 600px;
    /* Giới hạn chiều cao để không quá dài trang */
    overflow-y: auto;
    line-height: 1.8;
    color: #444;
    font-size: 1.1rem;
    background-color: #fafafa;
    /* Màu nền giấy nhẹ */
}

.content-render p {
    margin-bottom: 1.5rem;
}

/* Thanh công cụ phóng to/nhỏ chữ */
.tool-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 8px;
    font-weight: bold;
}

.tool-btn:hover {
    background: var(--peach-100);
    color: var(--peach-500);
}

.btn-primary {
    background: var(--peach-500);
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.btn-secondary {
    background: #eee;
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    margin-left: 10px;
}

/* ===== HERO ===== */
.heroCard {
    position: relative;
    padding: 32px;
    border-radius: 20px;
    background: linear-gradient(135deg, #f0f9ff, #ecfdf5);
    margin-bottom: 24px;
    overflow: hidden;
}

.heroTitle {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.heroSub {
    font-size: 0.95rem;
    color: #666;
}

/* ===== FILTER ===== */
.filterRow {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filterBtn {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.25s ease;
}

.filterBtn:hover {
    background: #f5f5f5;
}

.filterBtnActive {
    background: #4CAF50;
    color: white;
    border: none;
}

/* ===== COUNT ===== */
.bookCount {
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #666;
}

/* ===== GRID ===== */
.bookGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* ===== CARD ===== */
.bookCard {
    position: relative;
    border-radius: 16px;
    background: white;
    padding: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.bookCard:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

/* Badge */
.bookBadge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: gold;
    color: #333;
    padding: 4px 8px;
    font-size: 0.7rem;
    border-radius: 8px;
    font-weight: 600;
}

/* Cover */
.bookCover {
    height: 160px;
    border-radius: 12px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bookImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bookEmoji {
    font-size: 3rem;
}

/* Info */
.bookInfo {
    margin-top: 10px;
}

.bookTitle {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.bookAuthor {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 6px;
}

/* Meta */
.bookMeta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #666;
}

.bookCategoryTag {
    background: #f1f1f1;
    padding: 3px 8px;
    border-radius: 999px;
}

/* Button */
.bookExpandBtn {
    margin-top: 10px;
    font-size: 0.85rem;
    padding: 6px;
    border-radius: 8px;
    background: #f9f9f9;
    transition: 0.2s;
}

.bookExpandBtn:hover {
    background: #4CAF50;
    color: white;
}

/* Empty */
.bookGrid p {
    font-size: 0.9rem;
    color: #999;
}