:root {
    --bg-color: #F2F0E9;
    --card-bg: #FCFAF8;
    --text-primary: #1F1F1F;
    --text-secondary: #666666;
    --accent-dark: #111111;
    --font-serif: 'Playfair Display', serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
}

.book-layout-container {
    display: flex;
    height: calc(100vh - 5rem);
    width: 100%;
}

.book-main-content {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.book-sidebar {
    width: 0;
    padding: 0;
    opacity: 0;
    flex-shrink: 0;
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.5s ease,
        opacity 0.3s ease;
    background-color: var(--card-bg);
    height: 100%;
}

.book-sidebar.sidebar-open {
    width: 280px;
    padding: 2rem;
    opacity: 1;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.04);
    z-index: 5;
}

.sidebar-wrapper {
    padding: 1rem;
    padding-bottom: 3rem;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
}

.sidebar-category-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;

    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;

    padding: 1rem 0.75rem 0.5rem 0.75rem;
    margin-top: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-category-btn:hover {
    color: var(--accent-dark);
}

.sidebar-category-btn:focus {
    outline: none;
}

.sidebar-link-btn {
    display: flex;
    align-items: center;
    width: 100%;
    background: transparent;
    border: none;

    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.5;

    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
    text-align: left;
}

.sidebar-link-btn:hover {
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

.sidebar-link-btn.active {
    background-color: rgba(17, 17, 17, 0.06);
    color: var(--accent-dark);
    font-weight: 600;
}

.sidebar-link-btn.active::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--accent-dark);
    margin-right: 10px;
    flex-shrink: 0;
}

.btn-edit-mode {
    background: transparent;
    border: 1px dashed #ccc;
    color: #666;
    width: 100%;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-edit-mode:hover {
    border-color: var(--accent-dark);
    color: var(--accent-dark);
    background: white;
}

.chevron-icon {
    font-size: 0.65rem;
    opacity: 0.5;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sidebar-category-btn:hover .chevron-icon {
    opacity: 1;
}

.sidebar-category-btn:not(.collapsed) .chevron-icon {
    transform: rotate(180deg);
    color: var(--accent-dark);
}

.hero-card {
    width: 100%;
    max-width: 1100px;
    min-height: 600px;
    height: 100%;
    background-color: var(--card-bg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.04);
    padding: 3rem;
    position: relative;
}

.book-cover-3d {
    width: 400px;
    height: 600px;
    position: relative;
    z-index: 2;
    transition: transform 0.4s ease;
    box-shadow:
        -15px 15px 30px rgba(0, 0, 0, 0.2),
        5px 5px 15px rgba(0, 0, 0, 0.1);
}

.book-cover-3d img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit !important;
}

.book-cover-3d:hover {
    transform: translateY(-5px) scale(1.02);
}

.book-title {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.book-subtitle {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.book-author {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    color: #888;
}

.action-area {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.btn-start-read {
    background-color: var(--accent-dark);
    color: white;
    border: none;
    padding: 12px 35px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.btn-start-read:hover {
    background-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-start-read i {
    transition: transform 0.4s ease;
}

.btn-start-read.arrow-rotated {
    background-color: #333;
}

.btn-start-read.arrow-rotated i {
    transform: rotate(180deg);
}

.btn-icon {
    background: transparent;
    border: 1px solid #E5E5E5;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s;
}

.btn-icon:hover {
    border-color: var(--accent-dark);
    color: var(--accent-dark);
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: auto;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.meta-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.section-label {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.description-area p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 90%;
}

.avatar-mini {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    float: left;
}

.quote-text {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.85rem;
}

#vista-contenido {
    scroll-behavior: smooth;
    padding-bottom: 5rem !important;
    background-color: var(--card-bg);
}

.reader-container {
    opacity: 0;
    display: none;
    transition: opacity 0.4s ease;
}

.reader-container.visible {
    opacity: 1;
    display: block;
}

.content-exiting .animate-item {
    opacity: 0;
    transform: translateY(-15px);
    transition: opacity 0.3s ease-in, transform 0.3s ease-in;
}

.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.35s;
}

.document-body {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    font-family: 'Inter', sans-serif;
    color: #2d2d2d;
}

.sticky-header-blur {
    position: sticky;
    top: -48px;
    z-index: 100;
    background: rgba(252, 250, 248, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-left: -3rem;
    margin-right: -3rem;
    padding: 1rem 3rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.document-body table {
    width: 100% !important;
    height: auto !important;
    table-layout: fixed;
    border-collapse: collapse !important;
    margin-bottom: 2rem;
    display: table;
}

.document-body td,
.document-body th {
    padding: 2px 10px !important;
    vertical-align: top;
    border: 1px solid #e2e8f0;
    white-space: normal !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-body img {
    height: auto !important;
    max-width: 100% !important;
    border-radius: 8px;
    margin: 20px auto;
    display: block;
}

.document-body p {
    margin-bottom: 1.5em;
    line-height: 1.6;
    font-size: 1rem;
}

.document-body a {
    color: var(--usb-color);
    text-decoration: underline;
    font-size: 1rem;
}

.document-body ul,
.document-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.document-body li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.ql-align-justify,
.ql-align-center,
.ql-align-right {
    text-align: justify !important;
}

#vista-contenido::-webkit-scrollbar {
    width: 6px;
}

#vista-contenido::-webkit-scrollbar-track {
    background: transparent;
}

#vista-contenido::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

#vista-contenido::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

#vista-contenido img {
    border-radius: inherit !important;
}

@media (max-width: 992px) {
    .book-layout-container {
        flex-direction: column;
        height: auto;
    }

    .book-sidebar {
        width: 100%;
        border-bottom: 1px solid #eee;
        padding: 1rem;
    }

    .hero-card {
        padding: 2rem;
    }

    .book-cover-3d {
        margin: 0 auto 2rem auto;
        width: 250px;
        height: 350px;
    }

    .book-title {
        font-size: 2rem;
    }

    .action-area {
        justify-content: center;
    }

    .meta-grid {
        text-align: left;
    }

    .sticky-header-blur {
        margin-left: -2rem;
        margin-right: -2rem;
        padding: 1rem 2rem;
    }
}