/* Thiết lập chung */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Roboto', -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased; /* Tăng độ mịn trên Webkit (Chrome, Safari) */
    -moz-osx-font-smoothing: grayscale; /* Tăng độ mịn trên Firefox macOS */
    text-rendering: optimizeLegibility; /* Ưu tiên độ rõ nét */
}


/* Overlay loading */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Magazine container */
#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.magazine-viewport {
    position: fixed;
    top: 50px; /* Chiều cao của thanh công cụ trên */
    bottom: 50px; /* Chiều cao của thanh công cụ dưới */
    left: 0;
    right: 0;
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    transform: translateZ(0);
}

.magazine-viewport.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
}

.container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.container:active {
    cursor: grabbing;
}

.magazine {
    position: relative;
    margin: 0 auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: white;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    transform: translateZ(0);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
    opacity: 1;
}

/* Nút audio */
.audio-button {
    position: absolute;
    cursor: pointer;
    width: 100%;  /* Phủ toàn bộ trang */
    height: 100%;
    display: block; /* Thay đổi từ none thành block */
    align-items: center;
    justify-content: center;
    font-size: 50px;
    opacity: 0;    /* Làm cho nút trong suốt */
    z-index: 1000;
    transition: all 0.3s ease;
    top: 0;
    left: 0;
}



/* Thanh điều khiển */
.control-bar-top, .control-bar-bottom {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 10px 0;
    display: flex;
    justify-content: center;
    transition: all 0.3s ease;
}

.control-bar-top {
    top: 0;
}

.control-bar-bottom {
    bottom: 0;
}

.controls-top, .controls-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90%;
    max-width: 1200px;
}

.top-controls-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.control-group {
    display: flex;
    align-items: center;

    gap: 40px;
}

button {
    background-color: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 16px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.page-display {
    margin: 0 10px;
}

/* Panel ghi chú */
.note-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-width: 90%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.note-content {
    padding: 15px;
}

#note-text {
    width: 100%;
    height: 200px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    resize: none;
}

.note-tools {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-save-note, .btn-clear-note {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: black;
}

.btn-save-note {
    background-color: #4CAF50;
}

.btn-clear-note {
    background-color: #f44336;
}

/* Share Modal Styles */
.share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: none;
    z-index: 9999;
}

.share-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.share-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.share-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.close-share {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
}

.share-content {
    padding: 20px;
}

/* URL Share Section */
.url-input-group {
    display: flex;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

#share-url {
    flex: 1;
    padding: 10px;
    border: none;
    background: #f8f9fa;
}

.copy-url {
    padding: 10px 15px;
    background: #4263eb;
    color: white;
    border: none;
    cursor: pointer;
}

.copy-url:hover {
    background: #364fc7;
}

/* Social Buttons */
.social-share-section h4 {
    margin: 0 0 15px 0;
    color: #333;
}

.social-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-btn.facebook {
    background: #1877f2;
    color: white;
}

.share-btn.twitter {
    background: #1da1f2;
    color: white;
}

.share-btn.email {
    background: #ea4335;
    color: white;
}

.share-btn i {
    font-size: 20px;
}

.share-btn span {
    font-size: 12px;
}

/* Sidebar mục lục */
.toc-sidebar {
    position: fixed;
    top: 0;
    left: -340px;
    width: 300px;
    height: 100%;
    background: #fff;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.toc-sidebar.open {
    left: 0;
}

.toc-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.toc-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.close-toc {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.close-toc:hover {
    color: #333;
}

.toc-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 10px;
}

.thumbnail-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.thumbnail-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.thumbnail-image {
    position: relative;
    padding-top: 141.4%; /* Tỷ lệ khung hình A4 */
    background: #f8f9fa;
}

.thumbnail-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-info {
    padding: 10px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.icon {
    font-family: 'Font Awesome 5 Free';
    font-size: 20px;
    color: black;
}


.icon_link {
    font-family: 'Font Awesome 5 Free';
    font-size: 14px;
    padding-left: 13px;
    padding-right: 13px;
    padding-top: 10px;
    padding-bottom: 10px;
    background-color: #b5b8b8;
    text-decoration: none;
    border-radius: 50%;
}



.icon_text{
    font-family: 'Font Awesome 5 Free';
    font-size: 10px;
    padding-left: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-right: 20px;
    background-color: #b5b8b8;
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    /* border-radius: 30%; */
}

.page-number {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: none;
    z-index: 999;
    display: none;
}

/* Thêm animation loading cho thumbnails */
.thumbnail-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .top-controls-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    .toc-sidebar, .bookmark-sidebar {
        width: 100%;
    }
    
    .control-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .toc-sidebar {
        width: 280px;
    }

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

    .magazine-viewport {
        top: 40px;
        bottom: 40px;
    }
    
    .control-bar-top, .control-bar-bottom {
        padding: 5px 0;
    }
    
    .control-group {
        gap: 20px;
    }
    
    button {
        padding: 3px 8px;
        font-size: 14px;
    }
}

.notes-search {
    margin-left: 20px;
    flex-grow: 1;
    max-width: 300px;
}

#search-notes {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.no-search-results {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

body.dark-mode #search-notes {
    background-color: #444;
    color: #f5f5f5;
    border-color: #555;
}

/* Style cho nút ESC và tip */
.btn-esc-note {
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    margin-left: 10px;
}

.btn-esc-note:hover {
    background-color: #5a6268;
}

.modal-tip {
    font-size: 12px;
    color: #777;
    margin-top: 10px;
    text-align: center;
}

/* Dark mode cho tip và nút ESC */
body.dark-mode .modal-tip {
    color: #aaa;
}

body.dark-mode .btn-esc-note {
    background-color: #495057;
}

body.dark-mode .btn-esc-note:hover {
    background-color: #3d4246;
}

/* Thêm vào file style.css */
.note-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.note-page {
    font-weight: bold;
    color: #666;
}

.note-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin-left: 5px;
    color: #666;
}

.note-actions button:hover {
    color: #007bff;
}

.note-content {
    white-space: pre-wrap;
    margin-bottom: 10px;
    color: #333;
}

.note-date {
    font-size: 0.8em;
    color: #999;
}

.no-notes-message {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* Thêm vào file style.css */
.all-notes-modal {
    background-color: rgba(0, 0, 0, 0.7);
}

.all-notes-modal > div {
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
}

.all-notes-modal h2 {
    color: #333;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
}

.note-item {
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: 20px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.note-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.note-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.note-page-badge {
    background-color: #4263eb;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.note-date {
    color: #666;
    font-size: 13px;
}

.note-date i {
    margin-right: 5px;
}

.note-actions {
    display: flex;
    gap: 10px;
}

.note-actions button {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-note {
    color: #4263eb;
}

.delete-note {
    color: #e03131;
}

.note-actions button:hover {
    background-color: #f8f9fa;
    transform: scale(1.1);
}

.note-content-wrapper {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.note-content {
    color: #333;
    line-height: 1.6;
    font-size: 15px;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-footer {
    display: flex;
    justify-content: flex-end;
}

.goto-page {
    background-color: #4263eb;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.goto-page:hover {
    background-color: #364fc7;
    transform: translateY(-1px);
}

.no-notes-message {
    text-align: center;
    padding: 40px 20px;
    color: #868e96;
    font-size: 16px;
    background-color: #f8f9fa;
    border-radius: 12px;
    margin: 20px 0;
}

/* Thêm animation khi mở modal */
@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.all-notes-modal > div {
    animation: slideIn 0.3s ease-out;
}

/* Thêm vào file style.css */
.all-notes-modal .close-all-notes {
    position: absolute;
    right: 20px;
    top: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.all-notes-modal .close-all-notes:hover {
    background-color: rgba(0,0,0,0.1);
}

.delete-note {
    background-color: #fff !important;
    color: #dc3545 !important;
    border: 1px solid #dc3545 !important;
    padding: 5px 10px !important;
    border-radius: 4px !important;
}

.delete-note:hover {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.note-actions button {
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

.note-actions button:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Điều chỉnh controls trong chế độ fullscreen */
.control-bar-top,
.control-bar-bottom {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.control-bar-top {
    top: 0;
}

.control-bar-bottom {
    bottom: 0;
}

/* Ẩn controls khi không hover */
:fullscreen .control-bar-top {
    transform: translateY(-100%);
}

:fullscreen .control-bar-bottom {
    transform: translateY(100%);
}

:fullscreen .magazine-viewport:hover .control-bar-top {
    transform: translateY(0);
}

:fullscreen .magazine-viewport:hover .control-bar-bottom {
    transform: translateY(0);
}

/* Style cho nút fullscreen */
.fullscreen-toggle {
    transition: all 0.3s ease;
}

.fullscreen-toggle:hover {
    transform: scale(1.1);
}

/* Đảm bảo magazine luôn ở giữa trong fullscreen */
:fullscreen .magazine-viewport .container {
    transform-origin: center center;
}

/* Bookmark Styles */
.bookmark-sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.bookmark-sidebar.open {
    right: 0;
}

.bookmark-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.bookmark-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.close-bookmark {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.bookmark-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.add-bookmark-section {
    padding: 0 0 15px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.add-bookmark-btn {
    width: 100%;
    padding: 12px;
    background: #4263eb;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    transition: background-color 0.2s;
}

.add-bookmark-btn:hover {
    background: #364fc7;
}

.bookmark-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bookmark-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.bookmark-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.bookmark-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bookmark-page {
    background: #e7f5ff;
    color: #1971c2;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.bookmark-title {
    color: #333;
    font-size: 14px;
}

.bookmark-actions {
    display: flex;
    gap: 8px;
}

.bookmark-actions button {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.bookmark-actions button:hover {
    color: #333;
}

.delete-bookmark:hover {
    color: #e03131;
}

/* Modal In */
.print-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: none;
    z-index: 9999;
}

.print-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.print-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.close-print {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.close-print:hover {
    color: #333;
}

.print-options {
    margin-bottom: 20px;
}

.page-range {
    margin-bottom: 15px;
}

.page-range label {
    display: block;
    margin-bottom: 8px;
    color: #555;
}

.range-inputs {
    margin-top: 10px;
}

.range-inputs label {
    margin-right: 15px;
    color: #333;
}

.custom-range-inputs {
    display: none;
    margin-top: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
}

.custom-range-inputs input[type="number"] {
    width: 80px;
    padding: 5px 10px;
    margin: 0 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.print-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-start-print {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.btn-start-print:hover {
    background: #0056b3;
}

.btn-start-print i {
    font-size: 18px;
}

.print-frame {
    display: none;
}

.side-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Cho phép click xuyên qua vùng trống */
    z-index: 100;
}

.side-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    border: none;
    /* border-radius: ; */
    width: 40px;
    height: 80px;
    cursor: pointer;
    pointer-events: auto; /* Cho phép click vào nút */
    transition: all 0.3s ease;
}

.side-nav-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

.side-nav-btn i {
    color: white;
    font-size: 20px;
}

.side-nav-btn.left {
    left: 0px;
}

.side-nav-btn.right {
    right: 0px;
}

/* Ẩn nút khi ở trang đầu hoặc cuối */
.side-nav-btn.disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .side-nav-btn {
        width: 32px;
        height: 32px;
    }
    
    .side-nav-btn i {
        font-size: 16px;
    }
    
    .side-nav-btn.left {
        left: 10px;
    }
    
    .side-nav-btn.right {
        right: 10px;
    }
}

/* Dark mode styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #ffffff;
}

/* Toolbar trong dark mode */
body.dark-mode .magazine-toolbar {
    background-color: #2d2d2d;
    border-color: #404040;
}

/* Nút trong dark mode */
body.dark-mode .magazine-toolbar button {
    background-color: #404040;
    color: #ffffff;
    border-color: #505050;
}

body.dark-mode .magazine-toolbar button:hover {
    background-color: #505050;
}

/* Sidebar trong dark mode */
body.dark-mode .toc-sidebar,
body.dark-mode .bookmark-sidebar {
    background-color: #2d2d2d;
    color: #ffffff;
    border-color: #404040;
}

/* Modal trong dark mode */
body.dark-mode .modal-content,
body.dark-mode .note-panel,
body.dark-mode .share-modal .share-container,
body.dark-mode .print-modal .print-container {
    background-color: #2d2d2d;
    color: #ffffff;
    border-color: #404040;
}

/* Input và textarea trong dark mode */
body.dark-mode input[type="text"],
body.dark-mode textarea {
    background-color: #404040;
    color: #ffffff;
    border-color: #505050;
}

/* Thumbnail và bookmark items trong dark mode */
body.dark-mode .thumbnail-item,
body.dark-mode .bookmark-item {
    background-color: #404040;
    border-color: #505050;
}

/* Nút chuyển đổi dark mode */
.dark-mode-toggle {
    padding: 8px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

body.dark-mode .dark-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Magazine trong dark mode */
body.dark-mode .magazine-viewport {
    background-color: #1a1a1a;
}

/* Điều chỉnh độ trong suốt của overlay trong dark mode */
body.dark-mode .page-click-overlay {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Nút audio trong dark mode */
body.dark-mode .audio-button {
    background-color: rgba(64, 64, 64, 0.7);
}

body.dark-mode .audio-button i {
    color: #ffffff;
}

/* Nút điều hướng trong dark mode */
body.dark-mode .side-nav-btn {
    background-color: rgba(64, 64, 64, 0.7);
    color: #ffffff;
}

body.dark-mode .side-nav-btn:hover {
    background-color: rgba(80, 80, 80, 0.7);
}

/* Thanh cuộn trong dark mode */
body.dark-mode ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #2d2d2d;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #505050;
    border-radius: 5px;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #606060;
}

body.dark-mode .icon {
    color: #ffffff;
}

body.dark-mode .icon_link {
    color: #ffffff;
}

body.dark-mode .icon_text {
    color: #ffffff;
}

img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    transform: translateZ(0);
}



