/*
 * =========================================
 * CSS ESPECÍFICO - DOCUMENTOS PÚBLICOS
 * =========================================
 * 
 * Este arquivo contém estilos EXCLUSIVOS da listagem pública de documentos
 * Usado na rota /documentos (acesso público)
 * 
 * Dependências:
 * - /css/componentes/documentos-compartilhado.css  
 * - /css/componentes/paginacao.css
 * 
 * Criado em: 23/08/2025
 * Autor: Sistema Vade Mecum - Defensoria Pública MT
 */

/* ========================================= */
/* SEÇÃO: LAYOUT PRINCIPAL */
/* ========================================= */

/* Container principal já definido em documentos-compartilhado.css */

/* ========================================= */
/* SEÇÃO: COMPONENTES ESPECÍFICOS DA PÁGINA PÚBLICA */
/* ========================================= */

/* Link para documentos (numeração clicável) */
.doc-link {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.doc-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* Botão PDF com gradiente */
.pdf-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.pdf-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    color: var(--white);
}

/* Célula de descrição com quebra de texto */
.description-cell {
    max-width: 400px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.5;
    min-width: 200px;
}

/* Botão limpar filtros */
.btn-clear {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--gray-100);
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

/* Container de limpar filtros */
.clear-filters {
    grid-column: 1 / -1;
    margin-top: var(--space-4);
    text-align: center;
}

/* ========================================= */
/* SEÇÃO: MODAL PDF ESPECÍFICO */
/* ========================================= */

/* Modal PDF overlay */
.pdf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

/* Container do modal PDF */
.pdf-modal-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 90vw;
    max-height: 90vh;
    width: 1000px;
    height: 800px;
    overflow: hidden;
    animation: pdfModalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes pdfModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header do modal PDF */
.pdf-modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.pdf-modal-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
}

/* Botão fechar modal PDF */
.pdf-modal-close {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: var(--text-lg);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.pdf-modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* Body do modal PDF */
.pdf-modal-body {
    flex: 1;
    padding: var(--space-4);
    overflow: hidden;
}

/* Footer do modal PDF */
.pdf-modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ========================================= */
/* SEÇÃO: ESTADO VAZIO ESPECÍFICO */
/* ========================================= */

/* Estado vazio (adaptação do .no-results do CSS inline) */
.no-results {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--gray-500);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
}

/* ========================================= */
/* SEÇÃO: CABEÇALHO DA PÁGINA PÚBLICA */
/* ========================================= */

/* Título da página */
.page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
    text-align: center;
}

/* Subtítulo da página */
.page-subtitle {
    font-size: var(--text-base);
    color: var(--gray-600);
    text-align: center;
    margin-bottom: var(--space-8);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* ========================================= */
/* SEÇÃO: CONTADOR DE RESULTADOS */
/* ========================================= */

/* Container do contador */
.results-count {
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
    text-align: center;
}

.results-count-text {
    font-size: var(--text-sm);
    color: var(--primary-700);
    margin: 0;
    font-weight: 600;
}

/* ========================================= */
/* SEÇÃO: ESTILOS ESPECÍFICOS DA TABELA PÚBLICA */
/* ========================================= */

/* Tabela pública tem colunas específicas */
.public-table {
    /* Herda estilos de .table do arquivo compartilhado */
}

/* Coluna de numeração como link principal */
.public-table .doc-number-link {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.public-table .doc-number-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* Coluna de data formatada */
.public-table .date-cell {
    white-space: nowrap;
    color: var(--gray-600);
    font-size: var(--text-sm);
}

/* Coluna de arquivo PDF */
.public-table .file-cell {
    text-align: center;
    vertical-align: middle;
}

/* ========================================= */
/* SEÇÃO: NAVEGAÇÃO E AÇÕES PÚBLICAS */
/* ========================================= */

/* Botão para usuários autenticados criarem documentos */
.public-create-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    background: var(--primary-600);
    color: var(--white);
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.public-create-btn:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: var(--white);
}

/* ========================================= */
/* SEÇÃO: BREADCRUMB/NAVEGAÇÃO */
/* ========================================= */

/* Breadcrumb para navegação */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    padding: var(--space-3) 0;
    font-size: var(--text-sm);
}

.breadcrumb-item {
    color: var(--gray-500);
}

.breadcrumb-link {
    color: var(--primary-600);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--gray-400);
    margin: 0 var(--space-1);
}

/* ========================================= */
/* SEÇÃO: FILTROS ESPECÍFICOS PÁGINA PÚBLICA */
/* ========================================= */

/* Informações adicionais nos filtros */
.filter-help-text {
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-top: var(--space-1);
    font-style: italic;
}

/* ========================================= */
/* SEÇÃO: RESPONSIVIDADE ESPECÍFICA */
/* ========================================= */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    .main-container {
        padding: var(--space-5);
    }
    
    .page-title {
        font-size: var(--text-xl);
    }
    
    .results-count {
        margin: 0 calc(var(--space-3) * -1) var(--space-6);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .description-cell {
        max-width: 300px;
    }
}

/* Responsividade específica da página pública */
@media (max-width: 992px) {
    .search-and-filters {
        grid-template-columns: 1fr 140px 120px 120px;
        gap: var(--space-3);
    }
}

/* Dispositivos móveis (max 768px) */
@media (max-width: 768px) {
    .main-container {
        padding: var(--space-4);
    }
    
    .page-title {
        font-size: var(--text-lg);
        margin-bottom: var(--space-3);
    }
    
    .page-subtitle {
        font-size: var(--text-sm);
        margin-bottom: var(--space-6);
    }
    
    .breadcrumb {
        flex-wrap: wrap;
        gap: var(--space-1);
    }
    
    /* Layout dos filtros em mobile */
    .search-and-filters {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    /* Tabela responsiva em mobile */
    .table-wrapper {
        font-size: var(--text-xs);
    }

    .table th,
    .table td {
        padding: var(--space-2);
    }
    
    .description-cell {
        max-width: 250px;
        font-size: var(--text-xs);
        line-height: 1.4;
    }

    /* Modal PDF em mobile */
    .pdf-modal-container {
        width: 95vw;
        height: 95vh;
        margin: var(--space-4);
    }
    
    .pdf-modal-footer {
        flex-direction: column-reverse;
    }
    
    .pdf-modal-footer .btn {
        width: 100%;
    }
    
    /* Tabela pública em mobile com scroll horizontal */
    .public-table-container {
        overflow-x: auto;
        margin: 0 calc(var(--space-4) * -1);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .public-table {
        min-width: 700px; /* Força scroll horizontal */
    }
}

/* Dispositivos muito pequenos (max 480px) */
@media (max-width: 480px) {
    .main-container {
        padding: var(--space-3);
    }
    
    .page-title {
        font-size: var(--text-base);
        font-weight: 600;
    }
    
    .results-count {
        padding: var(--space-3);
    }
    
    .results-count-text {
        font-size: var(--text-xs);
    }
    
    /* Simplificar breadcrumb em telas muito pequenas */
    .breadcrumb {
        font-size: var(--text-xs);
        margin-bottom: var(--space-4);
    }

}

/* ========================================= */
/* SEÇÃO: PRINT STYLES (IMPRESSÃO) */
/* ========================================= */

@media print {
    .main-container {
        max-width: none;
        padding: 0;
    }
    
    .search-and-filters,
    .results-count,
    .breadcrumb {
        display: none;
    }
    
    .page-title {
        color: black;
        font-size: 18pt;
        margin-bottom: 20pt;
    }
    
    .public-table {
        font-size: 10pt;
        border-collapse: collapse;
    }
    
    .public-table thead th {
        background: #f0f0f0 !important;
        border: 1px solid #000;
    }
    
    .public-table tbody td {
        border: 1px solid #ccc;
    }
    
    .badge {
        border: 1px solid #000;
        padding: 2pt 4pt;
    }
    
    .pdf-button {
        display: none;
    }
}

/* ========================================= */
/* SEÇÃO: ESTADOS DE CARREGAMENTO */
/* ========================================= */

/* Loading específico da página pública */
.public-loading {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--gray-500);
}

.public-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary-200);
    border-top: 3px solid var(--primary-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-4);
}

.public-loading-text {
    font-size: var(--text-sm);
    color: var(--gray-600);
}

/* ========================================= */
/* SEÇÃO: ACESSIBILIDADE */
/* ========================================= */

/* Melhorar contraste para usuários com dificuldades visuais */
@media (prefers-contrast: high) {
    .doc-number-link {
        color: var(--primary-800);
        text-decoration: underline;
    }
    
    .badge {
        border-width: 2px;
        font-weight: 700;
    }
}

/* Reduzir movimento para usuários com preferência de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
    .public-create-btn,
    .doc-number-link,
    .pdf-button {
        transition: none;
    }
    
    .public-create-btn:hover {
        transform: none;
    }
    
    .public-loading-spinner {
        animation: none;
        border: 3px solid var(--primary-600);
        border-radius: 0;
    }
}