/* ========================================
   MODERN PDF VIEWER STYLES
   Professional, Minimalist Design
   ======================================== */

/* PDF Viewer Modal Container */
#documentViewerModal.modal {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 100000 !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

/* Modern PDF Viewer Content */
.pdf-viewer-modern {
    max-width: 95vw;
    width: 1400px;
    max-height: 95vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 100001;
    /* Override base modal-content styles */
    opacity: 1 !important;
    animation: pdfViewerFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
    width: 1400px !important;
    max-width: 95vw !important;
}

/* Custom fade-in animation */
@keyframes pdfViewerFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ========================================
   HEADER SECTION
   ======================================== */

.pdf-viewer-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 28px;
    border-bottom: none;
    border-radius: 16px 16px 0 0;
}

.pdf-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pdf-title-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pdf-icon {
    font-size: 32px;
    color: #ffffff;
    opacity: 0.9;
}

.pdf-title-info h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
}

.pdf-subtitle {
    display: block;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 4px;
    font-weight: 400;
}

.pdf-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pdf-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.pdf-close-btn i {
    font-size: 18px;
}

/* ========================================
   CONTROLS BAR
   ======================================== */

.pdf-controls-bar {
    background: #f8fafc;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid #e2e8f0;
}

/* Navigation Section */
.pdf-nav-section {
    flex: 1;
}

.nav-group-modern {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn-modern {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.nav-btn-modern:hover {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.nav-btn-modern:active {
    transform: translateY(0);
}

/* Page Navigation */
.page-navigation-modern {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.page-input-modern {
    width: 60px;
    border: none;
    background: #f8fafc;
    padding: 6px 10px;
    border-radius: 6px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    outline: none;
    transition: background 0.2s ease;
}

.page-input-modern:focus {
    background: #f1f5f9;
}

.page-separator {
    color: #94a3b8;
    font-weight: 500;
    font-size: 14px;
}

.total-pages-modern {
    color: #64748b;
    font-weight: 600;
    font-size: 15px;
    min-width: 30px;
    text-align: left;
}

/* Tools Section */
.pdf-tools-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zoom-control-modern {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.zoom-icon {
    color: #667eea;
    font-size: 16px;
}

.zoom-select-modern {
    border: none;
    background: transparent;
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.zoom-select-modern:hover {
    background: #f8fafc;
}

/* ========================================
   PDF CANVAS DISPLAY
   ======================================== */

.pdf-viewer-body {
    flex: 1;
    overflow: auto;
    background: #f1f5f9;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-wrapper-modern {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
}

.canvas-wrapper-modern canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* ========================================
   ACTION BAR
   ======================================== */

.pdf-action-bar {
    background: #f8fafc;
    padding: 20px 28px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.pdf-action-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pdf-action-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Fit Option Group */
.fit-option-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.fit-label-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.fit-label-modern i {
    color: #667eea;
    font-size: 14px;
}

.fit-select-modern {
    border: none;
    background: #f8fafc;
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.fit-select-modern:hover {
    background: #f1f5f9;
}

/* Button Styles */
.btn-primary-modern {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary-modern:active {
    transform: translateY(-1px);
}

.btn-primary-modern i {
    font-size: 16px;
}

.btn-secondary-modern {
    background: #ffffff;
    color: #64748b;
    border: 2px solid #e2e8f0;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary-modern:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-secondary-modern:active {
    transform: translateY(-1px);
}

.btn-secondary-modern i {
    font-size: 16px;
}

.btn-success-modern {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-success-modern:active {
    transform: translateY(-1px);
}

.btn-success-modern i {
    font-size: 16px;
}

.btn-info-modern {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-info-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.btn-info-modern:active {
    transform: translateY(-1px);
}

.btn-info-modern i {
    font-size: 16px;
}

/* Import Range Group - Inline Layout */
.import-range-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-inputs-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

/* Pulse animation for range inputs */
@keyframes pulseRange {

    0%,
    100% {
        transform: scale(1);
        border-color: #e2e8f0;
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }

    50% {
        transform: scale(1.05);
        border-color: #3b82f6;
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.2);
    }
}

.range-inputs-inline.pulse {
    animation: pulseRange 0.6s ease-in-out 3;
}

/* Page Range Inputs */
.page-range-input {
    width: 70px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    padding: 8px 10px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s ease;
}

/* Ensure number input spinners are visible */
.page-range-input::-webkit-inner-spin-button,
.page-range-input::-webkit-outer-spin-button {
    opacity: 1;
    height: 100%;
}

.page-range-input:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.page-range-input:focus {
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.page-range-separator {
    color: #94a3b8;
    font-weight: 600;
    font-size: 14px;
    padding: 0 8px;
}

/* ========================================
   DARK THEME SUPPORT
   ======================================== */

#documentViewerModal.dark-theme .pdf-viewer-modern {
    background: #1e293b;
}

#documentViewerModal.dark-theme .pdf-viewer-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

#documentViewerModal.dark-theme .pdf-controls-bar {
    background: #0f172a;
    border-bottom-color: #334155;
}

#documentViewerModal.dark-theme .nav-btn-modern {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

#documentViewerModal.dark-theme .nav-btn-modern:hover {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
}

#documentViewerModal.dark-theme .page-navigation-modern {
    background: #1e293b;
    border-color: #334155;
}

#documentViewerModal.dark-theme .page-input-modern {
    background: #0f172a;
    color: #f1f5f9;
}

#documentViewerModal.dark-theme .page-separator,
#documentViewerModal.dark-theme .total-pages-modern {
    color: #94a3b8;
}

#documentViewerModal.dark-theme .zoom-control-modern {
    background: #1e293b;
    border-color: #334155;
}

#documentViewerModal.dark-theme .zoom-icon {
    color: #818cf8;
}

#documentViewerModal.dark-theme .zoom-select-modern {
    color: #f1f5f9;
}

#documentViewerModal.dark-theme .pdf-viewer-body {
    background: #0f172a;
}

#documentViewerModal.dark-theme .canvas-wrapper-modern {
    background: #1e293b;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

#documentViewerModal.dark-theme .pdf-action-bar {
    background: #0f172a;
    border-top-color: #334155;
}

#documentViewerModal.dark-theme .btn-secondary-modern {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

#documentViewerModal.dark-theme .btn-secondary-modern:hover {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

#documentViewerModal.dark-theme .fit-option-group {
    background: #1e293b;
    border-color: #334155;
}

#documentViewerModal.dark-theme .fit-label-modern {
    color: #94a3b8;
}

#documentViewerModal.dark-theme .fit-label-modern i {
    color: #818cf8;
}

#documentViewerModal.dark-theme .fit-select-modern {
    background: #0f172a;
    color: #f1f5f9;
}

#documentViewerModal.dark-theme .fit-select-modern:hover {
    background: #1e293b;
}

#documentViewerModal.dark-theme .page-range-input {
    background: #0f172a;
    color: #f1f5f9;
}

#documentViewerModal.dark-theme .page-range-input:hover,
#documentViewerModal.dark-theme .page-range-input:focus {
    background: #1e293b;
}

#documentViewerModal.dark-theme .page-range-separator {
    color: #64748b;
}

/* ========================================
   BLACK THEME SUPPORT
   ======================================== */

#documentViewerModal.black-theme .pdf-viewer-modern {
    background: #000000;
}

#documentViewerModal.black-theme .pdf-viewer-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

#documentViewerModal.black-theme .pdf-controls-bar {
    background: #0a0a0a;
    border-bottom-color: #1a1a1a;
}

#documentViewerModal.black-theme .nav-btn-modern {
    background: #1a1a1a;
    border-color: #2d2d2d;
    color: #888888;
}

#documentViewerModal.black-theme .nav-btn-modern:hover {
    background: #2d2d2d;
    border-color: #3d3d3d;
    color: #ffffff;
}

#documentViewerModal.black-theme .page-navigation-modern {
    background: #1a1a1a;
    border-color: #2d2d2d;
}

#documentViewerModal.black-theme .page-input-modern {
    background: #0a0a0a;
    color: #ffffff;
}

#documentViewerModal.black-theme .page-separator,
#documentViewerModal.black-theme .total-pages-modern {
    color: #888888;
}

#documentViewerModal.black-theme .zoom-control-modern {
    background: #1a1a1a;
    border-color: #2d2d2d;
}

#documentViewerModal.black-theme .zoom-icon {
    color: #666666;
}

#documentViewerModal.black-theme .zoom-select-modern {
    color: #ffffff;
}

#documentViewerModal.black-theme .pdf-viewer-body {
    background: #0a0a0a;
}

#documentViewerModal.black-theme .canvas-wrapper-modern {
    background: #1a1a1a;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
}

#documentViewerModal.black-theme .pdf-action-bar {
    background: #0a0a0a;
    border-top-color: #1a1a1a;
}

#documentViewerModal.black-theme .btn-secondary-modern {
    background: #1a1a1a;
    border-color: #2d2d2d;
    color: #888888;
}

#documentViewerModal.black-theme .btn-secondary-modern:hover {
    background: #2d2d2d;
    border-color: #3d3d3d;
    color: #ffffff;
}

#documentViewerModal.black-theme .fit-option-group {
    background: #1a1a1a;
    border-color: #2d2d2d;
}

#documentViewerModal.black-theme .fit-label-modern {
    color: #888888;
}

#documentViewerModal.black-theme .fit-label-modern i {
    color: #666666;
}

#documentViewerModal.black-theme .fit-select-modern {
    background: #0a0a0a;
    color: #ffffff;
}

#documentViewerModal.black-theme .fit-select-modern:hover {
    background: #1a1a1a;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .pdf-viewer-modern {
        max-width: 98vw;
        max-height: 98vh;
        border-radius: 12px;
    }

    .pdf-viewer-header {
        padding: 16px 20px;
    }

    .pdf-title-info h3 {
        font-size: 18px;
    }

    .pdf-icon {
        font-size: 24px;
    }

    .pdf-controls-bar {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }

    .pdf-nav-section,
    .pdf-tools-section {
        width: 100%;
    }

    .nav-group-modern {
        justify-content: center;
    }

    .pdf-viewer-body {
        padding: 16px;
    }

    .canvas-wrapper-modern {
        padding: 12px;
    }

    .pdf-action-bar {
        padding: 16px 20px;
        flex-direction: column;
        gap: 16px;
    }

    .pdf-action-left,
    .pdf-action-right {
        width: 100%;
        flex-direction: column;
    }

    .fit-option-group {
        width: 100%;
        justify-content: space-between;
    }

    .btn-primary-modern,
    .btn-secondary-modern,
    .btn-success-modern {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
    }
}

@media (max-width: 480px) {
    .nav-btn-modern {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }

    .page-input-modern {
        width: 50px;
        font-size: 14px;
    }

    .pdf-title-info h3 {
        font-size: 16px;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

.pdf-viewer-body::-webkit-scrollbar,
.canvas-wrapper-modern::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.pdf-viewer-body::-webkit-scrollbar-track,
.canvas-wrapper-modern::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 5px;
}

.pdf-viewer-body::-webkit-scrollbar-thumb,
.canvas-wrapper-modern::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
}

.pdf-viewer-body::-webkit-scrollbar-thumb:hover,
.canvas-wrapper-modern::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Dark theme scrollbar */
#documentViewerModal.dark-theme .pdf-viewer-body::-webkit-scrollbar-track,
#documentViewerModal.dark-theme .canvas-wrapper-modern::-webkit-scrollbar-track {
    background: #0f172a;
}

#documentViewerModal.dark-theme .pdf-viewer-body::-webkit-scrollbar-thumb,
#documentViewerModal.dark-theme .canvas-wrapper-modern::-webkit-scrollbar-thumb {
    background: #334155;
}

#documentViewerModal.dark-theme .pdf-viewer-body::-webkit-scrollbar-thumb:hover,
#documentViewerModal.dark-theme .canvas-wrapper-modern::-webkit-scrollbar-thumb:hover {
    background: #475569;
}