﻿/* ==========================================================================
   APP.CSS - ESTILOS DO SISTEMA iNove Go
   ==========================================================================
   ESTRATÉGIA: "Bulma 1.0 First"
   ==========================================================================
   
   📌 SOBRE ESTE ARQUIVO:
   - Apenas customizações mínimas sobre o Bulma 1.0
   - Mantém compatibilidade com temas (dark/light)
   - ~300 linhas de CSS focado no essencial
   
   📌 REGRAS:
   - Carregar SEMPRE depois do bulma.min.css
   - !important só quando o Bulma usar !important ou especificidade maior
   - Preferir classes customizadas a sobrescrever Bulma
   - Comentar o PORQUÊ, não o O QUÊ
   ========================================================================== */

/* ==========================================================================
   1. TELAS E NAVEGAÇÃO (SCREEN & APP PAGES)
   ========================================================================== */

.screen {
    display: none;
    min-height: 100vh;
    background-color: var(--bulma-background);
}

    .screen.active {
        display: block;
    }

.auth-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Animação das Telas */
.app-page {
    display: none;
    animation: fadeIn 0.3s;
}

    .app-page.active {
        display: block;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==========================================================================
   2. ESTRUTURA DO MENU (SIDEBAR & OVERLAY)
   ========================================================================== */

.menu-hamburger {
    display: none;
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 99;
}

.sidebar {
    position: fixed;
    left: -250px;
    top: 0;
    height: 100vh;
    width: 250px;
    transition: left 0.3s;
    z-index: 100;
    background-color: var(--bulma-background);
    border-right: 1px solid var(--bulma-border);
}

    .sidebar.active {
        left: 0;
    }

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
}

    .overlay.active {
        display: block;
    }

/* ==========================================================================
   3. ESTILIZAÇÃO DO MENU BULMA (SUBMENUS & RESET)
   ========================================================================== */

/* Reset do menu — classes suas/combinadas, sem competição real */
aside.menu,
.menu-list a {
    border-radius: 0;
}

.menu-list li {
    margin-bottom: 0;
}

/* Reset de recuos dos submenus customizados (.menu-sublist* são suas classes) */
.menu-list ul.menu-sublist,
.menu-list ul.menu-sublist-inner {
    margin: 0;
    padding-left: 0;
    border-left: none;
}

/* Transições */
.menu-list a {
    transition: background-color 0.25s ease, color 0.25s ease, padding-left 0.25s ease;
}

/* Nível 1 - Itens principais */
.menu-list > li > a:hover {
    background-color: var(--bulma-primary);
    color: var(--bulma-primary-invert);
}

/* Nível 2 - Submenu "Outros" */
.menu-list ul.menu-sublist a {
    background-color: var(--bulma-background-hover);
}

    .menu-list ul.menu-sublist a:hover {
        background-color: var(--bulma-primary);
        color: var(--bulma-primary-invert);
    }

/* Nível 3 - Subitens */
.menu-list ul.menu-sublist-inner a:hover {
    background-color: var(--bulma-primary);
    color: var(--bulma-primary-invert);
}

/* Botão "Outros" expansível (classe sua) */
.menu-expansivel {
    background-color: var(--bulma-background-hover);
    color: var(--bulma-text-strong);
    font-weight: 500;
}

    .menu-expansivel:hover {
        background-color: var(--bulma-primary);
        color: var(--bulma-primary-invert);
    }

/* ==========================================================================
   4. FORMULÁRIOS & COMPONENTES (CHECKBOX & SELECT)
   ========================================================================== */

/* Checkbox ajustado */
input[type="checkbox"] {
    transform: scale(1.4);
    margin-right: 0.5rem;
    margin-left: 0.2rem;
    cursor: pointer;
}

/* Select com erro - apenas borda vermelha
   !important no ::after porque o Bulma define a seta com especificidade alta
   via múltiplos :not() — mais fácil forçar do que replicar a cadeia. */
.select.is-danger select {
    border-color: var(--bulma-danger);
}

.select.is-danger:not(.is-multiple):not(.is-loading)::after {
    border-color: var(--bulma-danger) !important;
}

.select.is-danger select:focus {
    box-shadow: 0 0 0 0.125em var(--bulma-danger-focus);
}

/* ==========================================================================
   5. RESPONSIVIDADE & ESCALA MOBILE
   ========================================================================== */

@media screen and (max-width: 768px) {
    html {
        font-size: 85%;
    }
}

/* ==========================================================================
   6. AJUSTES PONTUAIS - CORREÇÕES MÍNIMAS
   ========================================================================== */

/* Recuo lateral nas tabs */
.tabs:not(:last-child):not(.is-small) {
    padding: 0 10px;
}

/* Espaçamento compacto em formulários */
.box .columns {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    margin-top: -0.25rem;
}

    .box .columns > .column {
        padding: 0.25rem;
    }

/* HR — Bulma 1.0 redefine <hr> de forma agressiva; aqui forçamos o visual
   simples. !important mantido porque o Bulma usa seletores compostos
   (ex: hr:not(:last-child)) que ganham de "hr" puro. */
hr,
hr.has-background-grey {
    display: block;
    height: 1px;
    border: none;
    background-color: var(--bulma-border) !important;
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
    opacity: 1 !important;
}

    hr::before,
    hr::after {
        content: none !important;
        display: none !important;
    }

/* ==========================================================================
   7. CORREÇÃO: MODAL FICA ACIMA DO BOTÃO HAMBURGUER
   ========================================================================== */

/* z-index do Bulma em .modal já é alto; manter !important como defesa
   caso a ordem de carregamento mude em algum bundle futuro. */
.modal {
    z-index: 1000 !important;
}

.modal-background {
    z-index: 999 !important;
}

.modal-card {
    z-index: 1000 !important;
}

.menu-hamburger {
    z-index: 100;
}

/* ==========================================================================
   8. BARRA DE LOADING COM BRILHO (TOP LOADING BAR)
   ========================================================================== */

#custom-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    z-index: 9999;
    display: none;
    overflow: hidden;
    background: var(--bulma-background);
    border-bottom: 1px solid var(--bulma-border);
}

.progress-bar-animated {
    width: 100%;
    height: 100%;
    animation: loading-progress 1.5s ease-in-out infinite;
    transform-origin: 0% 50%;
    background-size: 200% 100%;
    position: relative;
}

    .progress-bar-animated::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 100px;
        height: 100%;
        animation: glow-effect 1s ease-in-out infinite;
        filter: blur(2px);
    }

/* Tema Escuro */
html[data-theme="dark"] .progress-bar-animated {
    background: linear-gradient(90deg, var(--bulma-primary) 0%, var(--bulma-info) 50%, var(--bulma-primary) 100%);
    box-shadow: 0 0 20px rgba(0, 209, 178, 0.2);
}

    html[data-theme="dark"] .progress-bar-animated::after {
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3) 30%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.3) 70%, transparent);
    }

/* Tema Claro */
html[data-theme="light"] .progress-bar-animated {
    background: linear-gradient(90deg, var(--bulma-primary) 0%, var(--bulma-info) 50%, var(--bulma-primary) 100%);
    filter: brightness(0.5);
    box-shadow: 0 0 25px rgba(0, 209, 178, 0.25);
}

    html[data-theme="light"] .progress-bar-animated::after {
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85) 30%, rgba(255, 255, 255, 1) 50%, rgba(255, 255, 255, 0.85) 70%, transparent);
    }

@keyframes loading-progress {
    0% {
        transform: translateX(-100%) scaleX(0.3);
    }

    50% {
        transform: translateX(0%) scaleX(0.9);
    }

    100% {
        transform: translateX(100%) scaleX(0.3);
    }
}

@keyframes glow-effect {
    0%, 100% {
        opacity: 0.1;
    }

    50% {
        opacity: 1;
    }
}

/* ==========================================================================
   9. PERSONALIZAÇÃO DA SCROLLBAR (TEMA CLARO/ESCURO)
   ========================================================================== */

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bulma-background);
}

::-webkit-scrollbar-thumb {
    background: var(--bulma-border);
    border-radius: 6px;
    border: 2px solid var(--bulma-background);
}

* {
    scrollbar-color: var(--bulma-border) var(--bulma-background);
}

/* ==========================================================================
   10. UTILITÁRIOS GERAIS
   ========================================================================== */

#top-loading-bar progress {
    height: 4px;
    border-radius: 0;
}

/* ==========================================================================
   11. TABELAS - PADRÃO BULMA
   ========================================================================== */

/*
   O Bulma já lida com rolagem horizontal via .table-container.
   Mantemos o comportamento padrão do Bulma, apenas reforçando auto
   (vertical + horizontal) e largura total.
*/

.table-container {
    overflow: auto;
    max-width: 100%;
}

    .table-container table {
        width: 100%;
    }

/* ==========================================================================
   12. DROPDOWN GENÉRICO - ESTILO BASE
   ========================================================================== */

/* Trigger - Remove seta padrão do Bulma */
.dropdown .dropdown-trigger .button::after {
    display: none;
}

/* Chevron (classe sua) - Transição suave */
.dropdown-chevron {
    transition: transform 0.25s ease;
    font-size: 0.7rem;
}

.dropdown.is-active .dropdown-chevron {
    transform: rotate(180deg);
}

/* Menu - Estilo e posicionamento */
.dropdown .dropdown-menu {
    min-width: 200px;
    padding-top: 4px;
}

/* Alinhamento à direita (quando necessário) */
.dropdown-right .dropdown-menu {
    left: auto;
    right: 0;
}

/* Content */
.dropdown .dropdown-content {
    background-color: var(--bulma-scheme-main);
    border: 1px solid var(--bulma-border);
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    padding: 4px 0;
}

/* Items */
.dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--bulma-text);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
    border: none;
    background: transparent;
}

    .dropdown .dropdown-item i {
        width: 1.2rem;
        text-align: center;
        font-size: 0.95rem;
    }

    .dropdown .dropdown-item:hover {
        background-color: var(--bulma-primary);
        color: var(--bulma-primary-invert);
    }

/* Divider */
.dropdown .dropdown-divider {
    margin: 0.25rem 0.5rem;
    border: none;
    border-top: 1px solid var(--bulma-border);
    height: 1px;
}

/* Overflow - Garante que o dropdown não seja cortado
   !important defensivo: o Bulma aplica overflow:hidden em alguns containers
   (.box, .card, etc.) e precisamos furar isso sem depender de ordem. */
.box .dropdown {
    overflow: visible !important;
}


/* ==========================================================================
   13. CORES DE TEXTO FADE GERAL E CORES ADAPTATIVAS PARA ELEMENTOS E LINHAS (TR)
   ========================================================================== */
/*
   USO:
   <tr class="is-text-info-adaptive"> -> Azul adaptativo
   <tr class="is-text-danger-adaptive"> -> Vermelho adaptativo
   <tr class="is-text-success-adaptive"> -> Verde adaptativo
   <tr class="is-text-warning-adaptive"> -> Amarelo adaptativo
   <tr class="is-text-grey-adaptive"> -> Cinza adaptativo
   ========================================================================== */

.is-faded {
    opacity: 0.5;
}

/* Tema CLARO: texto ESCURO */
html[data-theme="light"] {
    --bulma-adaptive-info: #0000DD;
    --bulma-adaptive-info2: #000088;
    --bulma-adaptive-danger: #DD0000;
    --bulma-adaptive-success: #00BB00;
    --bulma-adaptive-warning: #AAAA00;
    --bulma-adaptive-grey: #666666;
}

/* Tema ESCURO: texto CLARO */
html[data-theme="dark"] {
    --bulma-adaptive-info: #CCCCFF;
    --bulma-adaptive-info2: #CCCCDD;
    --bulma-adaptive-danger: #EECCCC;
    --bulma-adaptive-success: #CCEECC;
    --bulma-adaptive-warning: #DDDDAA;
    --bulma-adaptive-grey: #AAAAAA;
}

/* Classes para elementos e TR
   !important mantido: aqui você quer GANHAR de classes utilitárias do Bulma
   como .has-text-grey ou .has-text-danger, que também definem color. */
.is-text-info-adaptive,
tr.is-text-info-adaptive td,
tr.is-text-info-adaptive th {
    color: var(--bulma-adaptive-info) !important;
}

.is-text-info2-adaptive,
tr.is-text-info2-adaptive td,
tr.is-text-info2-adaptive th {
    color: var(--bulma-adaptive-info2) !important;
}

.is-text-danger-adaptive,
tr.is-text-danger-adaptive td,
tr.is-text-danger-adaptive th {
    color: var(--bulma-adaptive-danger) !important;
}

.is-text-success-adaptive,
tr.is-text-success-adaptive td,
tr.is-text-success-adaptive th {
    color: var(--bulma-adaptive-success) !important;
}

.is-text-warning-adaptive,
tr.is-text-warning-adaptive td,
tr.is-text-warning-adaptive th {
    color: var(--bulma-adaptive-warning) !important;
}

.is-text-grey-adaptive,
tr.is-text-grey-adaptive td,
tr.is-text-grey-adaptive th {
    color: var(--bulma-adaptive-grey) !important;
}

/* ==========================================================================
   TAMANHOS DE TEXTO PERSONALIZADOS
   ========================================================================== */

.is-size-8 {
    font-size: 0.6rem;
}

.is-size-9 {
    font-size: 0.5rem;
}

/* ==========================================================================
   14. DASHBOARD - FUNDO ADAPTATIVO SUTIL PARA BOXES
   ========================================================================== */

/*
   USO: <div class="box box-dash">
   Apenas um fundo levemente diferente do padrão, adaptativo ao tema.
   !important defensivo: .box do Bulma define background-color;
   como .box-dash costuma vir junto de .box, empate de especificidade.
*/

.box-dash {
    background-color: var(--bulma-scheme-main-bis) !important;
    transition: background-color 0.3s ease;
}

/* ==========================================================================
   15. Grupo expansível (accordion)
   ========================================================================== */

.accordion-toggle {
    display: none;
}

.accordion-header {
    cursor: pointer;
    user-select: none;
    padding: 0 0 4px 0;
}

    .accordion-header::after {
        content: "▸";   
        float: right;
        transition: transform 0.2s;
    }

.accordion-content {
    display: none;
}

    /* Panel-block interno: caixinha destacada, sem padding do Bulma */
    .accordion-content .panel-block {
        display: block;
        background-color: var(--bulma-scheme-main-bis);
        border-radius: 8px;
    }

.accordion-toggle:checked ~ .accordion-content {
    display: block;
    animation: fadeIn 0.2s ease;
}

.accordion-toggle:checked ~ .accordion-header::after {
    transform: rotate(90deg);
}