/**
 * Visual inspirado em painéis admin estilo Nowa (Bootstrap 5):
 * sidebar escura, superfícies claras, cantos suaves.
 * Não substitui os assets oficiais do tema Nowa (licença Spruko).
 */

:root {
    --nowa-sidebar-bg: #111827;
    --nowa-sidebar-hover: rgba(255, 255, 255, 0.08);
    --nowa-accent: #6366f1;
    --nowa-auth-gradient-1: #1e1b4b;
    --nowa-auth-gradient-2: #312e81;
    --nowa-auth-gradient-3: #4338ca;
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
}

.btn-primary {
    --bs-btn-bg: #4f46e5;
    --bs-btn-border-color: #4f46e5;
    --bs-btn-hover-bg: #4338ca;
    --bs-btn-hover-border-color: #4338ca;
    --bs-btn-active-bg: #3730a3;
    --bs-btn-active-border-color: #3730a3;
}

/* ——— Auth (login / cadastro) ——— */
.layout-auth {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--nowa-auth-gradient-1) 0%, var(--nowa-auth-gradient-2) 45%, var(--nowa-auth-gradient-3) 100%);
}

.layout-auth .auth-page {
    min-height: 100vh;
}

.layout-auth .auth-logo {
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.35rem;
}

.layout-auth .auth-card .card-body {
    padding: 2rem;
}

@media (min-width: 576px) {
    .layout-auth .auth-card .card-body {
        padding: 2.25rem 2.5rem;
    }
}

/* ——— App shell ——— */
.layout-app {
    height: 100vh;
    overflow: hidden;
}

.layout-app .app-shell {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.layout-app .app-sidebar {
    width: 260px;
    background: var(--nowa-sidebar-bg);
    flex-shrink: 0;
    height: 100%;
    max-height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.layout-app .app-main {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.layout-app .sidebar-logo {
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(145deg, var(--nowa-accent), #4f46e5);
    color: #fff;
    font-size: 1.1rem;
}

.layout-app .sidebar-link {
    transition: background 0.15s ease, color 0.15s ease;
}

.layout-app .sidebar-link:not(.disabled):hover {
    background: var(--nowa-sidebar-hover);
    color: #fff !important;
}

.layout-app .sidebar-link.active {
    background: var(--nowa-sidebar-hover);
    color: #fff !important;
    box-shadow: inset 3px 0 0 var(--nowa-accent);
}

.layout-app .sidebar-link.disabled {
    cursor: not-allowed;
    pointer-events: none;
}

.layout-app .app-header {
    z-index: 1020;
}

.layout-app .app-content {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

@media (max-width: 991.98px) {
    .layout-app {
        height: auto;
        overflow: visible;
    }

    .layout-app .app-shell {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .layout-app .app-main {
        overflow: visible;
    }

    .layout-app .app-sidebar {
        width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    .layout-app .sidebar-brand {
        border-bottom: none !important;
        flex: 1 1 auto;
    }
    .layout-app .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        width: 100%;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    .layout-app .sidebar-nav .text-uppercase {
        width: 100%;
    }
    .layout-app .sidebar-footer {
        width: 100%;
    }
}

/* ——— Lista de boletos (tabela no card com cantos arredondados) ——— */
.card.card-boletos-lista .table-boletos-lista-wrap {
    margin: 0;
}

.table-boletos-lista thead th {
    font-size: 0.8125rem;
    vertical-align: middle;
}

.table-boletos-lista tbody td {
    vertical-align: middle;
}

/* Atraso: barra interna (não corta com overflow do card) + fundo suave */
.table-boletos-lista tbody tr.boleto-atraso {
    background-color: rgba(var(--bs-danger-rgb), 0.07);
}

.table-boletos-lista tbody tr.boleto-atraso td:first-child {
    box-shadow: inset 4px 0 0 rgba(var(--bs-danger-rgb), 0.88);
    padding-left: calc(0.75rem + 3px);
}

.table-boletos-lista tbody tr.boleto-unidade-inativa:not(.boleto-atraso) {
    background-color: rgba(var(--bs-warning-rgb), 0.1);
}

.table-boletos-lista tbody tr.boleto-unidade-inativa.boleto-atraso {
    background-color: rgba(var(--bs-danger-rgb), 0.06);
    box-shadow: inset 0 0 0 9999px rgba(var(--bs-warning-rgb), 0.08);
}

/* ——— Barra de ações das listas admin (filtros + botão novo) ——— */
.admin-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-list-toolbar__intro {
    flex: 1 1 14rem;
    min-width: 0;
}

.admin-list-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.admin-list-actions .btn-group {
    display: inline-flex;
    align-items: stretch;
    flex-shrink: 0;
}

.admin-list-actions .btn-group > .btn,
.admin-list-actions > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    line-height: 1.25;
    white-space: nowrap;
}

.admin-list-actions .btn-group > .btn {
    border-radius: 0;
}

.admin-list-actions .btn-group > .btn:first-child {
    border-top-left-radius: 50rem;
    border-bottom-left-radius: 50rem;
}

.admin-list-actions .btn-group > .btn:last-child {
    border-top-right-radius: 50rem;
    border-bottom-right-radius: 50rem;
}

.admin-list-actions > .btn.btn-primary {
    border-radius: 50rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 768px) {
    .admin-list-actions {
        flex-wrap: nowrap;
    }
}

/* ——— Cookies (LGPD) ——— */
.cookie-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1080;
    padding: 0.75rem 1rem 1rem;
    pointer-events: none;
}

.cookie-consent-banner--visible {
    pointer-events: auto;
}

.cookie-consent-inner {
    max-width: 56rem;
    margin: 0 auto;
}

.cookie-consent-reopen {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: auto;
    z-index: 1070;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.12);
}

/* Painel com sidebar: preferências no rodapé da área principal, não sobre o menu */
.layout-app .cookie-consent-reopen {
    display: none !important;
}

.cookie-consent-reopen-footer {
    font-size: inherit;
    vertical-align: baseline;
    text-decoration: none;
}

.cookie-consent-reopen-footer:hover {
    text-decoration: underline;
}

.layout-auth .auth-card.politica-privacidade-card,
.layout-auth .auth-card:has(.politica-privacidade-body) {
    max-width: 42rem;
}

.politica-privacidade-body {
    padding: 2rem;
}

.politica-privacidade-text ul {
    padding-left: 1.25rem;
}

body.cookie-consent-active .app-footer,
body.cookie-consent-active.layout-auth .auth-page {
    padding-bottom: 5.5rem;
}

/* ——— Espelho SaaS (controlador) ——— */
.saas-espelho-banner .alert {
    font-size: 0.8125rem;
}

/* ——— Ambiente de testes (slug demo) ——— */
.ambiente-teste-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    color: #422006;
    border-bottom: 1px solid #d97706;
}

.ambiente-teste-banner strong {
    font-weight: 700;
}

.ambiente-teste-banner--app {
    flex-shrink: 0;
}

.ambiente-teste-banner--auth {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
}

.layout-auth.ambiente-teste .auth-page {
    padding-top: 3.5rem;
}
