﻿/*
   Menu lateral da clínica - no mesmo estilo da régua do NewLabNet (Styles/MenuLateral.css de lá),
   sem busca, favoritos e subtópicos.

   Régua fixa à esquerda, abaixo do cabeçalho:
     recolhida (64px): ícone com o rótulo pequeno embaixo
     expandida (220px): ícone e rótulo na mesma linha, com o nome da clínica no rodapé
   O botão ☰ do topo alterna entre os dois (preferência guardada no navegador).
   Em telas estreitas (< 960px) a régua some e abre por cima do conteúdo pelo botão de menu do cabeçalho.

   Classes no body: menu-lateral-ativo (a régua existe), menu-lateral-expandido (largura), menu-lateral-aberto (mobile).
   Todas as cores vêm das variáveis --ml-* (paleta Veterinário do NewLabNet).
*/

body {
    --ml-topo: 3.13rem; /* altura do cabeçalho fixo (ajustada pelo script) */
    --ml-largura-recolhida: 64px;
    --ml-largura-expandida: 220px;

    --ml-fonte: "Segoe UI", Roboto, Arial, sans-serif;
    --ml-host-bg: #fcfdfd;
    --ml-divider: rgba(70, 86, 97, .14);
    --ml-text: #34434d;
    --ml-text-strong: #263943;
    --ml-text-muted: #5f6d76;
    --ml-icon: #657680;
    --ml-shadow-rail: 2px 0 10px rgba(35, 49, 58, .06);
    --ml-shadow-hover: 0 3px 9px rgba(40, 61, 75, .14);
    --ml-hover-bg: #edf7f3;
    --ml-hover-fg: #1f6855;
    --ml-focus: #327ead;
    --ml-accent: #23755f;
    --ml-ativo-bg: #edf7f3;
    --ml-ativo-fg: #1c4a3e;
}

/* ---------- Deslocamento do conteúdo ---------- */
body.menu-lateral-ativo .content-wrapper > .content,
body.menu-lateral-ativo .content-wrapper > #pageContent {
    padding-left: var(--ml-largura-recolhida);
    transition: padding-left .15s ease;
}

body.menu-lateral-ativo.menu-lateral-expandido .content-wrapper > .content,
body.menu-lateral-ativo.menu-lateral-expandido .content-wrapper > #pageContent {
    padding-left: var(--ml-largura-expandida);
}

/* Barra de ferramentas fixa de algumas telas (PageToolbar do Root.master) acompanha a régua */
body.menu-lateral-ativo .page-toolbar-wrapper {
    left: var(--ml-largura-recolhida) !important;
    transition: left .15s ease;
}

body.menu-lateral-ativo.menu-lateral-expandido .page-toolbar-wrapper {
    left: var(--ml-largura-expandida) !important;
}

@media (max-width: 959px) {
    body.menu-lateral-ativo .page-toolbar-wrapper,
    body.menu-lateral-ativo.menu-lateral-expandido .page-toolbar-wrapper {
        left: 0 !important;
    }
}

/* ---------- Régua ---------- */
.menu-lateral {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: fixed;
    top: var(--ml-topo);
    left: 0;
    bottom: 0;
    width: var(--ml-largura-recolhida);
    z-index: 90;
    border-right: 3px solid var(--ml-accent);
    background: var(--ml-host-bg);
    box-shadow: var(--ml-shadow-rail);
    font-family: var(--ml-fonte);
    transition: width .15s ease, transform .2s ease;
}

body.menu-lateral-expandido .menu-lateral {
    width: var(--ml-largura-expandida);
}

.menu-lateral-alternar {
    flex: 0 0 auto;
    width: 100%;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid var(--ml-divider);
    background: transparent;
    color: var(--ml-icon);
    cursor: pointer;
    font: 700 13px var(--ml-fonte);
    transition: background-color .15s ease, color .15s ease;
}

    .menu-lateral-alternar:hover,
    .menu-lateral-alternar:focus {
        outline: none;
        background: var(--ml-hover-bg);
        color: var(--ml-hover-fg);
    }

.menu-lateral-itens {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 4px;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--ml-divider) transparent;
}

/* ---------- Itens ---------- */
a.menu-lateral-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 0 0 auto;
    padding: 8px 2px;
    border-radius: 8px;
    color: var(--ml-text);
    background: transparent;
    font: 600 9px var(--ml-fonte);
    text-align: center;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}

body.menu-lateral-expandido a.menu-lateral-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 9px 10px;
    text-align: left;
}

    a.menu-lateral-item:hover,
    a.menu-lateral-item:focus {
        outline: none;
        background: #fff;
        color: var(--ml-text);
        box-shadow: var(--ml-shadow-hover);
        transform: translateY(-1px);
        text-decoration: none;
    }

    a.menu-lateral-item:focus-visible {
        box-shadow: 0 0 0 2px var(--ml-focus);
    }

    /* Tela atual: fundo claro do acento e uma barrinha à esquerda */
    a.menu-lateral-item.menu-lateral-item-ativo {
        background: var(--ml-ativo-bg);
        color: var(--ml-ativo-fg);
        box-shadow: none;
        transform: none;
    }

        a.menu-lateral-item.menu-lateral-item-ativo::before {
            content: "";
            position: absolute;
            left: -4px;
            top: 8px;
            bottom: 8px;
            width: 3px;
            border-radius: 0 3px 3px 0;
            background: var(--ml-accent);
        }

        a.menu-lateral-item.menu-lateral-item-ativo .menu-lateral-icone {
            color: var(--ml-accent);
        }

.menu-lateral-icone {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--ml-icon);
}

    .menu-lateral-icone svg {
        width: 100%;
        height: 100%;
    }

/* Recolhida: rótulo em até 2 linhas embaixo do ícone ("Minhas / Faturas") */
.menu-lateral-rotulo {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    max-width: 56px;
    overflow: hidden;
    white-space: normal;
    line-height: 1.15;
}

body.menu-lateral-expandido .menu-lateral-rotulo {
    display: block;
    max-width: none;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12.5px;
}

/* ---------- Conta (rodapé da régua) ---------- */
.menu-lateral-conta {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    border-top: 1px solid var(--ml-divider);
}

body.menu-lateral-expandido .menu-lateral-conta {
    align-items: stretch;
    padding: 10px;
}

.menu-lateral-usuario {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.menu-lateral-avatar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ml-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
}

/* Nome e e-mail só com a régua expandida; recolhida, ficam no tooltip do avatar */
.menu-lateral-usuario-dados {
    display: none;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

body.menu-lateral-expandido .menu-lateral-usuario-dados {
    display: flex;
}

.menu-lateral-usuario-nome {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: var(--ml-text-strong);
    font-size: 12.5px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.menu-lateral-usuario-email {
    overflow: hidden;
    color: var(--ml-text-muted);
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.menu-lateral-sair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 8px;
    color: var(--ml-text-muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

    a.menu-lateral-sair:hover,
    a.menu-lateral-sair:focus {
        outline: none;
        background: var(--ml-hover-bg);
        color: var(--ml-hover-fg);
        text-decoration: none;
    }

    a.menu-lateral-sair svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

.menu-lateral-sair-rotulo {
    display: none;
}

body.menu-lateral-expandido .menu-lateral-sair-rotulo {
    display: inline;
}

body.menu-lateral-expandido a.menu-lateral-sair {
    justify-content: flex-start;
}

.menu-lateral-fundo {
    display: none;
}

/* ---------- Telas estreitas: régua escondida, abre por cima do conteúdo ---------- */
@media (max-width: 959px) {
    body.menu-lateral-ativo .content-wrapper > .content,
    body.menu-lateral-ativo .content-wrapper > #pageContent,
    body.menu-lateral-ativo.menu-lateral-expandido .content-wrapper > .content,
    body.menu-lateral-ativo.menu-lateral-expandido .content-wrapper > #pageContent {
        padding-left: 0;
    }

    .menu-lateral,
    body.menu-lateral-expandido .menu-lateral {
        width: 240px;
        transform: translateX(-105%);
        box-shadow: none;
    }

    body.menu-lateral-aberto .menu-lateral {
        transform: translateX(0);
        box-shadow: 0 14px 34px rgba(30, 48, 59, .20);
    }

    /* aberta no celular sempre mostra os rótulos completos */
    .menu-lateral a.menu-lateral-item {
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        padding: 11px 12px;
        text-align: left;
    }

    .menu-lateral .menu-lateral-rotulo {
        display: block;
        max-width: none;
        white-space: nowrap;
        font-size: 13px;
    }

    .menu-lateral .menu-lateral-conta {
        align-items: stretch;
        padding: 10px;
    }

    .menu-lateral .menu-lateral-usuario-dados {
        display: flex;
    }

    .menu-lateral .menu-lateral-sair-rotulo {
        display: inline;
    }

    .menu-lateral a.menu-lateral-sair {
        justify-content: flex-start;
    }

    .menu-lateral-alternar {
        display: none;
    }

    body.menu-lateral-aberto .menu-lateral-fundo {
        display: block;
        position: fixed;
        top: var(--ml-topo);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 89;
        background: rgba(30, 48, 59, .35);
    }
}

@media print {
    .menu-lateral,
    .menu-lateral-fundo {
        display: none !important;
    }

    body.menu-lateral-ativo .content-wrapper > .content,
    body.menu-lateral-ativo .content-wrapper > #pageContent {
        padding-left: 0 !important;
    }
}
