﻿/* ================================
   🔹 PDF Viewer - Estilos Modernos
=================================== */

/* Modal Content */
.pdf-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    border: none;
}

.pdf-modal-header {
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1.5rem 0.5rem 1.5rem;
    backdrop-filter: blur(10px);
}

.pdf-icon {
    font-size: 1.5rem;
    color: #dc3545;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Toolbar Moderna */
.pdf-toolbar {
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.pdf-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pdf-toolbar-group-right {
    margin-left: auto;
}

.pdf-toolbar-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    white-space: nowrap;
}

.pdf-toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-toolbar {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 38px;
}

.btn-toolbar:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-toolbar:active {
    transform: translateY(0);
}

.btn-toolbar-success {
    background: rgba(40, 167, 69, 0.2);
    border-color: rgba(40, 167, 69, 0.4);
}

.btn-toolbar-success:hover {
    background: rgba(40, 167, 69, 0.3);
    border-color: rgba(40, 167, 69, 0.6);
}

/* Indicadores */
.pdf-zoom-indicator,
.pdf-page-indicator {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-page-indicator {
    min-width: 80px;
}

/* Viewer Container */
/* Viewer Container */
.pdf-viewer-container {
    flex-grow: 1;
    overflow: auto;
    /* Habilita scroll em ambas direções */
    background: #0f0f1e;
    padding: 2rem;
    display: flex;
    /* Mantém flex para estrutura, mas cuidado com alinhamento */
    flex-direction: column;
    align-items: flex-start;
    /* Permite scroll desde o início */
    scroll-behavior: smooth;
    position: relative;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
    /* Suavidade no iOS */
}

.pdf-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
    margin: 0 auto;
    /* Centraliza horizontalmente quando menor que a tela */
    min-width: min-content;
    /* Garante que o container acompanhe o tamanho do canvas */
    /* max-width removed to allow zoom expansion */
}

/* Canvas do PDF */
#pdfViewer canvas,
.pdf-page-canvas {
    width: auto;
    height: auto;
    max-width: none;
    /* Remove restrição de largura para permitir zoom real */
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background: #ffffff;
    transition: transform 0.2s ease;
    margin-bottom: 1.5rem;
    cursor: grab;
}

#pdfViewer canvas:hover,
.pdf-page-canvas:hover {
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.7);
}

/* Loading Melhorado */
.pdf-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 30, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.pdf-loading-content {
    text-align: center;
    color: #ffffff;
}

.pdf-spinner {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
    margin-bottom: 1rem;
}

.pdf-loading-text {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.pdf-loading-progress {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.pdf-loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #00d4ff);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
    animation: progress-shimmer 1.5s ease-in-out infinite;
}

@keyframes progress-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Scrollbar Customizada */
.pdf-viewer-container::-webkit-scrollbar {
    width: 10px;
}

.pdf-viewer-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.pdf-viewer-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

.pdf-viewer-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsividade */
@media (max-width: 768px) {
    .pdf-modal-header {
        padding: 0.75rem 1rem;
    }

    .pdf-icon {
        font-size: 1rem;
    }

    .pdf-toolbar {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .pdf-toolbar-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .pdf-toolbar-label {
        font-size: 0.7rem;
    }

    .pdf-toolbar-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .btn-toolbar {
        flex: 1;
        min-width: auto;
    }

    .pdf-viewer-container {
        padding: 1rem 0.5rem;
    }

    .pdf-zoom-indicator,
    .pdf-page-indicator {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
        min-width: 50px;
    }
}

@media (max-width: 576px) {
    .pdf-toolbar-group-right {
        margin-left: 0;
        width: 100%;
    }

    .pdf-toolbar-buttons {
        width: 100%;
    }

    .btn-toolbar span {
        display: none;
    }
}

/* Animações de entrada */
#modalPdfViewer.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: scale(0.9);
}

#modalPdfViewer.modal.show .modal-dialog {
    transform: scale(1);
}

/* Estados desabilitados */
.btn-toolbar:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}