/**
 * SGCC — Design system global do painel administrativo
 */

:root {
    --sgcc-primary: #1e3a5f;
    --sgcc-primary-light: #2c5282;
    --sgcc-accent: #2b6cb0;
    --sgcc-dark: #343a40;
    --sgcc-muted: #6c757d;
    --sgcc-border: #e2e8f0;
    --sgcc-bg: #f4f6f9;
    --sgcc-card-shadow: 0 2px 12px rgba(0, 0, 0, .07);
    --sgcc-radius: .5rem;
}

/* ── Layout base ─────────────────────────────────────────── */
.sgcc-content-wrapper {
    background: var(--sgcc-bg);
}

.sgcc-content-wrapper > .content {
    padding: 1rem 0 0;
}

.sgcc-container {
    max-width: 100%;
}

/* Dashboard — conter gráficos Chart.js */
.sgcc-dashboard-charts .card-body {
    position: relative;
    height: 280px;
    overflow: hidden;
}

.sgcc-dashboard-charts canvas {
    display: block;
    max-width: 100%;
}

/* Evitar que os monitores internos do Chart.js aumentem a página */
.chartjs-size-monitor,
.chartjs-size-monitor-expand,
.chartjs-size-monitor-shrink {
    overflow: hidden !important;
    pointer-events: none;
}

/* ── Sidebar & navbar ────────────────────────────────────── */
.main-sidebar {
    background: linear-gradient(180deg, #1a2332 0%, #1e3a5f 100%) !important;
}

.main-sidebar .brand-link {
    border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
}

.main-sidebar .brand-link.sgcc-brand-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    padding: 1rem 0.75rem 0.85rem;
}

.main-sidebar .brand-link.sgcc-brand-link .sgcc-brand-logo {
    float: none;
    display: block;
    margin: 0 0 0.55rem 0;
    max-height: 54px;
    max-width: 54px;
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.main-sidebar .brand-link.sgcc-brand-link .sgcc-brand-text {
    display: block;
    line-height: 1.35;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, .9);
}

.main-sidebar .nav-header {
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .45) !important;
    padding: .75rem 1rem .35rem;
}

.main-sidebar .nav-link {
    border-radius: .35rem;
    margin: 1px .5rem;
    font-size: .9rem;
}

.main-sidebar .nav-link.active,
.main-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .1) !important;
}

/* Sidebar colapsada — centrar ícones */
@media (min-width: 992px) {
    .sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .brand-link.sgcc-brand-link {
        padding: 0.65rem 0.25rem;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .brand-link.sgcc-brand-link .sgcc-brand-logo {
        margin: 0 auto 0;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .user-panel {
        display: none;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .nav-sidebar > .nav-item > .nav-link {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.72rem 0;
        margin: 2px 0.35rem;
        width: calc(100% - 0.7rem);
    }

    .sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .nav-sidebar > .nav-item > .nav-link .nav-icon {
        margin: 0;
        width: 1.25rem;
        font-size: 1.15rem;
        text-align: center;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .nav-sidebar > .nav-item > .nav-link p,
    .sidebar-mini.sidebar-collapse .main-sidebar:not(:hover):not(.sidebar-focused) .nav-sidebar > .nav-item > .nav-link .right {
        display: none !important;
        width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
    }
}

.main-header.navbar {
    border-bottom: 1px solid var(--sgcc-border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}

/* ── Cabeçalho de página ─────────────────────────────────── */
.sgcc-page-header {
    background: linear-gradient(135deg, var(--sgcc-primary) 0%, var(--sgcc-primary-light) 100%);
    color: #fff;
    border-radius: var(--sgcc-radius);
    padding: 1.35rem 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 14px rgba(30, 58, 95, .18);
}

.sgcc-page-header h1,
.sgcc-page-header h2,
.sgcc-page-header h3 {
    font-weight: 600;
    margin-bottom: .35rem;
    font-size: 1.35rem;
}

.sgcc-page-header p {
    opacity: .92;
    margin-bottom: 0;
    font-size: .92rem;
}

.sgcc-page-header .sgcc-page-actions .btn-light {
    color: var(--sgcc-primary);
    font-weight: 600;
}

/* ── Cards ───────────────────────────────────────────────── */
.content .card {
    border: none;
    border-radius: var(--sgcc-radius);
    box-shadow: var(--sgcc-card-shadow);
    margin-bottom: 1.25rem;
}

.content .card > .card-header {
    background: #fff;
    border-bottom: 1px solid var(--sgcc-border);
    font-weight: 600;
    padding: .85rem 1.25rem;
}

.content .card > .card-header strong,
.content .card > .card-header h5 {
    margin-bottom: 0;
    font-weight: 600;
}

.content .card > .card-body {
    padding: 1.25rem;
}

.content .card > .card-body > h3:first-child,
.content .card > .card-body > h4:first-child {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--sgcc-primary);
    margin-bottom: .5rem;
}

/* ── Info box ────────────────────────────────────────────── */
.sgcc-info-box {
    background: #ebf4ff;
    border-left: 4px solid var(--sgcc-accent);
    border-radius: .35rem;
    padding: .85rem 1rem;
    font-size: .88rem;
    color: #2d3748;
    margin-bottom: 1rem;
}

/* ── Filtros activos ─────────────────────────────────────── */
.sgcc-filter-bar {
    background: #fff;
    border: 1px solid var(--sgcc-border);
    border-radius: var(--sgcc-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--sgcc-card-shadow);
}

.sgcc-filter-bar h5,
.sgcc-filter-bar h6 {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--sgcc-muted);
    margin-bottom: .75rem;
}

.sgcc-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: #f8fafc;
    border: 1px solid var(--sgcc-border);
    border-radius: 2rem;
    padding: .3rem .85rem;
    font-size: .84rem;
    margin: .15rem .3rem .15rem 0;
    color: #495057;
}

.sgcc-filter-chip strong {
    font-weight: 600;
    color: #343a40;
}

/* ── Formulários ─────────────────────────────────────────── */
.content .form-label,
.content label.form-label,
.sgcc-filter-form label {
    font-size: .82rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.content .form-control {
    border-radius: .35rem;
    border-color: #ced4da;
}

.content .form-control:focus {
    border-color: var(--sgcc-accent);
    box-shadow: 0 0 0 .15rem rgba(44, 82, 130, .12);
}

.sgcc-filter-form .form-group {
    margin-bottom: 1rem;
}

/* ── Botões / toolbar ────────────────────────────────────── */
.sgcc-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.content .btn-dark {
    background: var(--sgcc-primary);
    border-color: var(--sgcc-primary);
}

.content .btn-dark:hover {
    background: var(--sgcc-primary-light);
    border-color: var(--sgcc-primary-light);
}

/* ── Tabelas ─────────────────────────────────────────────── */
.content .table-responsive {
    border-radius: var(--sgcc-radius);
    overflow: hidden;
}

.content .card .table {
    margin-bottom: 0;
}

.content .sgcc-table thead th,
.content table.sgcc-table thead th {
    background: var(--sgcc-dark);
    color: #fff;
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    border: none;
    vertical-align: middle;
    white-space: nowrap;
}

.content .sgcc-table tbody td,
.content table.sgcc-table tbody td {
    vertical-align: middle;
    font-size: .88rem;
}

.content .sgcc-table tbody tr:hover,
.content table.sgcc-table tbody tr:hover {
    background-color: #f8f9fb;
}

.content .thead-dark th {
    background: var(--sgcc-dark) !important;
    border-color: #454d55 !important;
    font-size: .76rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.content .table-bordered {
    border: 1px solid var(--sgcc-border);
}

.content .table-bordered th,
.content .table-bordered td {
    border-color: var(--sgcc-border);
}

/* DataTables dentro do content */
.content .dataTables_wrapper .dataTables_length,
.content .dataTables_wrapper .dataTables_filter,
.content .dataTables_wrapper .dataTables_info,
.content .dataTables_wrapper .dataTables_paginate {
    font-size: .88rem;
    padding: .5rem .25rem;
}

.content .dataTables_wrapper .page-item.active .page-link {
    background: var(--sgcc-primary);
    border-color: var(--sgcc-primary);
}

/* ── Stat cards ──────────────────────────────────────────── */
.sgcc-stat-card {
    border: none;
    border-radius: var(--sgcc-radius);
    box-shadow: var(--sgcc-card-shadow);
    transition: transform .15s ease;
    height: 100%;
}

.sgcc-stat-card:hover {
    transform: translateY(-2px);
}

.sgcc-stat-card .stat-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.sgcc-stat-card .stat-label {
    font-size: .75rem;
    color: var(--sgcc-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.sgcc-stat-card .stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #212529;
    line-height: 1.2;
}

/* Info-box do AdminLTE (dashboard) */
.content .info-box {
    border-radius: var(--sgcc-radius);
    box-shadow: var(--sgcc-card-shadow);
    min-height: 88px;
}

.content .info-box-icon {
    border-radius: var(--sgcc-radius) 0 0 var(--sgcc-radius);
}

/* ── Paginação Laravel ───────────────────────────────────── */
.sgcc-pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    background: #f8f9fa;
    border-top: 1px solid var(--sgcc-border);
}

.sgcc-pagination-info {
    font-size: .88rem;
    color: var(--sgcc-muted);
}

.sgcc-per-page {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
}

.sgcc-per-page select {
    width: auto;
    display: inline-block;
    padding: .2rem 1.75rem .2rem .5rem;
    font-size: .85rem;
}

/* ── Estado vazio ────────────────────────────────────────── */
.sgcc-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--sgcc-muted);
}

.sgcc-empty-state i.fa,
.sgcc-empty-state i.fas,
.sgcc-empty-state i.far {
    font-size: 2.75rem;
    opacity: .35;
    margin-bottom: 1rem;
    display: block;
}

/* ── Badges de acção (auditoria etc.) ───────────────────── */
.sgcc-action-badge {
    font-size: .75rem;
    font-weight: 600;
    padding: .4em .7em;
    white-space: nowrap;
}

.sgcc-action-badge i {
    margin-right: .25rem;
}

.sgcc-entity-badge {
    font-size: .72rem;
    font-weight: 600;
    padding: .35em .65em;
    border-radius: .25rem;
    background: #e9ecef;
    color: #495057;
    white-space: nowrap;
}

/* ── Detalhe (dl) ────────────────────────────────────────── */
.sgcc-detail-dl dt {
    font-size: .82rem;
    font-weight: 600;
    color: var(--sgcc-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.sgcc-detail-dl dd {
    color: #212529;
    margin-bottom: .85rem;
}

/* ── Rodapé interno das páginas ──────────────────────────── */
.sgcc-page-footer {
    margin-top: 2rem;
    padding: 1rem 0;
    border-top: 1px solid var(--sgcc-border);
    text-align: center;
    font-size: .82rem;
    color: var(--sgcc-muted);
}

.sgcc-page-footer a {
    color: var(--sgcc-accent);
}

/* Rodapé global (padrão AdminLTE: irmão do content-wrapper) */
.sgcc-site-footer {
    background: var(--sgcc-dark);
    color: rgba(255, 255, 255, .85);
    padding: 1rem 0;
    font-size: .85rem;
}

.sgcc-site-footer a {
    color: #fff;
    text-decoration: underline;
}

.sgcc-site-footer.main-footer {
    border-top: none;
}

.sgcc-auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--sgcc-bg);
}

.sgcc-auth-wrapper .sgcc-auth-body {
    flex: 1 0 auto;
}

.sgcc-auth-wrapper .sgcc-site-footer {
    margin-top: auto;
}

/* ── Alertas ─────────────────────────────────────────────── */
.content .alert {
    border: none;
    border-radius: var(--sgcc-radius);
    border-left: 4px solid;
}

.content .alert-success { border-left-color: #28a745; }
.content .alert-warning { border-left-color: #ffc107; }
.content .alert-danger  { border-left-color: #dc3545; }
.content .alert-info    { border-left-color: #17a2b8; }

/* ── Utilitários ─────────────────────────────────────────── */
.sgcc-text-muted-sm {
    font-size: .85rem;
    color: var(--sgcc-muted);
}

.content .mt-3.card:first-child,
.content > .card:first-child {
    margin-top: 0 !important;
}

/* compatibilidade: classes dos módulos de logs/relatório */
.audit-page-header,
.cert-rel-header {
    background: linear-gradient(135deg, var(--sgcc-primary) 0%, var(--sgcc-primary-light) 100%);
    color: #fff;
    border-radius: var(--sgcc-radius);
    padding: 1.35rem 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 14px rgba(30, 58, 95, .18);
}

.audit-page-header h3,
.cert-rel-header h3 {
    font-weight: 600;
    margin-bottom: .35rem;
}

.audit-page-header p,
.cert-rel-header p {
    opacity: .92;
    margin-bottom: 0;
    font-size: .92rem;
}

.audit-table-card,
.cert-rel-card {
    border: none;
    border-radius: var(--sgcc-radius);
    box-shadow: var(--sgcc-card-shadow);
    overflow: hidden;
}

.audit-filter-chip,
.cert-rel-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: #f8fafc;
    border: 1px solid var(--sgcc-border);
    border-radius: 2rem;
    padding: .3rem .85rem;
    font-size: .84rem;
    margin: .15rem .3rem .15rem 0;
}

.audit-info-box,
.cert-rel-info {
    background: #ebf4ff;
    border-left: 4px solid var(--sgcc-accent);
    border-radius: .35rem;
    padding: .85rem 1rem;
    font-size: .88rem;
    margin-bottom: 1rem;
}

.audit-table thead th,
.cert-rel-table thead th {
    background: var(--sgcc-dark);
    color: #fff;
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    border: none;
}

.audit-pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    background: #f8f9fa;
    border-top: 1px solid var(--sgcc-border);
}

.audit-stat-card,
.cert-rel-stat {
    border: none;
    border-radius: var(--sgcc-radius);
    box-shadow: var(--sgcc-card-shadow);
}

.audit-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--sgcc-muted);
}

.audit-filter-form label,
.cert-rel-filter label {
    font-size: .82rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.audit-modal .modal-header {
    background: var(--sgcc-dark);
    color: #fff;
}

.audit-modal .modal-header .close {
    color: #fff;
    opacity: .8;
}

.audit-detail-card .card-header {
    background: #f8f9fa;
    font-weight: 600;
}

.audit-detail-dl dt {
    font-size: .82rem;
    font-weight: 600;
    color: var(--sgcc-muted);
    text-transform: uppercase;
}

.audit-action-badge,
.sgcc-action-badge {
    font-size: .75rem;
    font-weight: 600;
    padding: .4em .7em;
}

.audit-entity-badge,
.sgcc-entity-badge {
    font-size: .72rem;
    font-weight: 600;
    padding: .35em .65em;
    border-radius: .25rem;
    background: #e9ecef;
    color: #495057;
}

.audit-user-cell .user-name { font-weight: 600; }
.audit-user-cell .user-role { font-size: .78rem; color: var(--sgcc-muted); }
.audit-date-cell .date-main { font-weight: 600; }
.audit-date-cell .date-time { font-size: .78rem; color: var(--sgcc-muted); }
.audit-desc-cell { max-width: 320px; line-height: 1.45; }

.cert-rel-stat .stat-icon,
.audit-stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cert-rel-stat:hover,
.audit-stat-card:hover {
    transform: translateY(-2px);
    transition: transform .15s ease;
}

/* Escola de tutela — dashboard */
.sgcc-tutela-card {
    border: none;
    border-left: 5px solid var(--sgcc-accent);
    background: linear-gradient(135deg, #ebf4ff 0%, #fff 55%);
    box-shadow: 0 4px 16px rgba(44, 82, 130, .12);
}

.sgcc-tutela-card h4 {
    color: var(--sgcc-primary);
}

.sgcc-tutela-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sgcc-primary);
    line-height: 1.2;
}

.sgcc-tutela-stat-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--sgcc-muted);
}

.sgcc-tutela-row {
    background: #ebf4ff !important;
}

.sgcc-tutela-row td {
    border-top-color: #bee3f8 !important;
}

.sgcc-tutela-row strong {
    color: var(--sgcc-primary);
}
