/**
 * CSS cho PDF.js Viewer tuần tự
 */

.pdf-sequential-viewer {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    position: relative;
    overflow: hidden;
    font-family: Arial, sans-serif;
}


/* Thanh công cụ */

.pdfjs-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background-color: #2c3e50;
    color: white;
    border-bottom: 1px solid #ddd;
    height: 50px;
}

.pdfjs-toolbar button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.pdfjs-toolbar button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.pdfjs-toolbar button i {
    margin-right: 5px;
}


/* Điều hướng trang */

.pdfjs-page-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdfjs-page-info-container {
    display: flex;
    align-items: center;
    min-width: 120px;
    text-align: center;
}

.pdfjs-page-input-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 2px 8px;
}

.pdfjs-page-input {
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: bold;
    width: 40px;
    text-align: center;
    outline: none;
}

.pdfjs-page-input::-webkit-outer-spin-button,
.pdfjs-page-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pdfjs-page-input[type=number] {
    -moz-appearance: textfield;
}

.pdfjs-total-pages {
    color: white;
    font-size: 14px;
    margin-left: 2px;
}

.pdfjs-page-info {
    font-size: 14px;
    min-width: 100px;
    text-align: center;
}


/* Điều khiển zoom */

.pdfjs-zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 15px;
}

.pdfjs-zoom-info {
    font-size: 14px;
    min-width: 55px;
    text-align: center;
    font-weight: bold;
}

.pdfjs-zoom-out-button i,
.pdfjs-zoom-in-button i,
.pdfjs-zoom-reset-button i {
    margin: 0;
    font-size: 16px;
}


/* Container chứa các trang */

.pdfjs-pages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: block;
    background-color: #f0f0f0;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    height: calc(100% - 50px);
    /* Chiều cao = 100% - chiều cao toolbar */
}


/* Container bọc mỗi trang PDF */

.pdfjs-page-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    transition: transform 0.2s ease-in-out;
}


/* Từng trang PDF */

.pdfjs-page {
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    width: auto;
    min-width: 1000px;
    max-width: none;
    display: block;
    padding: 0;
    transition: width 0.2s ease-in-out;
}

.pdfjs-page canvas {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
}


/* Thông báo lỗi khi không tải được trang */

.pdfjs-page-error {
    padding: 20px;
    text-align: center;
    color: red;
    background-color: #fff3f3;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}


/* Nút thử lại */

.pdfjs-retry-button {
    margin-top: 15px;
    padding: 8px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background-color 0.2s;
}

.pdfjs-retry-button:hover {
    background-color: #2980b9;
}

.pdfjs-retry-button i {
    margin-right: 5px;
}


/* Thanh tiến trình */

.pdfjs-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 20px;
    z-index: 20;
}

.pdfjs-progress-bar {
    height: 4px;
    background-color: #3498db;
    width: 0%;
    transition: width 0.3s;
    margin-bottom: 5px;
}

.pdfjs-progress-text {
    font-size: 12px;
    text-align: center;
}


/* Hiệu ứng loading */

@keyframes pdfjs-pulse {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

.pdfjs-loading {
    animation: pdfjs-pulse 1.5s infinite;
    background-color: #f0f0f0;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}


/* Chế độ toàn màn hình */

.pdf-sequential-viewer:fullscreen {
    background-color: #f0f0f0;
}

.pdf-sequential-viewer:fullscreen .pdfjs-pages-container {
    height: calc(100vh - 50px);
}


/* Responsive */

@media (max-width: 768px) {
    .pdfjs-toolbar {
        padding: 8px;
    }
    .pdfjs-back-button span {
        display: none;
    }
    .pdfjs-zoom-controls {
        margin: 0 5px;
        gap: 5px;
    }
    .pdfjs-zoom-info {
        min-width: 40px;
        font-size: 12px;
    }
    .pdfjs-toolbar button {
        padding: 4px 6px;
    }
    .pdfjs-pages-container {
        padding: 10px;
    }
    .pdfjs-page-wrapper {
        margin-bottom: 10px;
    }
    .pdfjs-page {
        min-width: 100%;
    }
    .pdfjs-page-error {
        height: 150px;
        padding: 15px;
        font-size: 12px;
    }
    .pdfjs-retry-button {
        padding: 6px 12px;
        font-size: 12px;
    }
}

#PdfCanvatContainer {
    border-radius: 8px;
    gap: 8px;
    margin-top: 20px;
    height: calc(100vh - 100px);
}

@media screen and (max-width: 800px) {
    #PdfCanvatContainer {
        margin-top: 0;
        height: calc(100vh - 60px);
    }
    /* Mobile-specific PDF viewer styles */
    .mobile-viewer .mobile-toolbar {
        padding: 10px 15px;
        background: #f8f9fa;
        border-bottom: 1px solid #dee2e6;
        display: flex !important;
        align-items: center;
        position: relative;
        z-index: 100;
        min-height: 50px;
    }

    .mobile-viewer .mobile-back-btn {
        padding: 8px 16px;
        background: #6c757d;
        color: white;
        border: none;
        border-radius: 6px;
        font-size: 14px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .mobile-viewer .mobile-back-btn:hover {
            background: #5a6268;
        }
    /* Fallback cho mobile toolbar nếu không có mobile-viewer class */
    .mobile-toolbar {
        padding: 10px 15px !important;
        background: #f8f9fa !important;
        border-bottom: 1px solid #dee2e6 !important;
        display: flex !important;
        align-items: center !important;
        min-height: 50px !important;
    }

    .mobile-back-btn {
        padding: 8px 16px !important;
        background: #6c757d !important;
        color: white !important;
        border: none !important;
        border-radius: 6px !important;
        font-size: 14px !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }
    /* Mobile bottom navigation */
    .mobile-bottom-navigation {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid #dee2e6;
        padding: 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }

        .mobile-bottom-navigation .mobile-nav-btn {
            padding: 10px;
            font-size: 15px;
            font-weight: 600;
            border-radius: 12px;
            background: #ed1d26;
            color: white;
            border: none;
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 100px;
            justify-content: center;
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
        }

            .mobile-bottom-navigation .mobile-nav-btn:active {
                transform: translateY(1px);
                box-shadow: 0 1px 4px rgba(0, 123, 255, 0.4);
            }

            .mobile-bottom-navigation .mobile-nav-btn:disabled {
                background: #6c757d;
                cursor: not-allowed;
                transform: none;
                box-shadow: none;
            }

        .mobile-bottom-navigation .mobile-page-info {
            background: #f8f9fa;
            padding: 8px 15px;
            border-radius: 10px;
            text-align: center;
            border: 1px solid #dee2e6;
            min-width: 120px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .mobile-bottom-navigation .mobile-page-input-container {
            display: flex;
            align-items: center;
            background: transparent;
        }

        .mobile-bottom-navigation .mobile-page-input {
            background: transparent;
            border: none;
            color: #ed1d26;
            font-size: 18px;
            font-weight: bold;
            width: 50px;
            text-align: center;
            outline: none;
            padding: 0;
            border-radius: 4px;
            transition: all 0.3s ease;
        }

        .mobile-bottom-navigation .mobile-page-input:focus {
            background: white;
            border: 2px solid #ed1d26;
            padding: 2px;
            box-shadow: 0 0 0 3px rgba(237, 29, 38, 0.1);
        }

        .mobile-bottom-navigation .mobile-page-input::-webkit-outer-spin-button,
        .mobile-bottom-navigation .mobile-page-input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        .mobile-bottom-navigation .mobile-page-input[type=number] {
            -moz-appearance: textfield;
        }

        .mobile-bottom-navigation .mobile-total-pages {
            color: #6c757d;
            font-size: 14px;
            margin-left: 2px;
        }
    /* Điều chỉnh container cho mobile để tránh che navigation */
    .mobile-viewer .pdfjs-pages-container {
        padding: 0;
        padding-bottom: 120px; /* Space for bottom navigation */
    }
    /* Mobile loading message */
    .mobile-loading-message {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%;
        background: #f8f9fa;
    }

        .mobile-loading-message .loading-content {
            text-align: center;
            padding: 40px 20px;
        }

        .mobile-loading-message .loading-spinner {
            width: 40px;
            height: 40px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid #ed1d26;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        .mobile-loading-message p {
            font-size: 16px;
            color: #6c757d;
            margin: 0;
        }

    @@keyframes spin {
        0% {
            transform: rotate(0deg);
        }

        100% {
            transform: rotate(360deg);
        }
    }
}

.zalo-chat-widget {
    display: none !important;
}