/* Leitor de PDF Integrado - Portal de Transparência */

/* Overlay do leitor PDF */
.pdf-reader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    display: none;
    flex-direction: column;
}

/* Container principal do leitor */
.pdf-reader-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 90%;
    margin: 2% auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Barra de ferramentas do PDF */
.pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    min-height: 60px;
    flex-wrap: wrap;
    gap: 10px;
}

.pdf-toolbar-left,
.pdf-toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.pdf-toolbar-center {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Botões da toolbar */
.pdf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    min-width: 36px;
    height: 36px;
    font-family: 'Font Awesome 6 Free', sans-serif;
}

.pdf-btn:hover {
    background: #e9ecef;
    border-color: #3498db;
    color: #3498db;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

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

.pdf-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

/* Ícones dos botões */
.pdf-btn[action="menu"]::before { content: "\f0c9"; font-weight: 400; }
.pdf-btn[action="search"]::before { content: "\f002"; font-weight: 400; }
.pdf-btn[action="prev"]::before { content: "\f104"; font-weight: 400; }
.pdf-btn[action="next"]::before { content: "\f105"; font-weight: 400; }
.pdf-btn[action="zoom-in"]::before { content: "\f00e"; font-weight: 400; }
.pdf-btn[action="zoom-out"]::before { content: "\f010"; font-weight: 400; }
.pdf-btn[action="zoom-fit"]::before { content: "\f065"; font-weight: 400; }
.pdf-btn[action="fullscreen"]::before { content: "\f065"; font-weight: 400; }
.pdf-btn[action="download"]::before { content: "\f019"; font-weight: 400; }
.pdf-btn[action="print"]::before { content: "\f02f"; font-weight: 400; }
.pdf-btn[action="share"]::before { content: "\f1e0"; font-weight: 400; }
.pdf-btn[action="rotate"]::before { content: "\f2ea"; font-weight: 400; }
.pdf-btn[action="bookmark"]::before { content: "\f02e"; font-weight: 400; }
.pdf-btn[action="close"]::before { content: "\f00d"; font-weight: 400; }

/* Contador de páginas */
.pdf-page-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
    background: #fff;
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    min-width: 80px;
    justify-content: center;
}

.pdf-page-input {
    width: 40px;
    border: none;
    outline: none;
    text-align: center;
    font-size: 14px;
    background: transparent;
}

.pdf-page-input:focus {
    background: #f8f9fa;
    border-radius: 3px;
}

/* Área de visualização do PDF */
.pdf-viewer-area {
    flex: 1;
    overflow: auto;
    background: #f8f9fa;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.pdf-page-container {
    display: inline-block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
    background: white;
    transform-origin: top center;
    transition: transform 0.3s ease;
}

.pdf-page {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Loading do PDF */
.pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    font-size: 16px;
}

.pdf-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Erro no PDF */
.pdf-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #dc3545;
    font-size: 16px;
    text-align: center;
    padding: 40px;
}

.pdf-error i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #dc3545;
}

/* Barra de progresso */
.pdf-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    z-index: 10;
}

.pdf-progress-bar {
    width: 200px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.pdf-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* Sidebar de opções (oculta por padrão) */
.pdf-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: #fff;
    border-right: 1px solid #dee2e6;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 10;
    overflow-y: auto;
}

.pdf-sidebar.open {
    transform: translateX(0);
}

.pdf-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.pdf-sidebar-content {
    padding: 20px;
}

/* Responsividade */
@media (max-width: 768px) {
    .pdf-reader-container {
        width: 95%;
        height: 95%;
        margin: 1% auto;
    }
    
    .pdf-toolbar {
        padding: 10px 15px;
        min-height: 50px;
    }
    
    .pdf-toolbar-left,
    .pdf-toolbar-center,
    .pdf-toolbar-right {
        gap: 8px;
    }
    
    .pdf-btn {
        padding: 6px 8px;
        min-width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .pdf-viewer-area {
        padding: 10px;
    }
    
    .pdf-sidebar {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .pdf-toolbar {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pdf-page-counter {
        order: 1;
        width: 100%;
        justify-content: center;
        margin: 10px 0;
    }
}

/* Tema escuro (opcional) */
@media (prefers-color-scheme: dark) {
    .pdf-reader-container {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .pdf-toolbar {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
        border-color: #34495e;
    }
    
    .pdf-btn {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .pdf-btn:hover {
        background: #4a5f7a;
    }
    
    .pdf-viewer-area {
        background: #34495e;
    }
    
    .pdf-page-container {
        background: #2c3e50;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }
}

/* Animations */
.pdf-reader-overlay.show {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pdf-reader-container.show {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}