/*****************************************
 * ControllTag — Layout aplicacao autenticada
 *****************************************/

:root {
    --sidebar-width: 260px;
    --header-mobile-height: 64px;
    --sidebar-bg: linear-gradient(165deg, #0e446d 0%, #0a3558 55%, #062a45 100%);
    --sidebar-hover: rgba(255, 255, 255, 0.12);
    --sidebar-active: rgba(255, 255, 255, 0.18);
    --topbar-bg: #ffffff;
    --transition-fast: 0.2s ease;
}

/* ---- Shell ---- */
#body-site {
    padding: 28px 32px 40px calc(var(--sidebar-width) + 24px);
    min-height: 100vh;
    transition: padding var(--transition-fast);
}

.app-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.app-page-header .page-title-block {
    flex: 1;
    min-width: 200px;
}

.app-page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---- Sidebar ---- */
#menu-cabecalho {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 88px;
    padding: 20px 22px;
    background: var(--topbar-bg);
    border-right: 1px solid rgba(14, 68, 109, 0.08);
    box-shadow: none;
    z-index: 1040;
    display: flex;
    align-items: center;
}

#menu-cabecalho img {
    max-width: 170px;
    height: auto;
}

#menu {
    position: fixed;
    left: 0;
    top: 88px;
    width: var(--sidebar-width);
    bottom: 0;
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 1030;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

#menu .menu-opcoes {
    padding: 12px 12px 100px;
}

#menu .menu-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 4px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    cursor: pointer;
}

#menu .menu-nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    opacity: 0.9;
}

#menu .menu-nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    opacity: 1;
}

#menu .menu-nav-link.ativo {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

#menu .menu-nav-link.opcao-logout {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
}

#menu .menu-nav-link.menu-opcao-primus {
    background: rgba(206, 119, 48, 0.25);
    border: 1px solid rgba(206, 119, 48, 0.45);
    margin-top: 12px;
}

#menu .menu-nav-link.menu-opcao-primus:hover {
    background: rgba(206, 119, 48, 0.4);
}

#menu-rodape {
    position: fixed;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1041;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

#menu-rodape .menu-user-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#menu-rodape .menu-user-meta {
    font-size: 11px;
    opacity: 0.7;
}

/* Mobile top bar */
#menu-mobile-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-mobile-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid rgba(14, 68, 109, 0.1);
    z-index: 1050;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
}

#menu-mobile-bar img {
    max-height: 36px;
}

#menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1025;
}

#menu-hamburguer,
#menu-icone {
    display: none;
}

#menu-icone-hamburguer {
    display: flex;
    align-items: center;
}

#menu-hamburguer-label {
    cursor: pointer;
    padding: 8px;
}

#hamburguer,
#hamburguer::before,
#hamburguer::after {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--cor-tema);
    border-radius: 2px;
    transition: var(--transition-fast);
}

#hamburguer {
    position: relative;
}

#hamburguer::before,
#hamburguer::after {
    content: '';
    position: absolute;
    left: 0;
}

#hamburguer::before { top: -7px; }
#hamburguer::after { bottom: -7px; }

#menu-hamburguer:checked ~ #menu-hamburguer-label #hamburguer {
    background: transparent;
}

#menu-hamburguer:checked ~ #menu-hamburguer-label #hamburguer::before {
    transform: rotate(45deg);
    top: 0;
}

#menu-hamburguer:checked ~ #menu-hamburguer-label #hamburguer::after {
    transform: rotate(-45deg);
    bottom: 0;
}

@media screen and (max-width: 1024px) {
    #body-site {
        padding: calc(var(--header-mobile-height) + 20px) 16px 32px 16px;
    }

    #menu-mobile-bar {
        display: flex;
    }

    #menu-cabecalho {
        display: none;
    }

    #menu {
        top: 0;
        left: -280px;
        width: 280px;
        transition: left 0.3s ease;
        padding-top: var(--header-mobile-height);
    }

    #menu.menu-aberto {
        left: 0;
    }

    #menu-rodape {
        width: 280px;
        left: -280px;
        transition: left 0.3s ease;
    }

    #menu-rodape.menu-aberto {
        left: 0;
    }

    #menu-overlay.visivel {
        display: block;
    }
}

@media screen and (min-width: 1025px) {
    #menu-icone-hamburguer {
        display: none;
    }
}

/* ---- Cards & tables globais ---- */
.app-card {
    background: var(--cor-card);
    border-radius: var(--radius-card);
    box-shadow: var(--sombra-card);
    padding: 20px 24px;
    border: 1px solid rgba(14, 68, 109, 0.06);
}

.app-card-table {
    padding: 8px 16px 16px;
}

/* ---- Forms ---- */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #dde3ea;
    padding: 0.55rem 0.85rem;
    font-size: 14px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--cor-tema);
    box-shadow: 0 0 0 3px rgba(14, 68, 109, 0.15);
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.45rem 1rem;
}

.btn-dark {
    background: var(--cor-tema);
    border-color: var(--cor-tema);
}

.btn-dark:hover {
    background: #0a3558;
    border-color: #0a3558;
}

/* DataTables BS5 */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1px solid #dde3ea;
    padding: 6px 10px;
}

table.dataTable thead th {
    border-bottom: 2px solid #e8edf2 !important;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cor-texto-suave);
}

table.dataTable tbody tr:hover {
    background-color: rgba(14, 68, 109, 0.04);
}
