/* =====================================================================
   Utilitários globais — carregado em todas as páginas via adminlte.php
   ===================================================================== */

/* Badge tamanhos extras */
.badge-xs {
    font-size: .72rem;
    font-weight: 700;
    padding: .25em .55em;
    border-radius: .3rem;
    display: inline-block;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
}

.badge-sm {
    font-size: .78rem;
    font-weight: 600;
    padding: .3em .65em;
    border-radius: .3rem;
    display: inline-block;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
}

/* Cor de badge por valor hex inline (usado em status_reserva) */
.badge-hex {
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    padding: .3em .75em;
    border-radius: .35rem;
    display: inline-block;
    line-height: 1;
    white-space: nowrap;
    vertical-align: baseline;
    letter-spacing: .01em;
}

/* Marca do sidebar — badge branco mantém o azul da logo legível em qualquer tema */
.main-sidebar .brand-link {
    background: #fff;
    border-radius: .6rem;
    border-bottom: none;
    margin: .5rem .6rem;
    padding: .45rem .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.main-sidebar .brand-link .brand-image {
    opacity: 1;
    max-height: 30px;
    margin-left: 0;
    margin-right: 0;
}

.main-sidebar .brand-link .brand-text,
.main-sidebar .brand-link .brand-text b,
.brand-link .brand-text {
    color: #0b3d91 !important;
    font-weight: 600;
    margin-left: 0;
}

.main-sidebar .brand-link:hover {
    background: #f4f7fb;
}

.main-sidebar .brand-link:hover .brand-text,
.main-sidebar .brand-link:hover .brand-text b {
    color: #0b3d91 !important;
}

/* Seletor de escola da sessão no menu lateral (so aparece para quem tem
   mais de uma unidade permitida — ver partial escola-context-select) */
.main-sidebar .escola-context-block {
    padding: .55rem 1rem .7rem;
    border-bottom: 1px solid rgba(15, 23, 42, .09);
    margin-bottom: .15rem;
}

.main-sidebar .escola-context-label {
    display: block;
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, .45);
    margin-bottom: .3rem;
}

.main-sidebar .escola-context-select {
    width: 100%;
    height: 34px;
    padding: 4px 30px 4px 10px;
    font-size: .82rem;
    font-weight: 600;
    border-radius: .45rem;
    border: 1px solid #d5d9e0;
    background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23343a40' d='M0 2l4 4 4-4z'/%3E%3C/svg%3E") no-repeat right .6rem center;
    background-size: 9px;
    color: #1f2d3d;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.main-sidebar .escola-context-select:focus {
    border-color: #8fb3e8;
    box-shadow: 0 0 0 2px rgba(11, 61, 145, .15);
    outline: none;
}

.main-sidebar .escola-context-select option {
    color: #1f2d3d;
    background: #fff;
}

/* Dark mode */
.dark-mode .main-sidebar .escola-context-block {
    border-bottom-color: rgba(255, 255, 255, .09);
}

.dark-mode .main-sidebar .escola-context-label {
    color: rgba(255, 255, 255, .5);
}

.dark-mode .main-sidebar .escola-context-select {
    border-color: rgba(255, 255, 255, .2);
    background-color: rgba(255, 255, 255, .09);
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23ffffff' d='M0 2l4 4 4-4z'/%3E%3C/svg%3E");
    color: #fff;
}

.dark-mode .main-sidebar .escola-context-select:focus {
    border-color: rgba(255, 255, 255, .45);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .12);
}

.dark-mode .main-sidebar .escola-context-select option {
    color: #1f2d3d;
    background: #fff;
}

/* =====================================================================
   Abas de conteúdo (nav-tabs-app) — visual de controle segmentado
   ===================================================================== */
.nav-tabs-app {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .3rem;
    background: #edf0f4;
    border: 1px solid #dfe3e9;
    border-radius: .6rem;
}

.nav-tabs-app .nav-item {
    margin-bottom: 0;
}

.nav-tabs-app .nav-link {
    border: none;
    border-radius: .45rem;
    color: #5a6572;
    font-weight: 600;
    font-size: .88rem;
    padding: .45rem .95rem;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.nav-tabs-app .nav-link:hover {
    color: #0b3d91;
    background: rgba(255, 255, 255, .75);
    border-color: transparent;
}

.nav-tabs-app .nav-link:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(11, 61, 145, .25);
}

.nav-tabs-app .nav-link.active,
.nav-tabs-app .nav-item.show .nav-link {
    background: #fff;
    color: #0b3d91;
    border-color: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}

.nav-tabs-app .nav-link.active .badge-light {
    background: #eef3fb;
    border-color: #d5e0f0 !important;
    color: #0b3d91;
}

/* Dark mode */
.dark-mode .nav-tabs-app {
    background: #2b3038;
    border-color: #454d55;
}

.dark-mode .nav-tabs-app .nav-link {
    color: #c2c7d0;
}

.dark-mode .nav-tabs-app .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.dark-mode .nav-tabs-app .nav-link.active,
.dark-mode .nav-tabs-app .nav-item.show .nav-link {
    background: #3f474e;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

.dark-mode .nav-tabs-app .nav-link.active .badge-light {
    background: #4b545c;
    border-color: #5c656e !important;
    color: #e4e9ee;
}

/* Mobile: nav-tabs viram trilha rolavel horizontal em vez de empilhar.
   Cobre todas as telas com abas (aluno, turma, evento, portal etc). */
@media (max-width: 767.98px) {
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .nav-tabs .nav-item { flex-shrink: 0; }
    .nav-tabs .nav-link { white-space: nowrap; }
}

/* =====================================================================
   Mobile — padrões de app: título sem subtítulo, filtros colapsáveis
   (NN/g bottom-sheet, Baymard, Shopify, Material lists)
   ===================================================================== */
@media (max-width: 767.98px) {
    /* Apps exibem só o título no cabeçalho — subtítulo some no celular */
    .page-title__subtitle { display: none; }
    .page-title h3 { font-size: 1.15rem; }

    /* "Itens por página" é controle de densidade de desktop */
    .per-page-selector { display: none !important; }

    /* Filtros: entrada "Filtros" -> bottom sheet de selecao -> chips de retorno
       (padrao NN/g bottom-sheet + Baymard drawer mobile) */
    .filter-card .filter-heading { display: none; }
    .filter-card .filter-toggle-desktop { display: none; }

    /* Scrim: tocar fora fecha o sheet */
    .filter-card .filter-scrim {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .45);
        z-index: 1039;
        opacity: 0;
        visibility: hidden;
        transition: opacity .25s ease, visibility .25s;
    }
    .filter-card.filters-open .filter-scrim { opacity: 1; visibility: visible; }

    /* O form inteiro vira o bottom sheet */
    .filter-card form {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 1040;
        margin: 0;
        background: #fff;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 30px rgba(15, 23, 42, .3);
        padding: 10px 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
        max-height: 82vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateY(105%);
        visibility: hidden;
        transition: transform .28s ease, visibility .28s;
    }
    .filter-card.filters-open form { transform: translateY(0); visibility: visible; }

    /* Handle de arraste no topo do sheet */
    .filter-card form::before {
        content: '';
        display: block;
        width: 42px;
        height: 4px;
        border-radius: 999px;
        background: #e2e8f0;
        margin: 0 auto 8px;
    }

    /* Header do sheet: titulo + botao fechar */
    .filter-card .filter-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: .65rem;
    }
    .filter-card .filter-sheet-title {
        font-size: .8rem;
        font-weight: 800;
        color: #334155;
        text-transform: uppercase;
        letter-spacing: .06em;
    }
    .filter-card .filter-sheet-close {
        width: 34px;
        height: 34px;
        border: none;
        border-radius: 50%;
        background: #f1f5f9;
        color: #475569;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: .9rem;
    }

    /* Campos empilhados em coluna unica com alvos >= 40px */
    .filter-card form .filter-field {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: .15rem;
    }
    .filter-card form .form-control,
    .filter-card form .select2-selection { min-height: 40px; }
    .filter-card .filter-field .select2-selection__rendered { line-height: 38px; }

    /* Rodape do sheet: "Filtrar" grande como botao de aplicar (sticky) */
    .filter-card form .filter-actions {
        flex: 0 0 100%;
        max-width: 100%;
        margin-top: .5rem;
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: .35rem 0;
    }
    .filter-card form .filter-actions button[type="submit"] {
        flex: 1;
        height: 42px;
        font-size: .85rem;
    }
    .filter-card.filters-open #additional-filters { display: flex !important; }

    /* Dark mode */
    .dark-mode .filter-card form { background: #2b3038; box-shadow: 0 -8px 30px rgba(0,0,0,.5); }
    .dark-mode .filter-card form::before { background: #4b5563; }
    .dark-mode .filter-card .filter-sheet-title { color: #e4e9ee; }
    .dark-mode .filter-card .filter-sheet-close { background: #3f474e; color: #c2c7d0; }
    .dark-mode .filter-card form .filter-actions { background: #2b3038; }
}
