/* =========================================================================
   Premium PDF Viewer Styles - R. G. Shah Science College
   Colors: Primary #0F2A4C | Secondary #D6AD60 | Cream #F7F3EA | Text #344054 | Highlight #3987C9
   ========================================================================= */

.pdf-viewer-section {
    /*background-color: #F7F3EA;*/
    padding-top: 120px;
    padding-bottom: 120px;
    position: relative;
}

.pdf-viewer-card {
    background-color: var(--white, #FFFFFF);
    border-radius: 16px 0;
    border: 1px solid #ECE7DB;
    box-shadow: 0 10px 35px rgba(15, 42, 76, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 750px;
    transition: box-shadow 0.3s ease;
}

/* =========================================================================
   Viewer Toolbar
   ========================================================================= */
.pdf-toolbar {
    background-color: var(--primary-color, #0F2A4C);
    color: var(--white, #FFFFFF);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 3px solid var(--secondary-color, #D6AD60);
    z-index: 10;
}

.pdf-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pdf-toolbar-left {
    flex: 1 1 auto;
    min-width: 180px;
}

.pdf-toolbar-center {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.pdf-toolbar-right {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pdf-toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

/* Document Meta in Toolbar */
.pdf-doc-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-doc-icon {
    color: var(--secondary-color, #D6AD60);
    font-size: 18px;
    flex-shrink: 0;
}

.pdf-doc-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--white, #FFFFFF);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Toolbar Buttons */
.pdf-btn {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--white, #FFFFFF);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    text-decoration: none;
    line-height: 1;
}

.pdf-btn:hover:not(:disabled) {
    background-color: var(--secondary-color, #D6AD60);
    color: var(--primary-color, #0F2A4C);
    border-color: var(--secondary-color, #D6AD60);
}

.pdf-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pdf-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.pdf-btn-primary {
    background-color: var(--secondary-color, #D6AD60);
    color: var(--primary-color, #0F2A4C);
    border-color: var(--secondary-color, #D6AD60);
    padding: 8px 16px;
    height: 36px;
}

.pdf-btn-primary:hover {
    background-color: #e5bd6d;
    color: var(--primary-color, #0F2A4C);
    box-shadow: 0 4px 12px rgba(214, 173, 96, 0.35);
}

/* Page Navigation Inputs */
.pdf-nav-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pdf-page-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 13.5px;
    color: var(--white, #FFFFFF);
    font-weight: 600;
}

.pdf-page-input {
    width: 42px;
    height: 28px;
    background-color: transparent;
    border: none;
    color: var(--secondary-color, #D6AD60);
    text-align: center;
    font-weight: 700;
    font-size: 13.5px;
    padding: 0;
    outline: none;
}

.pdf-page-input::-webkit-outer-spin-button,
.pdf-page-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pdf-page-input[type=number] {
    -moz-appearance: textfield;
}

.pdf-page-separator {
    color: rgba(255, 255, 255, 0.5);
}

/* Zoom Controls */
.pdf-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pdf-zoom-level {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white, #FFFFFF);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 700;
    padding: 0 10px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.pdf-zoom-level:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--secondary-color, #D6AD60);
}

/* =========================================================================
   Viewer Body (Sidebar + Viewport)
   ========================================================================= */
.pdf-body-wrapper {
    display: flex;
    position: relative;
    flex: 1;
    min-height: 650px;
    background-color: #525659; /* Standard document reader backdrop */
    overflow: hidden;
}

/* Collapsible Sidebar */
.pdf-sidebar {
    width: 220px;
    background-color: #2b3035;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, margin-left 0.3s ease, width 0.3s ease;
    margin-left: -220px; /* Hidden by default until toggled or on wide desktop */
    z-index: 5;
    flex-shrink: 0;
}

.pdf-viewer-card.sidebar-open .pdf-sidebar {
    margin-left: 0;
}

.pdf-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background-color: #22262a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pdf-sidebar-heading {
    font-size: 13px;
    font-weight: 700;
    color: var(--secondary-color, #D6AD60);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pdf-sidebar-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
}

.pdf-sidebar-close:hover {
    color: var(--white, #FFFFFF);
}

.pdf-thumbnails-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pdf-thumb-item {
    cursor: pointer;
    text-align: center;
    padding: 6px;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    transition: all 0.25s ease;
}

.pdf-thumb-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(214, 173, 96, 0.4);
}

.pdf-thumb-item.active {
    background-color: rgba(214, 173, 96, 0.15);
    border-color: var(--secondary-color, #D6AD60);
}

.pdf-thumb-canvas {
    width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    background-color: #FFFFFF;
}

.pdf-thumb-label {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.pdf-thumb-item.active .pdf-thumb-label {
    color: var(--secondary-color, #D6AD60);
    font-weight: 700;
}

/* =========================================================================
   Main Viewport & Canvas Area
   ========================================================================= */
.pdf-viewport {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 20px;
    position: relative;
    background-color: #525659;
}

.pdf-canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    max-width: 100%;
    transition: transform 0.2s ease;
}

.pdf-canvas {
    display: block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    background-color: #FFFFFF;
    max-width: 100%;
    height: auto;
}

/* =========================================================================
   Overlays (Loading & Error)
   ========================================================================= */
.pdf-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(15, 42, 76, 0.92);
    z-index: 20;
    color: var(--white, #FFFFFF);
    padding: 24px;
    text-align: center;
}

.pdf-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(214, 173, 96, 0.2);
    border-top-color: var(--secondary-color, #D6AD60);
    border-radius: 50%;
    animation: pdfSpin 0.9s linear infinite;
    margin-bottom: 16px;
}

@keyframes pdfSpin {
    to { transform: rotate(360deg); }
}

.pdf-loading-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--secondary-color, #D6AD60);
    margin: 0;
}

.pdf-error-overlay {
    background-color: rgba(15, 42, 76, 0.96);
}

.pdf-error-icon {
    font-size: 42px;
    color: #e57373;
    margin-bottom: 14px;
}

.pdf-error-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--white, #FFFFFF);
    margin-bottom: 8px;
}

.pdf-error-desc {
    font-size: 14.5px;
    color: rgba(255, 255, 255, 0.8);
    max-width: 420px;
    margin-bottom: 16px;
}

/* Fullscreen Mode */
.pdf-viewer-card:fullscreen {
    border-radius: 0;
    border: none;
    width: 100vw;
    height: 100vh;
}

.pdf-viewer-card:-webkit-full-screen {
    border-radius: 0;
    border: none;
    width: 100vw;
    height: 100vh;
}

/* 404 / Document Unavailable Card */
.pdf-unavailable-card {
    background-color: var(--white, #FFFFFF);
    border-radius: 16px 0;
    border: 1px solid #ECE7DB;
    padding: 50px 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(15, 42, 76, 0.06);
    max-width: 640px;
    margin: 40px auto;
}

.pdf-unavailable-icon {
    font-size: 50px;
    color: var(--secondary-color, #D6AD60);
    margin-bottom: 20px;
    display: inline-block;
}

.pdf-unavailable-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color, #0F2A4C);
    margin-bottom: 12px;
}

.pdf-unavailable-desc {
    font-size: 15.5px;
    color: var(--body-text, #344054);
    line-height: 1.7;
    margin-bottom: 24px;
}

/* =========================================================================
   Responsive Breakpoints
   ========================================================================= */
@media (max-width: 991px) {
    .pdf-toolbar {
        padding: 10px 14px;
    }

    .pdf-doc-meta {
        max-width: 200px;
    }

    .pdf-viewport {
        padding: 20px 10px;
    }

    .pdf-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    }
}

@media (max-width: 767px) {
    .pdf-viewer-section {
        padding-top: 30px;
        padding-bottom: 45px;
    }

    .pdf-toolbar {
        gap: 8px;
    }

    .pdf-doc-meta {
        display: none; /* Hide document title on phone to give space to controls */
    }

    .pdf-toolbar-left {
        min-width: auto;
    }

    .pdf-toolbar-center {
        order: 2;
        width: 100%;
        justify-content: space-between;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .pdf-toolbar-right {
        order: 1;
        margin-left: auto;
    }

    .pdf-btn-icon {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .pdf-btn-primary {
        height: 32px;
        padding: 4px 10px;
        font-size: 12px;
    }

    .pdf-page-indicator {
        padding: 2px 6px;
        font-size: 12px;
    }

    .pdf-page-input {
        width: 32px;
        height: 24px;
        font-size: 12px;
    }

    .pdf-zoom-level {
        height: 32px;
        font-size: 11px;
        padding: 0 6px;
    }

    .pdf-viewport {
        padding: 14px 6px;
    }
}

