/**
 * Universal In-Page PDF Previewer Modal Styles
 * Dr. APJ Abdul Kalam University - Theme Aligned
 */

.pdf-preview-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(14, 6, 10, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

.pdf-preview-backdrop.is-active {
    opacity: 1;
    visibility: visible;
}

.pdf-preview-dialog {
    width: 100%;
    max-width: 1240px;
    height: 94vh;
    background: #1b191c;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(197, 160, 89, 0.35);
    transform: scale(0.94) translateY(15px);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.pdf-preview-backdrop.is-active .pdf-preview-dialog {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.pdf-preview-header {
    background: linear-gradient(135deg, #700015 0%, #46000e 100%);
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid rgba(197, 160, 89, 0.3);
    flex-shrink: 0;
}

.pdf-preview-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.pdf-preview-icon-badge {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff526c;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.pdf-preview-title-group {
    min-width: 0;
}

.pdf-preview-title {
    color: #ffffff;
    font-family: 'Cinzel', 'Playfair Display', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-preview-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.pdf-preview-badge {
    background: rgba(197, 160, 89, 0.22);
    color: #e6ca85;
    border: 1px solid rgba(197, 160, 89, 0.4);
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pdf-preview-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

/* Header Actions */
.pdf-preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 30px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.22s ease;
    white-space: nowrap;
    border: none;
}

.pdf-btn-fullview {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.pdf-btn-fullview:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.pdf-btn-download {
    background: linear-gradient(135deg, #c5a059 0%, #dfbf7a 100%);
    color: #3b2800 !important;
    box-shadow: 0 3px 10px rgba(197, 160, 89, 0.35);
}

.pdf-btn-download:hover {
    background: linear-gradient(135deg, #d4af66 0%, #edd18f 100%);
    color: #241800 !important;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(197, 160, 89, 0.5);
}

.pdf-btn-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.22s ease;
    padding: 0;
}

.pdf-btn-close:hover {
    background: #c91832;
    border-color: #c91832;
    transform: rotate(90deg);
}

/* Modal Body */
.pdf-preview-body {
    flex: 1;
    position: relative;
    background: #252427;
    overflow: hidden;
}

/* Loader */
.pdf-preview-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #222125;
    z-index: 2;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pdf-preview-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.pdf-preview-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(197, 160, 89, 0.25);
    border-top-color: #c5a059;
    border-radius: 50%;
    animation: pdfSpin 0.9s linear infinite;
}

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

.pdf-preview-loader p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    margin: 0;
    letter-spacing: 0.03em;
}

/* Iframe */
.pdf-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #525659;
}

/* Image Preview Viewport */
.pdf-preview-image-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    background: #171618;
    overflow: hidden;
}

.pdf-preview-image-container.d-none {
    display: none !important;
}

.pdf-image-scroll-stage {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.pdf-preview-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: block;
    margin: auto;
    cursor: zoom-in;
    transition: transform 0.22s ease;
    transform-origin: center center;
}

/* Floating Image Zoom Controls */
.pdf-image-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(27, 25, 28, 0.94);
    border: 1px solid rgba(197, 160, 89, 0.45);
    border-radius: 30px;
    padding: 5px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.pdf-img-tool-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 0.88rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pdf-img-tool-btn:hover {
    background: rgba(197, 160, 89, 0.25);
    color: #ffd700;
}

.pdf-img-zoom-text {
    color: #e6ca85;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 44px;
    text-align: center;
}

/* Fallback / Footer Helper */
.pdf-preview-fallback {
    background: #19181a;
    padding: 9px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
    flex-shrink: 0;
}

.pdf-preview-fallback a {
    color: #d6b26c;
    text-decoration: underline;
}

.pdf-preview-fallback a:hover {
    color: #ffffff;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .pdf-preview-backdrop {
        padding: 8px;
    }

    .pdf-preview-dialog {
        height: 96vh;
        border-radius: 14px;
    }

    .pdf-preview-header {
        padding: 10px 14px;
        gap: 10px;
    }

    .pdf-preview-icon-badge {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }

    .pdf-preview-title {
        font-size: 0.9rem;
    }

    .pdf-preview-filename {
        display: none;
    }

    .pdf-btn span.pdf-btn-text {
        display: none;
    }

    .pdf-btn {
        padding: 7px 10px;
    }

    .pdf-preview-fallback {
        flex-direction: column;
        gap: 4px;
        text-align: center;
        padding: 8px 12px;
    }
}
