/* Mig.Core.LibUI - CSS Complementar ao Adminto */
/* Layout principal vem do app.min.css do Adminto */
/* Este arquivo contem apenas estilos extras: login, modais, branding */

/* ============================================= */
/* Login Page                                     */
/* ============================================= */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-logo {
    max-height: 60px;
    margin-bottom: 20px;
}

.login-providers {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.btn-provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background .2s;
}
.btn-provider:hover { background: #f5f5f5; }
.btn-microsoft { color: #00a4ef; }
.btn-google { color: #4285f4; }

.login-separator {
    margin: 20px 0;
    position: relative;
    text-align: center;
}
.login-separator::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 1px;
    background: #e0e0e0;
}
.login-separator span {
    position: relative;
    background: #fff;
    padding: 0 10px;
    color: #999;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 16px;
    font-size: 14px;
}
.btn-submit:hover { background: #2980b9; }

.login-footer {
    margin-top: 20px;
}
.login-footer a {
    color: #007bff;
    text-decoration: none;
    font-size: 13px;
}

/* ============================================= */
/* App Launcher Modal                             */
/* ============================================= */
.app-launcher-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 16px;
}

.module-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-color, #f5f5f5);
    color: var(--fg-color, #333);
    border-radius: 8px;
    text-decoration: none;
    transition: transform .2s, box-shadow .2s;
    min-height: 120px;
}
.module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.module-icon { font-size: 48px; margin-bottom: 8px; }
.module-name { font-weight: 500; text-align: center; font-size: 14px; }

/* ============================================= */
/* Company Selector Modal                         */
/* ============================================= */
.company-group { margin-bottom: 24px; }
.company-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 8px;
}
.profile-list { display: flex; flex-direction: column; gap: 4px; }
.profile-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: background .2s;
}
.profile-item:hover { background: #f5f5f5; }
.profile-item.active { background: #3498db; color: #fff; border-color: #3498db; }
.badge-default {
    margin-left: auto;
    padding: 2px 8px;
    background: #ffc107;
    color: #000;
    border-radius: 12px;
    font-size: 11px;
}

/* ============================================= */
/* Navbar custom adjustments                      */
/* ============================================= */
.app-topbar .navbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

/* ============================================= */
/* Layout fixes                                   */
/* ============================================= */

/* Reduzir topbar height e eliminar espaco branco */
:root { --ct-topbar-height: 56px; }

/* O Adminto adiciona um spacer .page-title-head de 85px — remover */
.page-title-head { height: 0 !important; display: none !important; }

/* Reducao de padding no page-content */
.page-content { padding-top: 10px !important; }
.page-content > .container-fluid { padding-top: 0; }

/* Sidebar toggle: recolher sidebar em vez de sobrepor */
/* !important necessario — Adminto tem .side-nav-item:hover .menu-text{display:flex} que sobrepoe sem isso */
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav-title,
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav-link .menu-text,
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav-link .menu-arrow,
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav-link .badge {
    display: none !important;
}
html[data-sidenav-size="condensed"] .sidenav-menu {
    width: 70px !important;
    overflow: visible;
}
html[data-sidenav-size="condensed"] .page-content {
    margin-left: 70px;
}

/* Sidebar condensed: constrain link e item ao 70px da sidebar */
/* Sem isso, .side-nav-link.active herda largura do menu nao-condensado */
/* e cria faixa azul estourando pra direita sobre o conteudo. */
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav-item,
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav-link {
    width: 70px !important;
    max-width: 70px !important;
    box-sizing: border-box;
    overflow: hidden;
    text-align: center;
    justify-content: center;
}

/* Centralizar icone no item recolhido */
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav-link > i {
    margin: 0 auto;
}

/* Botoes compactos nos grids */
.btn-xs {
    padding: 2px 6px;
    font-size: 12px;
    line-height: 1.4;
    border-radius: 3px;
}

/* AG Grid: habilitar tooltip nos headers */
.ag-header-cell[col-id] { overflow: visible; }
.ag-header-center .ag-header-cell-label { justify-content: center; }

/* Master/detail — linha de detalhe injetada abaixo da linha do grid */
.grid-detail-row {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 12px 16px;
    margin: -1px 0 4px 0;
    box-shadow: inset 0 2px 0 0 #3498db;
}
.grid-detail-row table { margin-bottom: 0; }
.grid-expand-icon { color: #6c757d; transition: color .15s; }
.grid-expand-icon:hover { color: #3498db; }

/* JSON textarea feedback de validacao (complementa Bootstrap .is-invalid) */
textarea.is-invalid { border-color: #dc3545; background-image: none; padding-right: .75rem; }
textarea.is-valid { border-color: #28a745; background-image: none; padding-right: .75rem; }

/* Tree filter — componente reutilizavel */
.tree-filter .btn.active {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

/* jsTree: destaque do termo buscado */
.jstree-search { font-weight: 700; color: #e67e22; }

/* ============================================= */
/* Branding por modulo                            */
/* --brand-primary / --brand-secondary sao injetadas */
/* em :root por LibUI.branding.applyTheme. Sem var */
/* definida o fallback preserva o tema Adminto.    */
/* ============================================= */

/* Topbar: usa branding como cor de fundo. !important para vencer a cascata
   do tema Adminto (que define background-color: #fff em #header.app-topbar).
   Fallback transparente => preserva o branco/escuro do Adminto. */
#header.app-topbar,
.app-topbar {
    background-color: var(--brand-primary, transparent) !important;
}

/* Quando ha branding ativo, o texto/icones do topbar usam a cor secundaria
   para garantir contraste/visibilidade sobre a cor primaria. */
.app-topbar,
.app-topbar #app-name,
.app-topbar .text-dark,
.app-topbar .btn,
.app-topbar .btn i,
.app-topbar .dropdown-toggle,
.app-topbar .form-control::placeholder {
    color: var(--brand-secondary, inherit);
}
.app-topbar .form-control {
    background-color: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    color: var(--brand-secondary, inherit);
}

/* Sidebar: borda lateral colorida — acento sutil que nao quebra o tema */
.sidenav-menu {
    border-left: 3px solid var(--brand-primary, transparent);
}

/* Login: gradiente substituido pela cor de branding quando definida */
.login-page {
    background: var(--brand-primary, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
}
