﻿/* ===== PAGOS3 - MODERN UI ===== */

/* --- Base --- */
.pg3-body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: #eef1f6;
    color: #1e293b;
    font-size: 20px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Top Bar --- */
.pg3-topbar {
    background: #1e3a5f;
    color: #fff;
    padding: 0;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
    position: sticky;
    top: 0;
    z-index: 100;
}
.pg3-topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.pg3-topbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.pg3-topbar-title {
    font-size: 1.15rem;
    font-weight: 600;
}
.pg3-topbar-login {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
/* Override shared UserControl styles inside topbar */
.pg3-topbar-login .panel_login {
    margin-top: 0;
    float: none;
    width: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}
.pg3-topbar-login .panel_login a {
    float: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #e2e8f0 !important;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 8px;
    transition: background .15s, color .15s;
}
.pg3-topbar-login .panel_login a:hover {
    background: rgba(255,255,255,.12);
    color: #fff !important;
}
.pg3-topbar-login .panel_login a img {
    display: none;
}
.pg3-topbar-login .panel_login span {
    color: #e2e8f0 !important;
    font-size: 1rem;
    font-weight: 500;
}

/* --- Wrapper --- */
.pg3-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 32px 48px;
}

/* --- Main Title --- */
.pg3-main-title {
    display: block;
    text-align: center;
    font-weight: 800;
    font-size: 1.65rem;
    color: #1e3a5f;
    margin: 0 0 28px;
    letter-spacing: .2px;
}

/* --- Sections --- */
.pg3-section {
    margin-bottom: 24px;
}

/* --- Filters Grid --- */
.pg3-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
/* 3-column variant */
.pg3-filters-grid-3col {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Scrollable grid wrapper for wide tables */
.pg3-grid-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
    .pg3-filters-grid-3col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
    .pg3-filters-grid { grid-template-columns: 1fr; }
    .pg3-filters-grid-3col { grid-template-columns: 1fr; }
}

/* ===== MOBILE ===== */
@media (max-width: 600px) {
    .pg3-body { font-size: 15px; }
    .pg3-topbar-inner { padding: 10px 14px; flex-wrap: wrap; }
    .pg3-topbar-title { font-size: .95rem; }
    .pg3-wrapper { padding: 14px 10px 32px; }
    .pg3-main-title { font-size: 1.15rem; margin-bottom: 16px; }
    .pg3-card-header { padding: 12px 14px 10px; }
    .pg3-card-title { font-size: .92rem; }
    .pg3-card-body { padding: 14px 14px 16px; }
    .pg3-select { padding: 10px 12px; font-size: 1rem; }
    .pg3-checklist-container { max-height: 180px; padding: 8px; }
    .pg3-checklist-container label { font-size: .92rem; }
    .pg3-btn { padding: 10px 18px; font-size: .95rem; }
    .pg3-btn-pesquisar { padding: 11px 24px; font-size: 1rem; }
    .pg3-toolbar { padding: 12px 14px; gap: 10px; flex-direction: column; align-items: stretch; }
    .pg3-toolbar-left, .pg3-toolbar-right { justify-content: center; flex-wrap: wrap; }
    .pg3-datagrid { font-size: .85rem; }
    .pg3-datagrid td, .pg3-datagrid th { padding: 8px 8px; white-space: nowrap; }
    .pg3-grid-header, .pg3-grid-header td { font-size: .78rem; }
    .pg3-result-text { font-size: 1rem; }
    .pg3-modal { max-width: 95vw; }
    .pg3-modal-header { padding: 16px 16px 12px; }
    .pg3-modal-body { padding: 16px; font-size: .95rem; }
    .pg3-modal-title { font-size: 1.1rem; }
    .pg3-label { font-size: .95rem; }
    .pg3-filters-grid { gap: 14px; }
}

/* --- Card --- */
.pg3-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
    overflow: hidden;
}
.pg3-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px 14px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}
.pg3-card-icon {
    font-size: 1.2rem;
}
.pg3-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: .5px;
    flex: 1;
}
.pg3-card-body {
    padding: 20px 24px 24px;
}

/* --- Card grid (no padding, scrollable) --- */
.pg3-card-grid {
    border-radius: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.pg3-card-grid .pg3-card-body { padding: 0; }

/* --- Fields --- */
.pg3-field {
    margin-bottom: 16px;
}
.pg3-field:last-child {
    margin-bottom: 0;
}
.pg3-label {
    display: block;
    font-weight: 700;
    font-size: 1.05rem;
    color: #475569;
    margin-bottom: 6px;
}

/* --- Select --- */
.pg3-select {
    display: block;
    width: 100%;
    padding: 14px 18px;
    font-size: 1.4rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #1e293b;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.pg3-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, .1);
}

/* --- Periodo Row --- */
.pg3-periodo-row {
    display: flex;
    gap: 20px;
}
.pg3-periodo-row .pg3-field { flex: 1; }

/* --- Metodologia Button --- */
.pg3-btn-metodologia {
    background: #6366f1;
    color: #fff;
}   
.pg3-btn-metodologia:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

/* --- Products Grid (side by side) --- */
.pg3-products-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 800px) {
    .pg3-products-grid {
        grid-template-columns: 1fr;
    }
    .pg3-products-actions {
        flex-direction: row !important;
        justify-content: center;
    }
}
.pg3-products-col {
    min-width: 0;
}
.pg3-products-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding-top: 32px;
}

/* --- Listbox --- */
.pg3-listbox {
    display: block;
    width: 100% !important;
    height: 260px !important;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    background: #fafbfc;
    color: #1e293b;
    outline: none;
    transition: border-color .15s;
}
.pg3-listbox:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, .1);
}

/* --- CheckBoxList --- */
.pg3-checklist-container {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    overflow: auto;
    max-height: 260px;
    padding: 10px;
    background: #fafbfc;
}
.pg3-checklist-container span {
    line-height: 2;
}
.pg3-checklist-container input[type="checkbox"] {
    margin-right: 6px;
    transform: scale(1.15);
    vertical-align: middle;
}
.pg3-checklist-container label {
    font-size: 1.05rem;
    color: #1e293b;
    cursor: pointer;
    vertical-align: middle;
}

/* --- Transfer Buttons --- */
.pg3-tbtn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .12);
    transition: transform .12s, box-shadow .15s;
}
.pg3-tbtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .18);
}
.pg3-tbtn:active {
    transform: translateY(0);
}
.pg3-tbtn-down {
    background: #3b82f6;
}
.pg3-tbtn-down:hover { background: #2563eb; }
.pg3-tbtn-downall {
    background: #1d4ed8;
}
.pg3-tbtn-downall:hover { background: #1e40af; }
.pg3-tbtn-up {
    background: #f59e0b;
}
.pg3-tbtn-up:hover { background: #d97706; }
.pg3-tbtn-upall {
    background: #ef4444;
}
.pg3-tbtn-upall:hover { background: #dc2626; }

/* --- Toolbar --- */
.pg3-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}
.pg3-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pg3-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pg3-panel-inline {
    display: inline-flex;
    align-items: center;
}

/* --- Buttons --- */
.pg3-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, transform .12s, box-shadow .15s;
}
.pg3-btn-voltar {
    background: #64748b;
    color: #fff;
}
.pg3-btn-voltar:hover {
    background: #475569;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}
.pg3-btn-pesquisar {
    background: #2563eb;
    color: #fff;
    padding: 14px 40px;
    font-size: 1.15rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}
.pg3-btn-graficos {
    background: #7c3aed;
    color: #fff;
}
.pg3-btn-graficos:hover {
    background: #6d28d9;
    color: #fff;
    transform: translateY(-1px);
}
.pg3-btn-pesquisar:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}
.pg3-btn-excel {
    background: #16a34a;
    color: #fff;
    padding: 12px 24px;
}
.pg3-btn-excel:hover {
    background: #15803d;
    transform: translateY(-1px);
}
.pg3-btn-pdf {
    background: #dc2626;
    color: #fff;
    padding: 12px 24px;
}
.pg3-btn-pdf:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* --- Alert / Messages --- */
.pg3-alert {
    display: block;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    margin-bottom: 14px;
}
.pg3-result-text {
    display: block;
    font-weight: 700;
    font-size: 1.15rem;
    color: #1e293b;
}
.pg3-page-text {
    display: block;
    font-size: 1rem;
    color: #64748b;
    margin-top: 4px;
}

/* --- DataGrid --- */
.pg3-datagrid {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.05rem;
    font-family: 'Segoe UI', system-ui, Arial, sans-serif;
}
.pg3-datagrid td,
.pg3-datagrid th {
    padding: 12px 16px;
}

/* Header */
.pg3-grid-header,
.pg3-grid-header td {
    background: #1e3a5f !important;
    color: #fff !important;
    font-weight: 700;
    font-size: .95rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.pg3-grid-header a { color: #93c5fd !important; text-decoration: none; }
.pg3-grid-header a:hover { color: #fff !important; text-decoration: underline; }

/* Rows */
.pg3-grid-row,
.pg3-grid-row td {
    background: #fff;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}
.pg3-grid-row-alt,
.pg3-grid-row-alt td {
    background: #f8fafc;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}
.pg3-grid-row:hover td,
.pg3-grid-row-alt:hover td {
    background: #eef2ff;
}
.pg3-grid-row-sel,
.pg3-grid-row-sel td {
    background: #dbeafe;
    font-weight: 600;
}

/* Footer */
.pg3-grid-footer,
.pg3-grid-footer td {
    background: #1e3a5f;
    color: #fff;
    font-weight: 700;
}

/* Pager */
.pg3-grid-pager,
.pg3-grid-pager td {
    background: #1e3a5f;
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 1rem;
}
.pg3-grid-pager a {
    color: #93c5fd;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
}
.pg3-grid-pager a:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
}
.pg3-grid-pager span {
    color: #fff;
    font-weight: 700;
    padding: 4px 10px;
    background: rgba(255,255,255,.2);
    border-radius: 6px;
}

/* ===== MODAL ===== */
.pg3-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, .6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: pg3FadeIn .2s ease;
}
@keyframes pg3FadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.pg3-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, .25);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: pg3SlideUp .25s ease;
}
@keyframes pg3SlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pg3-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 18px;
    border-bottom: 1px solid #e2e8f0;
}
.pg3-modal-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e3a5f;
}
.pg3-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color .15s;
}
.pg3-modal-close:hover {
    color: #ef4444;
}
.pg3-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #334155;
}
.pg3-modal-body h3 {
    margin: 0 0 16px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e3a5f;
}
.pg3-modal-body p {
    margin: 0 0 14px;
}
.pg3-modal-body ul {
    margin: 0 0 16px;
    padding-left: 24px;
}
.pg3-modal-body li {
    margin-bottom: 6px;
}
.pg3-modal-footer {
    padding: 16px 28px 24px;
    border-top: 1px solid #e2e8f0;
    text-align: right;
}

/* ===== LOADING OVERLAY ===== */
.pg3-loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, .35);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 16px;
}
.pg3-loading-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #e2e8f0;
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: pg3-spin .7s linear infinite;
}
@keyframes pg3-spin {
    to { transform: rotate(360deg); }
}
.pg3-loading-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* ===== SP GOV INSTITUTIONAL HEADER ===== */
.pg3-gov-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0;
}
.pg3-gov-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.pg3-gov-header-text {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.4;
}
.pg3-gov-header-text .pg3-gov-secretaria {
    font-size: 1rem;
    color: #64748b;
    font-weight: 400;
}
.pg3-gov-header-text .pg3-gov-orgao {
    font-size: 1.2rem;
    color: #1e293b;
    font-weight: 700;
}
.pg3-gov-header-text .pg3-gov-sub {
    font-size: .95rem;
    color: #94a3b8;
    font-weight: 400;
}
.pg3-gov-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.pg3-gov-logo svg {
    height: 36px;
    width: auto;
}
@media (max-width: 600px) {
    .pg3-gov-header-inner { padding: 10px 14px; }
    .pg3-gov-header-text .pg3-gov-secretaria { font-size: .85rem; }
    .pg3-gov-header-text .pg3-gov-orgao { font-size: 1rem; }
    .pg3-gov-header-text .pg3-gov-sub { font-size: .8rem; }
    .pg3-gov-logo svg { height: 28px; }
}
