
        :root {
            --app-height: 100vh;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html, body {
            height: 100%;
            width: 100%;
            overflow: hidden;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: #f5f5f5;
        }

        .main-container {
            display: flex;
            height: var(--app-height);
            direction: rtl;
            overflow: hidden;
        }

        /* Sidebar Styles */
        .sidebar {
            width: 400px;
            background: white;
            border-left: 1px solid #ddd;
            display: flex;
          
            box-shadow: -2px 0 10px rgba(0,0,0,0.1);
            z-index: 100;
            height: 100%;
            transition: width 0.3s ease; /* اضافه کردن انیمیشن */
            position: relative;
        }
        .sidebar.collapsed {
    width: 80px; /* فقط عرض tab buttons */
}
.sidebar.collapsed .close-sidebar{
    opacity: 0;
}

.sidebar.collapsed .sidebar-content {
    display: none; /* پنهان کردن محتوا */
}

        .sidebar-tabs {
            width: 80px;
            background: #2c3e50;
            display: flex;
            flex-direction: column;
            padding: 20px 0;
        }

        .tab-button {
            width: 100%;
            padding: 20px 0;
            border: none;
            background: transparent;
            color: #bdc3c7;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            border-left: 3px solid transparent;
        }
        .close-sidebar{
            flex-direction: row;
            position: absolute;
            top: 5px;
            left: 5px;
             background-color: #ff9800;
             width: 30px;
             height: 30px;
             padding: 5px !important;
             border-radius: 50px;
             display: flex;
             justify-content: center;
             align-items: center;
             border-left: none;

        }
         .close-sidebar:hover{
            background-color: #da8301 !important;

         }
        .close-sidebar i{
            font-size: 14px !important;
            color: #fff;
        }

        .tab-button:hover {
            background: rgba(255, 255, 255, 0.1);
            color: white;
        }

        .tab-button.active {
            background: rgba(255, 255, 255, 0.15);
            color: #ff9800;
            border-right-color: #ff9800;
        }

        .tab-button i {
            font-size: 24px;
        }

        .tab-button span {
            font-size: 11px;
            font-weight: 500;
        }

        .sidebar-content {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
             transition: opacity 0.3s ease;
        }

        .tab-pane {
            display: none;
        }

        .tab-pane.active {
            display: block;
            animation: fadeIn 0.3s;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        /* Book Cover Tab */
        .book-cover {
            text-align: center;
        }

        .book-cover img {
            max-width: 100%;
            border-radius: 8px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
            margin-bottom: 20px;
        }

        .book-info {
            text-align: right;
            padding: 15px;
            background: #f8f9fa;
            border-radius: 8px;
        }

        .book-info h4 {
            color: #2c3e50;
            margin-bottom: 15px;
            font-size: 18px;
        }

        .book-info p {
            margin: 8px 0;
            color: #555;
            font-size: 14px;
        }

        /* Table of Contents */
        .toc-header {
            font-size: 20px;
            font-weight: bold;
            color: #2c3e50;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #ff9800;
        }

        .toc-list {
            list-style: none;
            padding: 0;
        }

        .toc-item {
            margin: 5px 0;
        }

        .toc-item-header {
            display: flex;
            align-items: center;
            padding: 10px 12px;
            background: #f8f9fa;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            gap: 10px;
        }

        .toc-item-header:hover {
            background: #e9ecef;
            transform: translateX(-3px);
        }

        .toc-item-header.active {
            background: #fff3e0;
            border-right: 3px solid #ff9800;
        }

        .toc-toggle {
            width: 20px;
            text-align: center;
            color: #666;
            transition: transform 0.3s;
        }

        .toc-toggle.expanded {
            transform: rotate(90deg);
        }

        .toc-item-title {
            flex: 1;
            color: #2c3e50;
            font-size: 14px;
        }

        .toc-item-page {
            color: #7f8c8d;
            font-size: 13px;
            min-width: 50px;
            text-align: left;
        }

        .toc-children {
            margin-right: 25px;
            margin-top: 5px;
            display: none;
            padding-right: 15px;
            border-right: 2px solid #e0e0e0;
        }

        .toc-children.expanded {
            display: block;
        }

        .toc-item.level-2 .toc-item-header {
            background: #fafafa;
            font-size: 13px;
        }

        .toc-item.level-3 .toc-item-header {
            background: #fcfcfc;
            font-size: 12px;
            padding: 8px 10px;
        }

        /* Bookmarks Tab */
        .bookmarks-container {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .bookmark-item {
            display: flex;
            align-items: center;
            padding: 12px 15px;
            background: #fff8e1;
            border-right: 4px solid #ffc107;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .bookmark-item:hover {
            background: #ffecb3;
            transform: translateX(-3px);
        }

        .bookmark-icon {
            color: #ffc107;
            font-size: 20px;
            margin-left: 12px;
        }

        .bookmark-info {
            flex: 1;
        }

        .bookmark-page {
            font-weight: bold;
            color: #f57c00;
            font-size: 13px;
            margin-bottom: 4px;
        }

        .bookmark-note {
            color: #666;
            font-size: 12px;
            display: flex;
            justify-content: space-between;
        }

        .bookmark-note i {
            font-size: 15px;
        }

        .bookmark-delete {
            background: transparent;
            border: none;
            color: #999;
            cursor: pointer;
            padding: 5px;
            transition: color 0.2s;
            margin-right: auto;
        }

        .bookmark-delete:hover {
            color: #f44336;
        }

        .empty-bookmarks {
            text-align: center;
            padding: 40px 20px;
            color: #999;
        }

        .empty-bookmarks i {
            font-size: 48px;
            margin-bottom: 15px;
            opacity: 0.5;
        }

        /* Search Tab */
        .search-container {
            margin-bottom: 20px;
        }

        .search-input-group {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
        }

        .search-input-group input {
            flex: 1;
            padding: 12px 15px;
            border: 2px solid #ddd;
            border-radius: 8px;
            font-size: 14px;
            transition: border-color 0.3s;
        }

        .search-input-group input:focus {
            outline: none;
            border-color: #ff9800;
        }

        .search-input-group button {
            padding: 12px 25px;
            background: #ff9800;
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.3s;
        }

        .search-input-group button:hover {
            background: #f57c00;
        }

        .search-results {
            max-height: 500px;
            overflow-y: auto;
        }

        .search-result-item {
            padding: 12px;
            background: #f8f9fa;
            border-radius: 6px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .search-result-item:hover {
            background: #e9ecef;
            transform: translateX(-3px);
        }

        .search-result-page {
            color: #ff9800;
            font-weight: bold;
            font-size: 12px;
            margin-bottom: 5px;
        }

        .search-result-text {
            color: #555;
            font-size: 13px;
            line-height: 1.6;
        }

        .highlight {
            background: #fff3cd;
            padding: 2px 4px;
            border-radius: 3px;
        }

        /* Notes Tab */
        .notes-container {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .note-item {
            padding: 15px;
            padding-left: 50px;
            background: #fffbf0;
            border-right: 4px solid #ff9800;
            border-radius: 6px;
            position: relative;
            transition: all 0.2s;
            cursor: pointer;
        }

        .note-item:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            transform: translateX(-2px);
        }

        .note-item-delete {
            position: absolute;
            left: 10px;
            top: 50%;
            transform: translateY(-50%);
            background: #f44336;
            color: white;
            border: none;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            opacity: 0;
        }

        .note-item:hover .note-item-delete {
            opacity: 1;
        }

        .note-item-delete:hover {
            background: #da190b;
            transform: translateY(-50%) scale(1.1);
        }

        .note-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
        }

        .note-page {
            color: #ff9800;
            font-weight: bold;
            font-size: 12px;
        }

        .note-date {
            color: #999;
            font-size: 11px;
        }

        .note-text {
            color: #555;
            font-size: 13px;
            line-height: 1.6;
        }

        /* Citations Tab */
        .citation-item {
            padding: 15px;
            background: #f8f9fa;
            border-radius: 6px;
            margin-bottom: 15px;
        }

        .citation-text {
            color: #2c3e50;
            font-size: 13px;
            line-height: 1.8;
            font-family: 'Courier New', monospace;
        }

        .citation-copy {
            margin-top: 10px;
            padding: 8px 15px;
            background: #ff9800;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 12px;
        }

        /* PDF Viewer */
        .pdf-viewer {
            flex: 1;
            background: #525659;
            display: flex;
            flex-direction: column;
            position: relative;
            height: 100%;
            overflow: auto;
        }

        .pdf-toolbar {
            background: #323639;
            padding: 12px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
            gap: 15px;
                   position: fixed;
                top: 0;
                /* right: 0; */
              left: 0;
                width: calc(100% - 400px);
                z-index: 10000;
                  transition: left 0.3s ease;
        }
        .sidebar.collapsed ~ .pdf-viewer .pdf-toolbar {
        width: calc(100% - 80px);
}
 
        .toolbar-group {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .toolbar-btn {
            background: #444;
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 5px;
            cursor: pointer;
            transition: all 0.3s;
            font-size: 14px;
        }

        .toolbar-btn:hover {
            background: #555;
        }

        .toolbar-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .toolbar-btn i {
            font-size: 16px;
        }

        .toolbar-btn.bookmarked {
            background: #ffc107;
            color: #000;
        }

        .toolbar-btn.bookmarked:hover {
            background: #ffb300;
        }

        .toolbar-btn.active {
            background: #ff9800;
        }

        .page-info {
            display: flex;
            align-items: center;
            gap: 10px;
            color: white;
            font-size: 14px;
        }

        .page-input {
            width: 60px;
            padding: 5px 10px;
            border: none;
            border-radius: 4px;
            text-align: center;
            background: #444;
            color: white;
        }

        .zoom-control {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .zoom-select {
            background: #444;
            color: white;
            border: none;
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
        }

        .pdf-canvas-container {
            flex: 1;
            overflow: auto;
            /* display: flex;
            justify-content: center;
            align-items: flex-start; */
            padding: 20px;
            padding-top: 80px;
            overflow-x: auto; /* اسکرول افقی */
    overflow-y: auto;
        }

        .pdf-pages {
            display: flex;
            flex-direction: column;
            gap: 20px;
            align-items: center;
            min-width: min-content;
            width: fit-content;
             margin: 0 auto;
        }

        .pdf-page-wrapper {
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.3);
            position: relative;
             flex-shrink: 0; /* جلوگیری از کوچک شدن */
    width: fit-content; 
        }

        .pdf-page-wrapper.double-page {
            display: flex;
            gap: 20px;
             flex-shrink: 0; /* مهم: جلوگیری از فشرده شدن */
    width: fit-content;
        }

        .pdf-page-wrapper.double-page > div {
            position: relative;
        }

        canvas {
            border: 1px solid #ddd;
            display: block;
        }

        .fullscreen-btn {
            background: #ff9800;
        }

        .fullscreen-btn:hover {
            background: #f57c00;
        }

        /* Scrollbar Styling */
        .sidebar-content::-webkit-scrollbar,
        .pdf-canvas-container::-webkit-scrollbar {
            width: 12px;
        }

        .sidebar-content::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 6px;
        }

        .sidebar-content::-webkit-scrollbar-thumb {
            background: #888;
            border-radius: 6px;
        }

        .sidebar-content::-webkit-scrollbar-thumb:hover {
            background: #555;
        }

        .pdf-canvas-container::-webkit-scrollbar-track {
            background: #3a3d40;
            border-radius: 6px;
        }

        .pdf-canvas-container::-webkit-scrollbar-thumb {
            background: #666;
            border-radius: 6px;
        }

        .pdf-canvas-container::-webkit-scrollbar-thumb:hover {
            background: #888;
        }

        /* Loading Spinner */
        .loading-spinner {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100%;
            color: white;
            font-size: 18px;
        }

        .spinner {
            border: 4px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top: 4px solid white;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin-left: 15px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .book-img {
            max-width: 100%;
            width: 150px;
        }

        /* Page Action Buttons */
        .page-actions {
            position: absolute;
            top: 0px;
            left: 0px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            z-index: 10;
            background: rgba(255, 255, 255, 0.9);
            box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        }

        .page-action-btn {
            background: transparent;
            border: none;
            color: #666;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s;
        }

        .page-action-btn:hover {
            color: #ff9800;
        }

        .page-action-btn i {
            font-size: 18px;
        }

        .page-action-btn.bookmarked {
            background: #ffc107;
            border-color: #ffc107;
            color: white;
        }

        .page-action-btn.has-note {
            background: #2196F3;
            border-color: #2196F3;
            color: white;
        }

        /* Note Modal */
        .note-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            z-index: 10000;
            align-items: center;
            justify-content: center;
        }

        .note-modal.active {
            display: flex;
        }

        .note-modal-content {
            background: white;
            border-radius: 12px;
            width: 90%;
            max-width: 600px;
            max-height: 80vh;
            overflow: hidden;
            box-shadow: 0 10px 40px rgba(0,0,0,0.3);
            animation: modalSlideIn 0.3s ease-out;
        }

        @keyframes modalSlideIn {
            from {
                opacity: 0;
                transform: translateY(-50px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .note-modal-header {
            padding: 20px;
            background: #ff9800;
            color: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .note-modal-header h3 {
            margin: 0;
            font-size: 18px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .note-modal-close {
            background: transparent;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: background 0.2s;
        }

        .note-modal-close:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .note-modal-body {
            padding: 20px;
            max-height: calc(80vh - 140px);
            overflow-y: auto;
        }

        .note-textarea {
            width: 100%;
            min-height: 200px;
            padding: 15px;
            border: 2px solid #ddd;
            border-radius: 8px;
            font-family: inherit;
            font-size: 14px;
            line-height: 1.6;
            resize: vertical;
            direction: rtl;
            transition: border-color 0.2s;
        }

        .note-textarea:focus {
            outline: none;
            border-color: #ff9800;
        }

        .note-modal-footer {
            padding: 15px 20px;
            background: #f5f5f5;
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        .note-btn {
            padding: 10px 20px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.2s;
        }

        .note-btn-save {
            background: #4CAF50;
            color: white;
        }

        .note-btn-save:hover {
            background: #45a049;
        }

        .note-btn-cancel {
            background: #f44336;
            color: white;
        }

        .note-btn-cancel:hover {
            background: #da190b;
        }

        /* Sidebar Toggle - فقط در موبایل */
        .sidebar-toggle-btn {
            display: none;
        }

        .sidebar-overlay {
            display: none;
        }

        /* Responsive - موبایل */
        @media (max-width: 991px) {
            .zoom-control{
                display:none;
            }
            html, body {
                position: fixed;
                overflow: hidden;
                width: 100%;
                height: 100%;
            }

            .main-container {
                height: 100%;
                min-height: 100vh;
                min-height: -webkit-fill-available;
            }

            .pdf-toolbar {
        
                padding: 8px 10px;
                gap: 8px;
                flex-wrap:wrap;
                width: 100%;

            }
            .sidebar.collapsed ~ .pdf-viewer .pdf-toolbar {
        width: 100%;
}

            .pdf-canvas-container {
                padding-top: 95px;
                padding-left: 10px;
                padding-right: 10px;
                padding-bottom: 10px;
                height: 100%;
            }

            .pdf-viewer {
                 flex: 1;
    background: #525659;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
            }

            .toolbar-btn {
                padding: 6px 10px;
                font-size: 12px;
            }

            .toolbar-btn i {
                font-size: 14px;
            }

            .page-info {
                font-size: 12px;
            }

            .page-input {
                width: 45px;
                padding: 4px 6px;
                font-size: 12px;
            }

            .zoom-select {
                padding: 4px 8px;
                font-size: 12px;
            }

            .toolbar-group {
                gap: 5px;
            }

            .sidebar {
                width: 320px;
                position: fixed;
                right: -320px;
                height: 100%;
                top: 0;
                bottom: 0;
                transition: right 0.3s ease;
                z-index: 10001;
                
            }

            .sidebar.show {
                right: 0;
                box-shadow: -5px 0 15px rgba(0,0,0,0.3);
            }

            .sidebar-overlay {
                display: none;
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.5);
                z-index: 10000;
            }

            .sidebar-overlay.show {
                display: block;
            }

            .sidebar-toggle-btn {
                display: flex;
                background: #ff9800;
            }

            .sidebar-toggle-btn:hover {
                background: #f57c00;
            }
        }
