/* ========================================================================== */
/* 1. GLOBAL STYLES & VARIABLES (Tema Dark Premium - 3TKC) */
/* ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;800&display=swap");

:root {
    /* Cores Globais e do Layout Base */
    --Conteiner_MenurLateral_Topo: #212b30; 
    --Butoes_MenurLateral: #8aa4af; 
    --bg-main: #222222;
    --bg-panel: #2a2a2a; 
    --primary-color: #8aa4af; 
    --primary-hover: #0096b4;
    --accent-color: #f77f00;  
    --success-color: #06d6a0; 
    --danger-color: #ff4d4d;  
    --text-light: #ffffff;
    --text-muted: #a0a0a0;
    --border-color: #444444;
    --border-light: rgba(255, 255, 255, 0.08);
    --border-radius: 12px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    --box-shadow-hover: 0 15px 35px rgba(0, 180, 216, 0.15); 
    --transition-speed: 0.3s;
    
    /* Dimensões do Layout Base */
    --sidebar-width-collapsed: 80px;
    --sidebar-width-expanded: 260px;
    --header-height: 60px;
}

/* Reset Básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-light);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

#app-main-content h1 {
    margin-top: 0; 
    padding-top: 0;
    margin-bottom: 0.5rem;
    font-size: 22px;
    font-weight: 800;
    color: black;
}

/* ========================================================================== */
/* 2. HEADER / NAVBAR (Topo) */
/* ========================================================================== */
nav#navbar_id {
    background-color: var(--Conteiner_MenurLateral_Topo);
    height: 49px;
    color: var(--text-light);
    position: fixed;
    top: 0;
    /* left: var(--sidebar-width-collapsed); */
    width: calc(106% - var(--sidebar-width-collapsed));
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

/* ========================================================================== */
/* BOTÃO HOME E CONTAINER ESQUERDO */
/* ========================================================================== */
.header-master {
    display: flex; 
    align-items: center; 
    justify-content: flex-start;
    height: 100%; 
    padding-left: 15px;
    margin: 0;
}

.header-home-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none !important;
    color: var(--text-light);
    font-family: 'Lato', sans-serif;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    height: 40px;
    padding: 0px 0px 0px 53px;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
}

.header-home-link i {
    font-size: 26px; 
    color: var(--primary-color); 
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0; 
    line-height: 1;
    transition: transform var(--transition-speed) ease;
}

.header-home-link span {
    display: flex;
    align-items: center;
    margin: 0; 
    line-height: 1;
    padding-top: 2px; 
}

.header-home-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.header-home-link:hover i {
    color: #ffffff;
    transform: scale(1.1); 
}

/* ========================================================================== */
/* LADO DIREITO E USUÁRIO */
/* ========================================================================== */
nav#navbar_id .navebar__rigths { display: flex; align-items: center; gap: 15px; position: relative; padding-right: 5px; background: #212b30 !important; }

nav#navbar_id .grid_global_User_empresa { display: flex; flex-direction: column; align-items: flex-start; }
nav#navbar_id .LoginUser { font-weight: 800; margin: -3px; color: var(--text-light); font-size: 0.9rem; }
nav#navbar_id .header-online-status { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--success-color); }
nav#navbar_id .header-online-status .fa-circle { font-size: 10px; }

#header-user-trigger {
    display: flex; align-items: center; gap: 3px; cursor: pointer; padding: 0px 14px;
    border-radius: 8px; transition: background-color var(--transition-speed);

    background: #212b30 !important; /* CORRIGIDO: Adiciona fundo escuro para o botão do usuário */
}
#header-user-trigger:hover { background-color: rgba(255, 255, 255, 0.08); border-color: var(--border-light); }
.header-separator { width: 3px; height: 35px; background-color: white; }
.user-name-online-wrapper { display: flex; align-items: center; gap: 10px; }
#header-user-trigger .header-chevron { color: var(--text-muted); font-size: 16px; margin-left: 5px; transition: transform var(--transition-speed) ease; }
#header-user-trigger.is-active .header-chevron { transform: rotate(180deg); }

/* Dropdown Submenu */
.header-submenu {
    position: absolute;
    top: calc(100% + 1px);
    left: calc(48% + 0px);
    right: 0px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-speed) ease;
    z-index: 1001;
    overflow: hidden;
}
.header-submenu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.header-submenu .submenu-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 15px;
    color: var(--text-light); text-decoration: none; font-size: 14px;
    transition: background-color var(--transition-speed); border-bottom: 1px solid var(--border-light);
}
.header-submenu .submenu-item:last-child { border-bottom: none; }
.header-submenu .submenu-item:hover { background-color: rgba(255, 255, 255, 0.05); color: var(--primary-color); }
.header-submenu .submenu-item i { width: 20px; text-align: center; font-size: 16px; }
.header-submenu .submenu-item.logout:hover { background-color: rgba(255, 77, 77, 0.1); color: var(--danger-color); }

/* ====================================================== */
/* ESTILOS PARA O AVATAR DE INICIAIS */
/* ====================================================== */
.cabecario_text_avatar {
    width: 40px;
    height: 38px;
    border-radius: 50%;
    background-color: #212b30;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 2px solid #ffffff;
    margin: 0 12px;
}
/* ========================================================================== */
/* 3. SIDEBAR PRIMÁRIA (Lateral Esquerda) */
/* ========================================================================== */
#sidebar_id {
    background: var(--Conteiner_MenurLateral_Topo); border-right: 1px solid var(--border-color);
    overflow-y: auto; overflow-x: visible; transition: all var(--transition-speed) ease;
    width:60px; 
    height: 100vh; 
    position: fixed; 
    top: 0; 
    left: 0; z-index: 1002;
    scrollbar-width: none; -ms-overflow-style: none;
}

#sidebar_id::-webkit-scrollbar { display: none; }

#sidebar_id .sidebar__user-avatar { 
    height: var(--header-height); 
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color); 
}
#sidebar_id .sidebar__user-avatar img {
    height: 50px; 
    width: 50px;
    border-radius: 50%;
}

#sidebar_id .sidebar__menu { display: flex; flex-direction: column; align-items: center; padding-top: 15px; }
#sidebar_id .sidebar__link {
    width: 55px; height: 45px; color: var(--Butoes_MenurLateral); display: flex;
    align-items: center; justify-content: center; margin: 4px auto; text-decoration: none;
    position: relative; border-radius: 8px; transition: all var(--transition-speed);
}
#sidebar_id .sidebar__link:hover { background-color: rgba(0, 180, 216, 0.1); color: var(--primary-color); }
#sidebar_id .sidebar__link i { font-size: 20px; transition: all var(--transition-speed); }
#sidebar_id .sidebar__link .NavMenuUser { display: none; }
#sidebar_id .sidebar__link.active {
    background-color: var(--primary-color); color: #000; box-shadow: 0 4px 15px rgba(0, 180, 216, 0.4);
}
#sidebar_id .sidebar__link.active i { transform: scale(1.1); }

/* ========================================================================== */
/* 4. SUBMENU SECUNDÁRIO (Slide-out) */
/* ========================================================================== */
#secondary-menu {
    position: fixed;
    top: 48px;
    left: 60px;
    width: var(--sidebar-width-expanded);
    height: calc(100% - var(--header-height));
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed) ease;
    z-index: 1001;
    padding: 15px;
    overflow-y: auto;
}
#secondary-menu.is-open { transform: translateX(0); opacity: 1; visibility: visible; box-shadow: 10px 0 20px rgba(0,0,0,0.3); }
#secondary-menu .secondary-menu-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border-color);
}
#secondary-menu .secondary-menu-header h3 { color: var(--text-light); font-size: 14px; font-weight: 800; text-transform: uppercase; }
#secondary-menu .close-secondary-menu { color: var(--text-muted); font-size: 20px; cursor: pointer; transition: color 0.2s; }
#secondary-menu .close-secondary-menu:hover { color: var(--danger-color); }
#secondary-menu .List {
    display: flex; align-items: center; padding: 10px 15px; color: var(--text-muted); text-decoration: none;
    font-size: 14px; border-radius: 6px; transition: all 0.2s; margin-bottom: 5px; font-weight: 500;
}
#secondary-menu .List:hover { color: var(--text-light); background-color: rgba(255, 255, 255, 0.05); }
#secondary-menu .List i { margin-right: 12px; font-size: 16px; width: 20px; text-align: center; color: var(--primary-color); }
#secondary-menu .List.active { background-color: rgba(0, 180, 216, 0.15); color: var(--text-light); border-left: 3px solid var(--primary-color); }
.Listuser, .textdescricao, .name_empresa, .nameemp, .sidebar__title { display: none; }

/* ========================================================================== */
/* 5. TEMA SWITCH & CORREÇÕES DO FONTAWESOME */
/* ========================================================================== */
.theme-switch input { display: none !important; }
.theme-switch { position: relative; display: inline-block; width: 46px !important; height: 24px !important; margin: 0 10px; }
.theme-switch .slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #555555;
    transition: 0.4s; border-radius: 34px !important; box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}
.theme-switch .slider:before {
    position: absolute; content: ""; height: 18px !important; width: 18px !important; left: 3px; bottom: 3px;
    background-color: white; transition: 0.4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.theme-switch input:checked + .slider { background-color: var(#00b4d8, #00b4d8); }
.theme-switch input:checked + .slider:before { transform: translateX(22px); }

body:not(.font-awesome-loaded) .sidebar__link i.fa, body:not(.font-awesome-loaded) .submenu-item i.fa, body:not(.font-awesome-loaded) .List i.fa { font-size: 0px !important; width: 20px !important; display: inline-flex !important; align-items: center; justify-content: center; }
body.font-awesome-loaded .sidebar__link i.fa { font-size: 24px !important; }
body.font-awesome-loaded .submenu-item i.fa, body.font-awesome-loaded .List i.fa { font-size: 16px !important; }

/* Previne o piscar da tela enquanto os dados do SessionStorage carregam */
.hide-on-load { opacity: 0; transition: opacity 0.3s ease; }
.hide-on-load.is-ready { opacity: 1; }

/* ========================================================================== */
/* LOGO DINÂMICA DESENHADA (Com fundo transparente) */
/* ========================================================================== */
.dynamic-logo-container {
    background-color: transparent; 
    width: auto; /* CORRIGIDO: Remove a largura fixa que cortava o texto */
    max-width: 400px; /* Dá bastante espaço para o nome crescer no PC */
    height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #8aa4af;
    font-family: 'Lato', sans-serif; 
    padding: 2px 4px;
    box-sizing: border-box;
    overflow: hidden;
    flex-shrink: 1; /* Permite encolher se a tela for pequena */
}
.logo-line-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    gap: 12px; /* Define a distância entre a linha e o nome da empresa */
}

/* Esconde a linha antiga que precisava de fundo para ser apagada */
.logo-line {
    display: none;
}

/* Cria as novas linhas automaticamente na esquerda e direita */
.logo-line-wrapper::before,
.logo-line-wrapper::after {
    content: '';
    flex: 1; /* Estica a linha até a borda */
    height: 1px;
    background-color: #8aa4af;
    opacity: 0.8;
}

.logo-text-top {
    font-size: 16px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: transparent; 
    padding: 0; 
    z-index: 2;
    position: relative;
    line-height: 1.2;
    white-space: nowrap;
    
    /* CORREÇÃO: Impede vazar do lado esquerdo e coloca "..." no fim se for gigante */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    color: red;
}

.logo-text-mid {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 2;
    position: relative;
    line-height: 1;
    white-space: nowrap;
    margin-bottom: 2px;
}

.logo-text-bot {
    font-size: 5.5px;
    text-transform: uppercase;
    letter-spacing: 5px;
    opacity: 0.8;
    white-space: nowrap;
}

@media (max-width:1024px){
    nav#navbar_id {
    width: calc(108% - var(--sidebar-width-collapsed));
}
.header-submenu {
    left: calc(48% + 7px);
}

}
/* ========================================================================== */
/* RESPONSIVIDADE GLOBAL MOBILE (Celulares e Tablets até 768px) */
/* ========================================================================== */
@media (max-width: 768px) {
    /* 1. Layout Principal e Menus Laterais */
    #sidebar_id, 
    #secondary-menu { 
        display: none; 
    }
    
    .header-master {
   
    padding-left: 2px;
  
}
    .header-submenu {
        left: calc(10% + 7px);
        top: calc(100% + 6px);
    }
    nav#navbar_id { 
        width: 100%; 
        left: 0; 
        padding: 0; 
    }

    /* 2. Botão Home e Alinhamentos do Cabeçalho */
    .header-home-link { 
        padding: 0; 
        width: 42px; /* Transforma num quadrado perfeito */
        justify-content: center;
        padding: 0px 0px 0px 0px;
    }
    .header-home-link span { 
        display: none; /* Esconde a palavra HOME, deixa só o ícone */
    }
    
    #header-user-trigger { 
        padding: 0 5px; 
    }
    
    .header-separator { 
        height: 25px; 
    }
    
    .header-submenu { 
        right: 10px !important; 
    }

    /* 3. Textos e Usuário (Lado Direito) */
    .grid_global_User_empresa,
    .header-online-status { 
        display: none !important; 
    }

    .cabecario_text_avatar {
        width: 42px;
        height: 40px;
        font-size: 14px;
        margin: 0 5px; 
    }

    /* 4. Logo Dinâmica Desenhada em CSS */
    .dynamic-logo-container {
        width: 170px; /* Reduz para caber no celular sem quebrar */
        height: 30px !important;
    }
    
    .logo-text-top { font-size: 13px; }
    .logo-text-mid { font-size: 11px; letter-spacing: 1px; }
    .logo-text-bot { display: none; }

    /* 6. Logo Dinâmica Desenhada em CSS (Nova) */
    .dynamic-logo-container {
        width: auto; /* CORRIGIDO: Deixa a logo esticar pelo espaço vazio no celular */
        max-width: calc(100vw - 110px); /* Usa 100% da tela menos o espaço do avatar e do Home */
    }
    
    .logo-text-top { 
        font-size: 13px; 
        letter-spacing: 0.5px; /* Diminui um pouquinho o espaço entre as letras no celular para caber mais texto */
    }
}