/* --- VARIÁVEIS DE TEMA --- */
:root {
    --theme-primary:       #139067;
    --theme-accent:        #28a745;
    --theme-accent-dark:   #218838;
    --theme-accent-focus:  rgba(40, 167, 69, 0.5);
    --theme-dash-hover:    #3e9f45;
}

/* --- ESTILOS ORIGINAIS (DESKTOP) --- */
body {
    display: grid;
    grid-template-columns: 250px 1fr;
    grid-template-rows: 64px 1fr 64px;
    grid-template-areas: 
        "header header"
        "sidebar content"
        "sidebar footer";
    height: 100vh;
    margin: 0;
    background-color: #DDD;
}

/*rodrigo REMOVIDO: A classe hide-sidebar será controlada pela nova lógica no JS e Media Query*/
body.hide-sidebar {
    grid-template-columns: 1fr;
    grid-template-areas: 
        "header"
        "content"
        "footer";
}
/* Adicione esta regra para garantir que a barra lateral suma do layout no desktop */
body.hide-sidebar aside.sidebar {
    display: none;
}


header.header {
    grid-area: header;
    display: flex;
    background-color: var(--theme-primary);
    align-items: center;
    z-index: 20;
    transition: background-color 0.3s ease;
    box-shadow:
        0 2px 4px -1px rgba(0, 0, 0, .2),
        0 4px 4px 0px rgba(0, 0, 0, .14),
        0 1px 10px 0px rgba(0, 0, 0, .12);
}

header.header .logo {
    display: flex;
    align-items: center;
    flex-basis: 250px;
    padding: 0 16px;
}

header.header .logo .brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    line-height: 1;
}

header.header .logo .brand-icon { flex-shrink: 0; }

header.header .logo .brand-word {
    font-family: 'Poppins', sans-serif;
    font-size: 1.45rem;
    letter-spacing: -0.2px;
    line-height: 1;
}

header.header .logo .brand-light { font-weight: 400; }
header.header .logo .brand-bold  { font-weight: 700; }

header.header .menu-toggle {
    color: white;
    cursor: pointer;
    display: block; /*antes era none; Vou mostrar no desktop; Escondido no desktop, será exibido no mobile */
    font-size: 1.8rem;
}

header.header .spacer {
    flex-grow: 1;
}

header.header .dropdown {
    position: relative;
    height: 100%;
}

header.header .dropdown:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

header.header .dropdown-button {
    display: flex;
    align-items: center;
    color: white;
    height: 100%;
    padding: 0px 20px;
}

header.header .dropdown-content {
    display: none;
    position: absolute;
    min-width: 100%;
    background-color: #f9f9f9;
    padding: 15px 0px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

header.header .dropdown:hover .dropdown-content {
    display: block;
}

header.header .dropdown-content ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

header.header .dropdown-content a {
    text-decoration: none;
    color: #222;
    padding: 10px 15px;
    display: flex;
    align-items: center;
}

header.header .dropdown-content a:hover {
    background-color: #EEE;
}

.avatar {
    height: 40px;
    border-radius: 20px;
    margin-right: 10px;
}

aside.sidebar {
    grid-area: sidebar;
    background-color: #333;
    color: white;
    box-shadow: 
        2px 0 10px 0 rgba(0,0,0,0.12),
        1px 0 15px 0 rgba(0,0,0,0.08);
}

.sidebar-widget {
    display: flex;
    align-items: center;
    padding: 10px 15px;
}

.sidebar-widget .icon {
    font-size: 2.7rem;
    margin-right: 10px;
}

.sidebar-widget .info .main {
    font-size: 1.7rem;
}

.sidebar-widget .info .label {
    font-size: 1rem;
}

.division {
    border-top: 1px solid #777;
    margin: 5px 15px;
}

aside.sidebar .menu {
    font-size: 1.2rem;
}

aside.sidebar .nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

aside.sidebar .nav-list a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #DDD;
}

aside.sidebar .nav-list a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.active-clock {
    color: var(--theme-dash-hover);
}

main.content {
    background-color: #FFF;
    grid-area: content;
    margin: 20px;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0px 0px 25px 0px rgba(0, 0, 0, 0.2);
}

main.content .content-title {
    display: flex;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #CCC;
}

main.content .content-title .icon {
    font-size: 3rem;
}

main.content .content-title h1 {
    font-family: 'Poppins', sans-serif;
    color: #444;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

main.content .content-title h2 {
    color: #888;
    font-size: 1.2rem;
    font-weight: 300;
    margin: 0;
}

footer.footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 20px;
    font-size: 1.2rem;
    grid-area: footer;
    background-color: #EEE;
    color: #555;
    border-top: 1px solid #CCC;
}

/* --- ADIÇÕES PARA O MENU RESPONSIVO --- */
.sidebar-header {
    display: none; /* Escondido no desktop */
}

.sidebar-overlay {
    display: none; /* Escondido no desktop */
}

/* --- SELETOR DE TEMA (pill) --- */
.theme-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 6px 10px;
    color: white;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.theme-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--theme-primary);
    flex-shrink: 0;
}

.theme-label { font-size: 0.78rem; }

.theme-picker select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.theme-picker select option {
    background-color: #2a2a2a;
    color: #eee;
}

/* --- AVATAR DO USUÁRIO NO HEADER --- */
.header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.required-asterisk::after {
    content: " *";
    color: red;
    font-weight: bold;
}

@media (min-width: 769px) {
    .dashboard-icon-hover:hover {
        transform: scale(1.18);
        transition: transform 0.2s;
        color: var(--theme-dash-hover);
    }
}

/* --- ESTILOS PARA RESPONSIVIDADE (MOBILE) --- */
@media (max-width: 768px) {
    
    /* 1. Layout do corpo muda para uma única coluna */
    body {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "content"
            "footer";
    }

    /* 2. Menu lateral é posicionado fora da tela por padrão */
    aside.sidebar {
        position: fixed;
        height: 100%;
        width: 250px;
        top: 0;
        left: -250px; /* Começa escondido à esquerda */
        z-index: 30;
        transition: left 0.3s ease; /* Animação suave */
    }
    
    /* 3. Quando o body tem a classe 'sidebar-open', o menu desliza para dentro da tela */
    body.sidebar-open aside.sidebar {
        left: 0;
    }
    
    /* 4. Mostra o overlay quando o menu está aberto */
    body.sidebar-open .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 25; /* Fica entre o menu e o conteúdo */
    }

    /* 5. Exibe o ícone de hamburger e o botão de fechar no mobile */
    header.header .menu-toggle {
        display: block;
        font-size: 1.8rem;
    }
    
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        border-bottom: 1px solid #555;
    }
    
    .sidebar-title {
        font-size: 1.5rem;
        font-weight: 300;
    }

    .close-sidebar {
        background: none;
        border: none;
        color: white;
        font-size: 2rem;
        cursor: pointer;
    }
    
    /* 6. Esconde o logo para dar mais espaço */
    header.header .logo {
        display: none;
    }
    
    /* 7. Ajusta o conteúdo principal */
    main.content {
        margin: 10px;
    }
}