/* PDF Reader Reset & Styles */


/* Reset any inherited styles */

.pdf-reader-container * {
    box-sizing: border-box;
}

.pdf-reader-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    overflow: hidden;
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
}


/* Reader Header */

.reader-header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.reader-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-back:hover {
    background: #e9ecef;
    color: #212529;
}

.document-info {
    min-width: 0;
    flex: 1;
}

.document-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

.meta-item i {
    width: 12px;
    text-align: center;
}

.reader-header-right {
    display: flex;
    align-items: center;
}


/* Reading Tools */

.reading-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.5rem;
    border-right: 1px solid #e9ecef;
    position: relative;
}

.tool-group:last-child {
    border-right: none;
}

.tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.tool-btn:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #212529;
}

.tool-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.zoom-level {
    font-size: 0.875rem;
    color: #495057;
    min-width: 40px;
    text-align: center;
}


/* Search Panel */

.search-panel {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    min-width: 300px;
    display: none;
    z-index: 200;
}

.search-panel.active {
    display: block;
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.search-input-group input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.875rem;
}

.search-input-group button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-input-group button:hover {
    background: #e9ecef;
}

.search-results {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.5rem;
}


/* Reader Content */

.reader-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}


/* Sidebar */

.reader-sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.reader-sidebar.hidden {
    margin-left: -300px;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.tab-btn:hover {
    background: #f8f9fa;
}

.tab-btn.active {
    border-bottom-color: #007bff;
    color: #007bff;
}

.sidebar-content {
    flex: 1;
    overflow: hidden;
}

.tab-panel {
    height: 100%;
    padding: 1rem;
    overflow-y: auto;
    display: none;
}

.tab-panel.active {
    display: block;
}


/* Outline */

.outline-container,
.thumbnails-container {
    height: 100%;
}

.outline-loading,
.thumbnails-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
    gap: 0.5rem;
}

.outline-item {
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.outline-item:hover {
    background: #f8f9fa;
}

.outline-item.active {
    background: #e3f2fd;
    border-left-color: #007bff;
}


/* Thumbnails */

.thumbnail-item {
    margin-bottom: 1rem;
    text-align: center;
    cursor: pointer;
}

.thumbnail-image {
    width: 100%;
    max-width: 150px;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.thumbnail-item:hover .thumbnail-image {
    border-color: #007bff;
}

.thumbnail-item.active .thumbnail-image {
    border-color: #007bff;
}

.thumbnail-page {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}


/* Bookmarks */

.bookmarks-container {
    height: 100%;
}

.bookmark-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.5rem;
}

.bookmark-item:hover {
    background: #f8f9fa;
}

.bookmark-item i {
    color: #ffc107;
}

.remove-bookmark {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 2px;
    transition: all 0.2s;
}

.remove-bookmark:hover {
    color: #dc3545;
    background: #ffeaea;
}

.no-bookmarks {
    text-align: center;
    color: #6c757d;
    padding: 2rem;
}

.no-bookmarks i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}


/* PDF Viewer */

.pdf-viewer-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #525659;
}

.pdf-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-content {
    text-align: center;
    max-width: 300px;
}

.loading-spinner {
    font-size: 2rem;
    color: #007bff;
    margin-bottom: 1rem;
}

.loading-content h3 {
    margin: 0 0 0.5rem 0;
    color: #212529;
}

.loading-content p {
    margin: 0 0 1rem 0;
    color: #6c757d;
}

.loading-progress {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #007bff;
    width: 0%;
    transition: width 0.3s ease;
}

.pdf-canvas-container {
    height: 100%;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#pdfCanvas {
    max-width: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: white;
}


/* Page Navigation */

.page-navigation {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 1rem;
    backdrop-filter: blur(10px);
}

.nav-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

#pageInput {
    width: 60px;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    text-align: center;
}

.bookmark-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.bookmark-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.bookmark-btn.active {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.2);
    border-color: #ffc107;
}


/* Help Button */

.help-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transition: all 0.2s;
    z-index: 1000;
}

.help-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
}


/* Shortcuts Help */

.shortcuts-help {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.shortcuts-help.active {
    display: flex;
}

.shortcuts-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.shortcuts-content h3 {
    margin: 0 0 1.5rem 0;
    text-align: center;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

kbd {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-family: monospace;
}

.close-shortcuts {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #6c757d;
}

.close-shortcuts:hover {
    color: #212529;
}


/* Night Mode */

.pdf-reader-container.night-mode {
    background: #1a1a1a;
}

.night-mode .reader-header {
    background: #2d2d2d;
    border-bottom-color: #404040;
    color: #e9ecef;
}

.night-mode .document-title {
    color: #e9ecef;
}

.night-mode .meta-item {
    color: #adb5bd;
}

.night-mode .tool-btn {
    color: #adb5bd;
}

.night-mode .tool-btn:hover {
    background: #404040;
    border-color: #495057;
    color: #e9ecef;
}

.night-mode .reader-sidebar {
    background: #2d2d2d;
    border-right-color: #404040;
}

.night-mode .tab-panel {
    color: #e9ecef;
}

.night-mode .pdf-viewer-container {
    background: #1a1a1a;
}


/* Responsive */

@media (max-width: 768px) {
    .reader-header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        min-height: auto;
    }
    .reader-header-left,
    .reader-header-right {
        width: 100%;
    }
    .document-title {
        font-size: 1rem;
    }
    .document-meta {
        font-size: 0.75rem;
    }
    .reading-tools {
        justify-content: flex-end;
        overflow-x: auto;
    }
    .reader-sidebar {
        width: 250px;
    }
    .reader-sidebar.hidden {
        margin-left: -250px;
    }
    .search-panel {
        right: auto;
        left: 0;
        min-width: 250px;
    }
    .page-navigation {
        bottom: 1rem;
        padding: 0.5rem 0.75rem;
        gap: 0.75rem;
    }
    .nav-btn {
        width: 32px;
        height: 32px;
    }
    .help-btn {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .reader-sidebar {
        width: 100%;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 150;
    }
    .reader-sidebar.hidden {
        margin-left: -100%;
    }
    .shortcuts-content {
        margin: 1rem;
        padding: 1.5rem;
        max-height: calc(100vh - 2rem);
    }
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
}
