/**
 * Portal da Transparência - Frontend CSS
 * Versão 2.0 - Desktop e Mobile separados
 */

/* ==================== VARIÁVEIS ==================== */

:root {
    --pt-transition: all 0.3s ease;
}

/* ==================== BASE ==================== */

.pt-portal {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px 40px;
}

.pt-portal * {
    box-sizing: border-box;
}

/* ==================== HEADER ==================== */

.pt-header {
    margin-bottom: 40px;
}

.pt-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 25px;
}

.pt-titulo {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    letter-spacing: 1px;
    color: var(--pt-cor-principal, #1e40af);
}

/* Botão Menu - SÓ NO MOBILE */
.pt-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--pt-cor-secundaria, #e91e63);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    transition: var(--pt-transition);
    flex-shrink: 0;
}

.pt-menu-toggle:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* Desktop: esconder botão menu */
.pt-portal-desktop .pt-menu-toggle {
    display: none;
}

/* ==================== BUSCA ==================== */

.pt-busca-container {
    width: 100%;
    max-width: 100%;
}

.pt-busca-form {
    display: flex;
    gap: 0;
}

.pt-busca-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-right: none;
    border-radius: 10px 0 0 10px;
    font-size: 16px;
    transition: var(--pt-transition);
    background: #fff;
}

.pt-busca-input:focus {
    outline: none;
    border-color: var(--pt-cor-principal, #1e40af);
}

.pt-busca-btn {
    padding: 15px 25px;
    background: var(--pt-cor-principal, #1e40af);
    color: #fff;
    border: none;
    border-radius: 0 10px 10px 0;
    font-size: 18px;
    cursor: pointer;
    transition: var(--pt-transition);
}

.pt-busca-btn:hover {
    opacity: 0.9;
}

/* ==================== LAYOUT DESKTOP ==================== */

.pt-portal.pt-portal-desktop .pt-layout-desktop {
    display: grid !important;
    grid-template-columns: 280px 1fr !important;
    gap: 40px !important;
    align-items: start !important;
}

/* ==================== SIDEBAR DESKTOP ==================== */

.pt-portal.pt-portal-desktop .pt-sidebar-desktop {
    display: block !important;
    position: sticky !important;
    top: 20px;
    background: var(--pt-cor-sidebar, #1e293b) !important;
    border-radius: 12px;
    overflow: hidden;
    min-width: 280px;
}

.pt-portal.pt-portal-desktop .pt-sidebar-desktop .pt-sidebar-menu {
    padding: 20px 0;
}

.pt-portal.pt-portal-desktop .pt-sidebar-desktop .pt-sidebar-secao {
    margin-bottom: 5px;
}

.pt-portal.pt-portal-desktop .pt-sidebar-desktop .pt-sidebar-secao-titulo {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--pt-transition);
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.pt-portal.pt-portal-desktop .pt-sidebar-desktop .pt-sidebar-secao-titulo:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
}

.pt-portal.pt-portal-desktop .pt-sidebar-desktop .pt-sidebar-secao-titulo i {
    width: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--pt-cor-secundaria, #e91e63) !important;
}

.pt-portal.pt-portal-desktop .pt-sidebar-desktop .pt-sidebar-links {
    padding: 0 20px 10px 52px;
}

.pt-portal.pt-portal-desktop .pt-sidebar-desktop .pt-sidebar-link {
    display: block !important;
    padding: 9px 0;
    color: rgba(255, 255, 255, 0.65) !important;
    text-decoration: none;
    font-size: 13px;
    transition: var(--pt-transition);
}

.pt-portal.pt-portal-desktop .pt-sidebar-desktop .pt-sidebar-link:hover {
    color: #fff !important;
    padding-left: 5px;
}

/* ==================== CONTEÚDO ==================== */

.pt-conteudo {
    min-width: 0;
}

/* ==================== SEÇÃO ==================== */

.pt-secao {
    margin-bottom: 50px;
    scroll-margin-top: 30px;
}

.pt-secao:last-child {
    margin-bottom: 0;
}

.pt-secao-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--pt-cor-principal, #1e40af);
}

.pt-secao-icone {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    background: var(--pt-cor-principal, #1e40af);
}

.pt-secao-nome {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

/* ==================== GRID DE CARDS ==================== */

.pt-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* ==================== CARD ==================== */

.pt-card {
    background: var(--pt-cor-fundo-cards, #ffffff);
    border-radius: 16px;
    padding: 28px 20px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 2px solid #e8ecf1;
    transition: var(--pt-transition);
    cursor: pointer;
    min-height: 160px;
}

.pt-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--pt-cor-principal, #1e40af);
}

.pt-card-icone {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 28px;
    color: var(--pt-cor-principal, #1e40af);
    background: rgba(30, 64, 175, 0.08);
    transition: var(--pt-transition);
}

.pt-card:hover .pt-card-icone {
    background: var(--pt-cor-principal, #1e40af);
    color: #fff;
    transform: scale(1.05);
}

.pt-card-titulo {
    font-size: 14px;
    font-weight: 600;
    color: var(--pt-cor-texto, #1f2937);
    line-height: 1.4;
    margin: 0;
}

/* ==================== MODAL ==================== */

.pt-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.pt-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 1100px;
    height: 85vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: ptModalZoom 0.25s ease;
    overflow: hidden;
}

@keyframes ptModalZoom {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.pt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.pt-modal-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.pt-modal-icone {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    background: var(--pt-cor-principal, #1e40af);
}

.pt-modal-titulo {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pt-modal-fechar {
    width: 44px;
    height: 44px;
    border: none;
    background: #e2e8f0;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
    transition: var(--pt-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pt-modal-fechar:hover {
    background: #cbd5e1;
    color: #1e293b;
}

.pt-modal-body {
    flex: 1;
    position: relative;
    background: #f1f5f9;
    overflow: hidden;
}

.pt-modal-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: #64748b;
    font-size: 15px;
    gap: 14px;
}

.pt-modal-loading i {
    font-size: 36px;
    color: var(--pt-cor-principal, #1e40af);
}

.pt-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.pt-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    justify-content: center;
}

.pt-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    background: var(--pt-cor-principal, #1e40af);
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    transition: var(--pt-transition);
}

.pt-modal-btn:hover {
    opacity: 0.9;
    color: #fff;
}

/* Erro Modal */
.pt-modal-erro {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    padding: 40px;
    text-align: center;
}

.pt-modal-erro i.fa-exclamation-triangle {
    font-size: 50px;
    color: #f59e0b;
    margin-bottom: 20px;
}

.pt-modal-erro h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 10px 0;
}

.pt-modal-erro p {
    color: #64748b;
    margin: 0 0 8px 0;
    max-width: 380px;
}

/* ==================== VERSÃO MOBILE ==================== */

.pt-portal-mobile {
    padding: 20px 15px;
}

.pt-portal-mobile .pt-header-top {
    flex-wrap: wrap;
}

.pt-portal-mobile .pt-titulo {
    font-size: 22px;
    flex: 1;
}

.pt-portal-mobile .pt-busca-container {
    width: 100%;
    order: 3;
    margin-top: 10px;
}

.pt-portal-mobile .pt-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.pt-portal-mobile .pt-card {
    padding: 20px 15px;
    min-height: 130px;
    border-radius: 14px;
}

.pt-portal-mobile .pt-card-icone {
    width: 55px;
    height: 55px;
    font-size: 24px;
    margin-bottom: 12px;
}

.pt-portal-mobile .pt-card-titulo {
    font-size: 13px;
}

.pt-portal-mobile .pt-secao {
    margin-bottom: 35px;
}

.pt-portal-mobile .pt-secao-header {
    margin-bottom: 18px;
    padding-bottom: 12px;
}

.pt-portal-mobile .pt-secao-icone {
    width: 42px;
    height: 42px;
    font-size: 18px;
}

.pt-portal-mobile .pt-secao-nome {
    font-size: 18px;
}

/* Mobile: Sidebar overlay */
.pt-portal-mobile .pt-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99998;
}

.pt-portal-mobile .pt-sidebar-overlay.ativo {
    display: block;
}

.pt-portal-mobile .pt-sidebar-mobile {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: var(--pt-cor-sidebar, #1e293b);
    z-index: 99999;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.pt-portal-mobile .pt-sidebar-mobile.ativo {
    left: 0;
}

.pt-portal-mobile .pt-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
}

.pt-portal-mobile .pt-sidebar-header-titulo {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pt-portal-mobile .pt-sidebar-fechar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pt-portal-mobile .pt-sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

.pt-portal-mobile .pt-sidebar-secao-titulo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.pt-portal-mobile .pt-sidebar-secao-titulo i {
    color: var(--pt-cor-secundaria, #e91e63);
}

.pt-portal-mobile .pt-sidebar-links {
    padding: 0 20px 10px 52px;
}

.pt-portal-mobile .pt-sidebar-link {
    display: block;
    padding: 10px 0;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 14px;
}

/* Mobile modal */
.pt-portal-mobile .pt-modal-overlay {
    padding: 0;
    align-items: flex-end;
}

.pt-portal-mobile .pt-modal {
    border-radius: 20px 20px 0 0;
    height: 90vh;
    max-height: none;
    animation: ptModalSlideUp 0.3s ease;
}

@keyframes ptModalSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.pt-portal-mobile .pt-modal-footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.pt-portal-mobile .pt-modal-btn {
    width: 100%;
    justify-content: center;
}

/* ==================== UTILITÁRIOS ==================== */

.pt-sem-resultados {
    text-align: center;
    padding: 50px 20px;
    color: #64748b;
}

.pt-sem-resultados i {
    font-size: 45px;
    margin-bottom: 15px;
    color: #cbd5e1;
}

.pt-card.pt-highlight {
    animation: ptHighlight 0.5s ease;
    box-shadow: 0 0 0 3px var(--pt-cor-principal, #1e40af);
}

@keyframes ptHighlight {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* ==================== RESPONSIVO DESKTOP ==================== */

@media screen and (max-width: 1200px) {
    .pt-layout-desktop {
        grid-template-columns: 260px 1fr;
        gap: 30px;
    }
}

@media screen and (min-width: 1400px) {
    .pt-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .pt-card {
        padding: 32px 24px;
        min-height: 180px;
    }
    
    .pt-card-icone {
        width: 76px;
        height: 76px;
        font-size: 32px;
    }
    
    .pt-card-titulo {
        font-size: 15px;
    }
}

/* ==================== PRINT ==================== */

@media print {
    .pt-sidebar-desktop,
    .pt-sidebar-mobile,
    .pt-busca-container,
    .pt-modal-overlay,
    .pt-menu-toggle {
        display: none !important;
    }
    
    .pt-layout-desktop {
        grid-template-columns: 1fr;
    }
}
