:root {
    --bg-color: var(--reader-bg-day, #f8f9fa);
    --text-color: var(--reader-text-day, #333);
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --primary-color: var(--reader-link-day, #4f46e5);
    --primary-hover: #4338ca;
    --primary-text-color: #ffffff;
    --secondary-color: #6b7280;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --font-size: 18px;
    --line-height: 1.8;
}

html.dark-mode {
    --bg-color: var(--reader-bg-night, #1f2937);
    --text-color: var(--reader-text-night, #f3f4f6);
    --card-bg: #374151;
    --border-color: #4b5563;
    --primary-color: var(--reader-link-night, #818cf8);
    --primary-text-color: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.nvl-reader-body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: var(--line-height);
    font-family: 'Vazirmatn', sans-serif;
}

.container { display: flex; min-height: 100vh; position: relative; }
.content-area { flex: 1; padding: 2rem; max-width: 800px; margin: 0 auto; transition: margin-right 0.3s ease; }
.book-header { text-align: center; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.book-title { font-size: 2rem; font-weight: bold; margin-bottom: 0.5rem; color: var(--primary-color); }
.chapter-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; color: var(--secondary-color); }
.book-content { background-color: var(--card-bg); padding: 2rem; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 2rem; font-size: var(--font-size); line-height: var(--line-height); text-align: justify; transition: all 0.3s ease; position: relative; overflow-wrap: break-word; }
.book-content p { margin-bottom: 1.5em; }
.book-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 1em 0; }
.navigation { display: flex; justify-content: space-between; gap: 1rem; }
.nav-btn { flex: 1; padding: 0.75rem 1.5rem; background-color: var(--primary-color); color: var(--primary-text-color); border: none; border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; transition: background-color 0.3s ease; display: flex; align-items: center; justify-content: center; gap: 0.5rem; text-decoration: none; }
.nav-btn[disabled] { background-color: var(--secondary-color); cursor: not-allowed; opacity: 0.7; pointer-events: none; }

.sidebar { width: 320px; background-color: var(--card-bg); box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1); padding: 1.5rem; overflow-y: auto; transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease; position: fixed; top: 0; right: -320px; height: 100vh; z-index: 100; border-left: 1px solid var(--border-color); }
.sidebar.open { transform: translateX(-320px); }
.sidebar-header { text-align: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.sidebar-book-title { font-size: 1.25rem; font-weight: bold; color: var(--primary-color); margin-bottom: 0; }
.sidebar-book-subtitle { font-size: 1rem; font-weight: 400; color: var(--secondary-color); margin: 0.25rem 0 0; }
.sidebar-btn { width: 100%; padding: 0.75rem; margin-bottom: 1.5rem; background-color: var(--primary-color); color: var(--primary-text-color); border: none; border-radius: 8px; font-size: 1rem; font-weight: 500; cursor: pointer; transition: background-color 0.3s ease; display: flex; align-items: center; justify-content: center; gap: 0.5rem; text-decoration: none; }
.zoom-controls { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.zoom-btn { margin-bottom: 0; flex: 1; background-color: var(--bg-color); color: var(--text-color); border: 1px solid var(--border-color); border-radius: 8px; padding: 0.75rem; font-size: 1rem; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; transition: all 0.2s ease; }
.chapters-list { margin-top: 1.5rem; }
.chapters-list h3 { margin-bottom: 1rem; font-size: 1.1rem; font-weight: 600; color: var(--secondary-color); }
.chapters-container { max-height: 400px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 8px; padding: 0.5rem; }
.chapter-item { display: block; padding: 0.75rem; margin-bottom: 0.5rem; background-color: var(--bg-color); border-radius: 6px; cursor: pointer; transition: all 0.3s ease; border-right: 3px solid transparent; text-decoration: none; color: var(--text-color); }
.chapter-item.active { background-color: var(--primary-color); color: var(--primary-text-color); border-right-color: var(--primary-hover); }

.menu-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 101;
    background-color: var(--primary-color);
    color: var(--primary-text-color);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar-is-open .menu-toggle {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 99; display: none; }
.sidebar-overlay.active { display: block; }

@media (hover: hover) {
    .nav-btn:not([disabled]):hover, .sidebar-btn:hover { background-color: var(--primary-hover); }
    .zoom-btn:hover { background-color: var(--primary-color); color: var(--primary-text-color); }
    .chapter-item:not(.active):hover { background-color: var(--primary-color); color: var(--primary-text-color); border-right-color: var(--primary-hover); }
}

@media (min-width: 1120px) {
    .sidebar {
        position: sticky;
        top: 0;
        right: 0;
        transform: none !important;
        height: 100vh;
        z-index: 10;
        box-shadow: none;
    }
    .menu-toggle { display: none; }
    .sidebar-overlay { display: none !important; }
}

@media (max-width: 1119px) {
    .sidebar { right: -320px; }
    .sidebar.open { transform: translateX(-320px); }
    .content-area { margin-right: 0; }
}