/**
 * ============================================================================
 * Premium PDF Viewer Stylesheet
 * G.B. Shah College for Technology and Management
 *
 * Theme Palette:
 * - Primary:                 #1c2f4d (Deep Navy)
 * - Secondary:               #37acb6 (Teal)
 * - Light Background:        #f3f6f8
 * - Surface White:           #ffffff
 * - Body Text:               #344054
 * ============================================================================
 */

/* ============================================================================
   1. Page Layout & Section
   ============================================================================ */
.pdf-page-section {
    background-color: #f3f6f8;
    padding: 90px 0;
    min-height: calc(100vh - 420px);
    width: 100%;
    position: relative;
}

/* ============================================================================
   2. Document Information Header Card
   ============================================================================ */
.pdf-doc-header-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(28, 47, 77, 0.05);
    padding: 24px 28px;
    margin-bottom: 24px;
    transition: box-shadow 0.3s ease;
}

.pdf-doc-header-card:hover {
    box-shadow: 0 6px 26px rgba(28, 47, 77, 0.08);
}

.pdf-doc-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.pdf-doc-meta-left {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1 1 500px;
}

.pdf-doc-badge-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    background-color: #eaf6f7;
    color: #37acb6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(55, 172, 182, 0.15);
}

.pdf-doc-badge-icon i {
    line-height: 1;
}

.pdf-doc-title-wrap {
    flex: 1;
    min-width: 0;
}

.pdf-doc-title {
    color: #1c2f4d;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px 0;
    line-height: 1.35;
    font-family: 'texgyreadventorbold', 'Roboto', sans-serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.pdf-doc-meta-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pdf-meta-pill {
    font-size: 12px;
    color: #475569;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 3px 10px;
    border-radius: 16px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1.4;
}

.pdf-meta-pill i {
    color: #37acb6;
    font-size: 11px;
}

.pdf-doc-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pdf-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
    cursor: pointer;
}

.pdf-btn-download {
    background-color: #1c2f4d;
    color: #ffffff;
    border: 1px solid #1c2f4d;
}

.pdf-btn-download:hover,
.pdf-btn-download:focus {
    background-color: #37acb6;
    border-color: #37acb6;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(55, 172, 182, 0.25);
}

.pdf-btn-open {
    background-color: #ffffff;
    color: #1c2f4d;
    border: 1px solid #cbd5e1;
}

.pdf-btn-open:hover,
.pdf-btn-open:focus {
    background-color: #f8fafc;
    border-color: #37acb6;
    color: #37acb6;
    text-decoration: none;
    transform: translateY(-1px);
}

/* ============================================================================
   3. Main PDF Viewer Card & Integrated Toolbar
   ============================================================================ */
.pdf-viewer-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 6px 28px rgba(28, 47, 77, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow 0.3s ease;
}

/* Integrated Custom Toolbar */
.pdf-viewer-toolbar {
    background: #1c2f4d;
    color: #ffffff;
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.pdf-tb-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.4;
    text-decoration: none;
}

.pdf-tb-btn:hover:not(:disabled) {
    background-color: #37acb6;
    border-color: #37acb6;
    color: #ffffff;
    text-decoration: none;
}

.pdf-tb-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.pdf-tb-page-info {
    font-size: 13px;
    color: #e2e8f0;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 4px;
}

.pdf-tb-page-input {
    width: 44px;
    height: 28px;
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border-radius: 4px;
    padding: 2px 4px;
    font-weight: 600;
    font-size: 13px;
    -moz-appearance: textfield;
}

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

.pdf-tb-page-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: #37acb6;
}

.pdf-tb-zoom-label {
    font-size: 12.5px;
    color: #cbd5e1;
    font-weight: 600;
    min-width: 46px;
    text-align: center;
    display: inline-block;
}

.pdf-tb-download {
    background-color: rgba(55, 172, 182, 0.35);
    border-color: rgba(55, 172, 182, 0.6);
}

.pdf-tb-download:hover {
    background-color: #37acb6 !important;
    border-color: #37acb6 !important;
}

/* ============================================================================
   4. Viewer Stage & Canvas
   ============================================================================ */
.pdf-stage-wrap {
    background-color: #43484e;
    padding: 30px 16px;
    min-height: 680px;
    max-height: 1200px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pdf-canvas-container {
    display: inline-block;
    position: relative;
    margin: 0 auto;
    transition: transform 0.15s ease;
}

#pdfCanvas {
    display: block;
    margin: 0 auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    border-radius: 4px;
    max-width: 100%;
    height: auto;
    background-color: #ffffff;
}

/* ============================================================================
   5. Loading, Error & Empty State Overlays
   ============================================================================ */
.pdf-overlay-box {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.96);
    z-index: 20;
    padding: 30px;
    text-align: center;
}

#pdfErrorOverlay {
    display: none;
}

.pdf-pill-hidden {
    display: none;
}

.pdf-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #37acb6;
    border-radius: 50%;
    animation: pdfSpin 0.9s linear infinite;
    margin-bottom: 16px;
}

@keyframes pdfSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.pdf-loading-text {
    font-size: 16px;
    color: #1c2f4d;
    font-weight: 600;
    margin-bottom: 4px;
}

.pdf-loading-subtext {
    font-size: 13px;
    color: #64748b;
}

.pdf-error-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #fee2e2;
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}

.pdf-error-heading {
    font-size: 20px;
    color: #1c2f4d;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: 'texgyreadventorbold', 'Roboto', sans-serif;
}

.pdf-error-message {
    font-size: 14.5px;
    color: #475569;
    max-width: 480px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

/* Native Fallback Frame */
.pdf-native-fallback-frame {
    width: 100%;
    height: 700px;
    border: none;
    display: block;
}

/* Empty Page / Missing Document Card */
.pdf-empty-state-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(28, 47, 77, 0.05);
    padding: 60px 30px;
    text-align: center;
}

.pdf-empty-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background-color: #fef3c7;
    color: #d97706;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
}

.pdf-empty-heading {
    font-size: 22px;
    color: #1c2f4d;
    font-weight: 700;
    margin-bottom: 10px;
    font-family: 'texgyreadventorbold', 'Roboto', sans-serif;
}

.pdf-empty-message {
    font-size: 15px;
    color: #64748b;
    max-width: 520px;
    margin: 0 auto 26px;
    line-height: 1.6;
}

.pdf-empty-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================================
   6. Fullscreen Mode
   ============================================================================ */
.pdf-viewer-card.is-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    border-radius: 0 !important;
    border: none !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
}

.pdf-viewer-card.is-fullscreen .pdf-stage-wrap {
    max-height: calc(100vh - 54px) !important;
    height: calc(100vh - 54px) !important;
    min-height: calc(100vh - 54px) !important;
}

/* ============================================================================
   7. Responsive Adaptations
   ============================================================================ */
/* Tablet (<= 991px) */
@media (max-width: 991px) {
    .pdf-page-section {
        padding: 35px 0 55px 0;
    }

    .pdf-doc-header-card {
        padding: 20px;
    }

    .pdf-stage-wrap {
        padding: 20px 10px;
        min-height: 550px;
    }
}

/* Mobile Devices (<= 767px) */
@media (max-width: 767px) {
    .pdf-page-section {
        padding: 25px 0 45px 0;
    }

    .pdf-doc-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .pdf-doc-meta-left {
        width: 100%;
        flex: 1 1 100%;
        gap: 14px;
    }

    .pdf-doc-badge-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

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

    .pdf-doc-actions-right {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .pdf-action-btn {
        flex: 1;
        justify-content: center;
        padding: 9px 12px;
        font-size: 12.5px;
    }

    .pdf-viewer-toolbar {
        padding: 8px 12px;
        justify-content: center;
        gap: 8px;
    }

    .pdf-tb-btn {
        padding: 5px 9px;
        font-size: 12px;
    }

    .pdf-tb-btn .pdf-btn-label {
        display: none;
    }

    .pdf-stage-wrap {
        padding: 16px 8px;
        min-height: 480px;
    }
}

/* Small Mobile (320px - 360px) */
@media (max-width: 360px) {
    .pdf-doc-header-card {
        padding: 16px 12px;
    }

    .pdf-doc-title {
        font-size: 16.5px;
    }

    .pdf-tb-btn {
        padding: 5px 7px;
        font-size: 11px;
    }

    .pdf-tb-page-info {
        font-size: 11.5px;
        gap: 4px;
    }

    .pdf-tb-page-input {
        width: 36px;
        height: 26px;
        font-size: 12px;
    }

    .pdf-tb-zoom-label {
        min-width: 38px;
        font-size: 11.5px;
    }

    .pdf-stage-wrap {
        padding: 12px 4px;
        min-height: 400px;
    }
}
