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

:root {
    --primary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --text-color-light: #6b7280;
    --white-color: #ffffff;
    --border-color: #e5e7eb;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --box-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition-speed: 0.2s;
    
    /* Variáveis de Layout Atualizadas */
    --sidebar-width-collapsed: 80px;
    --sidebar-width-expanded: 260px;
    --header-height: 60px;
}

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

/* ========================================================================== */
/* 2. HEADER / NAVBAR (Novo Design) */
/* ========================================================================== */
nav#navbar_id {
    background-color: #212b30;
    padding: 0px 0px !important;
    height: var(--header-height);
    color: white;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Ajuste do Container do Logo para Centralização */
.header-master {
       display: flex;
    align-items: center;
    justify-content: center;
    height: 82%;
    padding-left: 10px;
}

.header-master a {
    display: flex;
    align-items: center;
    text-decoration: none;
    /* Removido width fixo e posição relativa que causavam desalinhamento */
    position: static;
    width: auto;
}

nav#navbar_id .navebar__rigths {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    padding-right: 10px;
    
}

/* Avatar e Info do Usuário no Header */
nav#navbar_id .cabecario_img_login {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    border: 2px solid #fff;
    object-fit: cover;
}

nav#navbar_id .grid_global_User_empresa {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

nav#navbar_id .LoginUser {
    font-weight: 700;
    margin: 0;
    color: white;
    font-size: 0.9rem;
}

nav#navbar_id .empresa_razao_social_login {
    font-size: 12px;
    color: #ccc;
}

nav#navbar_id .header-online-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #2ecc71;
}

nav#navbar_id .header-online-status .fa-circle {
    font-size: 10px;
}

/* Dropdown Trigger */
#header-user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background-color 0.2s;
    background-color: rgba(255, 255, 255, 0.05);
}

#header-user-trigger:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.header-separator {
    width: 1px;
    height: 35px;
    background-color: rgba(255, 255, 255, 0.15);
}

.user-name-online-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

#header-user-trigger .header-chevron {
    color: #ccc;
    font-size: 16px;
    margin-left: 5px;
    transition: transform 0.2s ease;
}

#header-user-trigger.is-active .header-chevron {
    transform: rotate(180deg);
}

/* Submenu / Dropdown do Header */
.header-submenu {
    position: absolute;
    top: calc(100% + 5px);
    right: 10px;
    background-color: #3d3d3d;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s 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: #eee;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.header-submenu .submenu-item:hover {
    background-color: #4a4a4a;
}

.header-submenu .submenu-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.header-submenu .submenu-item.logout:hover {
    background-color: #e65061;
    color: #fff;
}

/* Theme Toggle Switch */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    cursor: default;
}
.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}
.theme-switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #555;
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}
input:checked + .slider {
    background-color: #4a90e2;
}
input:checked + .slider:before {
    transform: translateX(26px);
}
.slider.round {
    border-radius: 34px;
}
.slider.round:before {
    border-radius: 50%;
}

/* ========================================================================== */
/* 3. SIDEBAR PRIMÁRIA (Novo Design) */
/* ========================================================================== */
#sidebar_id {
    background: #212b30;
    overflow-y: auto;
    overflow-x: visible;
    transition: all 0.3s ease;
    width: var(--sidebar-width-collapsed);
    height: calc(100% - var(--header-height));
    position: fixed;
    top: var(--header-height);
    left: 0;
    z-index: 1002;
}

#sidebar_id .sidebar__user-avatar {
    padding: 15px 12px;
    text-align: center;
    border-bottom: 1px solid #444;
}

#sidebar_id .sidebar__user-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
}

#sidebar_id .sidebar__menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 10px;
}

#sidebar_id .sidebar__link {
    width: 55px;
    height: 45px; /* Altura reduzida para aproximar os ícones */
    color: #8aa4af;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px auto; /* Margem reduzida para aproximar os ícones */
    text-decoration: none;
    position: relative;
    border-radius: 8px;
    transition: background-color 0.2s;
}

#sidebar_id .sidebar__link:hover {
    background-color: #2c3b41;
    color: #fff;
}

#sidebar_id .sidebar__link i {
    font-size: 22px;
    transition: all 0.2s;
}

#sidebar_id .sidebar__link .NavMenuUser {
    display: none; /* Oculta texto na sidebar colapsada */
}

/* ========================================================================== */
/* 4. SUBMENU SECUNDÁRIO (Slide-out) */
/* ========================================================================== */
#secondary-menu {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width-collapsed);
    width: var(--sidebar-width-expanded);
    height: calc(100% - var(--header-height));
    background-color: #2c3b41;
    border-right: 1px solid #444;
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1001; 
    padding: 15px;
    overflow-y: auto;
}

#secondary-menu.is-open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

#secondary-menu .secondary-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid cadetblue;
}

#secondary-menu .secondary-menu-header h3 {
    color: cadetblue;
    font-size: 16px;
    text-transform: uppercase;
}

#secondary-menu .close-secondary-menu {
    color: #8aa4af;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

#secondary-menu .close-secondary-menu:hover {
    color: #fff;
}

#secondary-menu .List {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #b8c7ce;
    text-decoration: none;
    font-size: 14px;
    border-radius: 5px;
    transition: all 0.2s;
    margin-bottom: 5px;
}

#secondary-menu .List:hover {
    color: #fff;
    background-color: #34474e;
}

#secondary-menu .List i {
    margin-right: 12px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Elementos auxiliares escondidos por padrão */
.Listuser, .textdescricao, .name_empresa, .nameemp, .sidebar__title {
    display: none;
}

/* ========================================================================== */
/* 5. LAYOUT DE PÁGINA (Wrapper Principal) */
/* ========================================================================== */
.user-list-page-wrapper, #app-main-content {
    margin-top: var(--header-height); /* Garante que fique logo abaixo do header */
    margin-left: var(--sidebar-width-collapsed);
   padding-top: 3px !important;
    /* AQUI ESTÁ A MUDANÇA: Padding superior ZERADO para colar no header */
    /* padding: 0 0rem 7rem 7rem;  */
    
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
    transition: margin-left 0.3s ease;
}

#app-main-content h1 {
    margin-top: 0; /* Garante que o título não empurre o conteúdo para baixo */
    padding-top: 0;
    margin-bottom: 1rem;
    font-size: 22px;
    color: var(--dark-color);
}

/* ========================================================================== */
/* 6. CONTEÚDO DA PÁGINA (Cards, Filtros, etc - Mantido do Original) */
/* ========================================================================== */

/* Page Header */
.page-header {
    display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem;
    background-color: var(--white-color); border-radius: var(--border-radius);
    border: 1px solid rgba(0,0,0,0.02); margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
}

.header-top-row, .header-bottom-row {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; width: 100%; gap: 1rem;
}

.search-title {
    font-size: 1.5rem; font-weight: 800; color: #111827; margin: 0; letter-spacing: -0.025em;
}

/* Stats */
.header-stats {
    display: flex; align-items: center; gap: 1.5rem;
    background: #f9fafb; padding: 0.5rem 1rem; border-radius: 8px;
    flex-wrap: wrap; 
}
.stat-item {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; font-weight: 600; color: var(--text-color-light);
}
.stat-item::before { content: ''; display: block; width: 8px; height: 8px; border-radius: 50%; }
.stat-item--active::before { background-color: var(--success-color); }
.stat-item--blocked::before { background-color: var(--danger-color); }
.stat-item .stat-count { color: var(--dark-color); font-weight: 800; }

/* Controls */
.header-left-controls { display: flex; align-items: center; gap: 1rem; flex-grow: 1; flex-wrap: wrap; }
.dropdown-filter { display: flex; align-items: center; gap: 0.75rem; }
.dropdown-filter label { font-weight: 600; color: #374151; font-size: 0.9rem; }
#status-filter-select {
    padding: 0.6rem 2.5rem 0.6rem 1rem; font-size: 0.9rem;
    border-radius: 8px; border: 1px solid var(--border-color);
    background-color: #fff; cursor: pointer; color: #374151; font-weight: 500;
}

/* Search */
.search-form-wrapper {
    position: relative; display: flex; align-items: center;
    background-color: #fff; border: 1px solid var(--border-color);
    border-radius: 8px; min-width: 320px; transition: all var(--transition-speed);
}
.search-form-wrapper:focus-within {
    border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.search-icon { position: absolute; left: 12px; color: #9ca3af; font-size: 0.9rem; }
#cards_usuario_inpult_busca {
    width: 100%; border: none; background: transparent;
    padding: 0.7rem 0.7rem 0.7rem 2.5rem; font-size: 0.95rem; outline: none; color: var(--dark-color);
}

/* Header Buttons */
.Conteiner_cards_user_controles { display: flex; gap: 0.75rem; }
.Conteiner_cards_user_controles > span {
    display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer;
    font-weight: 600; font-size: 0.9rem; padding: 0.6rem 1.2rem;
    border: 1px solid var(--border-color); border-radius: 8px;
    background: #fff; color: #374151; transition: all 0.2s;
}
.Conteiner_cards_user_controles > span:hover { background-color: #f9fafb; transform: translateY(-1px); }
#cards_new_user {
    background-color: var(--primary-color) !important; border-color: var(--primary-color) !important; color: white !important;
}
#cards_new_user:hover { background-color: #2563eb !important; }

/* Header Icons */
.Conteiner_cards_user_controles > span::before { font-family: FontAwesome; font-weight: normal; }
#cards_new_user::before { content: '\f067'; }
#cards_exporta_user::before { content: '\f019'; }
#cards_permicoes_user::before { content: '\f132'; }

/* Card Grid System */
.conteiner_card_geraneral_user {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem; 
    padding-bottom: 2rem;
}

.card-wrapper {
    display: flex; flex-direction: column; background: var(--white-color);
    border-radius: var(--border-radius); box-shadow: var(--box-shadow);
    border: 1px solid rgba(255,255,255,0.5); overflow: hidden;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; height: 100%;
}
.card-wrapper:hover { 
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-hover) !important;
    z-index: 2; 
}

.card_color_user {
    position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
    background: var(--success-color); z-index: 2;
    border-top-right-radius: 4px; border-bottom-right-radius: 4px;
}
.card-wrapper.status-bloqueado .card_color_user { background: var(--danger-color); }

.card_user {
    position: relative; display: flex; flex-direction: column;
    padding: 1.25rem 1.25rem 0.5rem 2rem; flex-grow: 1;
}
.box_codigo_avatar { display: flex; flex-direction: column; flex-grow: 1; }

.card_user_online_selec {
    display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.25rem;
}
.imgsrcuser {
    width: 68px; height: 68px; border-radius: 18px; object-fit: cover;
    border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.NomeXEmailCardsUser { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.card_name_user span {
    font-size: 1.125rem; font-weight: 800; color: #111827;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.card_listuser_emails span {
    font-size: 0.875rem; color: #6b7280; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}

.card_footer_info {
    margin-top: auto; padding-top: 1.25rem; border-top: 1px solid antiquewhite;
    display: flex; justify-content: space-between; align-items: center;
}
.card_bloquio_user {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: 0.05em;
    background-color: #ecfdf5; color: #059669;
}
.card-wrapper.status-bloqueado .card_bloquio_user { background-color: #fef2f2; color: #dc2626; }
.card_avatar_user img { display: none; } 

.card_codigo_user { text-align: right; }
.title_cad_codigo { font-size: 0.65rem; text-transform: uppercase; color: #9ca3af; font-weight: 700; }
h3.card_text_cod { font-size: 1rem; color: #374151; margin: 0; font-family: 'Inter', monospace; }

/* Button Action Bar */
.butoes_form_list_user {
    display: flex;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
    height: 52px;
    padding: 0 0.5rem;
    gap: 0.5rem;
    align-items: center;
}

.butoes_form_list_user > a,
.butoes_form_list_user > form,
.butoes_form_list_user > button {
    flex: 1; display: flex; justify-content: center; align-items: center;
    height: 36px; margin: 0; border: none; text-decoration: none;
}

.butoes_form_list_user button {
    flex: 1; height: 100%; background: transparent; border: none;
    color: #6b7280; cursor: pointer; font-size: 0.85rem; font-weight: 600;
    font-family: 'Inter', sans-serif; display: flex; align-items: center;
    justify-content: center; gap: 8px; border-radius: 6px; transition: all 0.2s ease;
}

.butoes_form_list_user button i { font-size: 1.1em; opacity: 0.8; }

.butoes_form_list_user > a:hover button,
.butoes_form_list_user > form:hover button {
    background-color: #e0e7ff; color: var(--primary-color); opacity: 1;
}
.butoes_form_list_user > a:hover button i,
.butoes_form_list_user > form:hover button i { opacity: 1; }

/* ========================================================================== */
/* 7. RESPONSIVIDADE & MEDIA QUERIES */
/* ========================================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }

/* Notebooks */
@media (max-width: 1440px) {
    .conteiner_card_geraneral_user {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* Tablets Landscape */
@media (max-width: 1024px) {
    .conteiner_card_geraneral_user {
        grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
        gap: 1.5rem;
    }
}

/* Tablets Portrait */
@media (max-width: 992px) {
    .header-bottom-row { flex-direction: column; align-items: stretch; }
    .header-left-controls, .header-right-controls { flex-direction: column; width: 100%; }
    .search-form-wrapper { width: 100%; min-width: auto; }
    .Conteiner_cards_user_controles { width: 100%; flex-wrap: wrap; }
    .Conteiner_cards_user_controles > span { flex: 1 1 auto; justify-content: center; }
    
    .conteiner_card_geraneral_user {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

/* Mobile (Até 768px) - Lógica de Esconder Sidebar */
@media (max-width: 768px) {
    /* Oculta a Sidebar Primária */
    #sidebar_id {
        display: none;
    }

    /* Oculta o Painel do Submenu Secundário */
    #secondary-menu {
        display: none;
    }

    /* Ajusta o Wrapper Principal */
    .user-list-page-wrapper, #app-main-content {
        margin-left: 0; 
        width: 100%;
        margin-top: var(--header-height); /* Remove o +10px anterior */
        
        /* ZERADO PADDING NO MOBILE TAMBÉM */
        padding: 0 1rem 1rem 1rem;
    }
    
    /* Ajusta o Navbar */
    nav#navbar_id {
        width: 100%; 
        padding: 0 0px;
    }
    
    .page-header { padding: 1rem; }
    .header-stats { flex-direction: column; align-items: flex-start; }
}

/* Mobile Pequeno (Até 640px) */
@media (max-width: 640px) {
    nav#navbar_id .header-online-status {
        display: none;
    }
    nav#navbar_id .cabecario_img_login {
        display: none;
    }
    
    .Conteiner_cards_user_controles { flex-direction: column; }
    .user-list-page-wrapper { padding: 0.5rem; }
    .conteiner_card_geraneral_user { grid-template-columns: 1fr; }
}