/* ══════════════════════════════════════════════════════════════════════════
   Menu lateral (mismo diseno que SypplyCore). Columna de 256 px con tres zonas:
   logo (64 px) · navegacion con scroll propio · pie de usuario. Siempre oscuro, en ambos temas.
   ══════════════════════════════════════════════════════════════════════════ */
.sb-drawer {
    --sb-bg:            hsl(219 20% 18%);
    --sb-border:        hsl(217 16% 30%);
    --sb-section:       hsl(220 22% 45%);
    --sb-item:          hsl(220 14% 70%);
    --sb-item-hover-bg: rgb(255 255 255 / .05);
    --sb-accent:        hsl(231 70% 64%);
    --sb-active-bg:     hsl(231 70% 64% / .15);
    --sb-active-icon:   hsl(231 70% 74%);
    --sb-role:          hsl(220 14% 64%);

    background: var(--sb-bg) !important;
    border-right: 1px solid var(--sb-border);
    color: var(--sb-item);
    width: 256px;
}
.sb-drawer .mud-drawer-content { height: 100%; overflow: hidden; padding: 0; }

.sb-root { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* 1. Encabezado del logo */
.sb-head {
    height: 64px; padding: 0 20px; flex-shrink: 0;
    display: flex; align-items: center;
    border-bottom: 1px solid var(--sb-border);
}
.sb-brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sb-brand-name { font-family: Georgia, serif; font-weight: 700; font-size: 20px; letter-spacing: -.5px; color: #fff; }
.sb-brand-name strong { color: #F97316; font-weight: 700; }
.sb-brand-company { font-size: 11px; color: var(--sb-role); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Buscador (fila fija bajo el logo) */
.sb-search { padding: 12px 12px 4px; flex-shrink: 0; }
.sb-search .sidebar-search input { color: #fff !important; }
.sb-search .sidebar-search input::placeholder { color: var(--sb-item) !important; opacity: .8; }
.sb-search .sidebar-search .mud-input-outlined-border { border-color: var(--sb-border) !important; }
.sb-search .sidebar-search .mud-input:hover .mud-input-outlined-border { border-color: var(--sb-section) !important; }
.sb-search .sidebar-search.mud-input-input-control:focus-within .mud-input-outlined-border { border-color: var(--sb-accent) !important; }
.sb-search .sidebar-search .mud-icon-root,
.sb-search .sidebar-search .mud-input-clear-button { color: var(--sb-item) !important; }

/* 2. Navegacion con scroll independiente (solo CSS) */
.sb-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 0; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--sb-border) transparent; }
.sb-nav { display: flex; flex-direction: column; }

.sb-section {
    padding: 6px 20px; font-size: 10px; font-weight: 600; letter-spacing: .1em;
    text-transform: uppercase; color: var(--sb-section);
}
/* Separador entre secciones (equivale a la linea al final de la seccion anterior; no aparece si la seccion no se muestra) */
.sb-section::before { content: ""; display: block; height: 1px; background: var(--sb-border); margin: 0 -8px 8px; }
.sb-section:first-child::before { display: none; }
.sb-section { margin-top: 8px; }
.sb-section:first-child { margin-top: 0; }
.sb-empty { padding: 10px 20px; font-size: 12px; color: var(--sb-section); }

/* Items */
.sb-link {
    position: relative; display: flex; align-items: center; gap: 12px;
    width: calc(100% - 24px); margin: 2px 12px; padding: 10px 12px;
    border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer;
    font: inherit; font-size: 14px; line-height: 1.3; color: var(--sb-item); text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.sb-link .sb-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sb-link .sb-ico { width: 16px; height: 16px; flex-shrink: 0; }
.sb-link:hover { color: #fff; background: var(--sb-item-hover-bg); }
.sb-link:focus-visible { outline: 2px solid var(--sb-accent); outline-offset: -2px; }
.sb-link.active { color: #fff; font-weight: 600; background: var(--sb-active-bg); }
.sb-link.active .sb-ico { color: var(--sb-active-icon); }
.sb-link.active::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; background: var(--sb-accent); border-radius: 0 3px 3px 0;
}

/* Grupos desplegables */
.sb-group-btn .sb-chev { width: 14px; height: 14px; flex-shrink: 0; transition: transform .2s ease; opacity: .7; }
.sb-group.open > .sb-group-btn .sb-chev { transform: rotate(180deg); }
.sb-group.open > .sb-group-btn { color: #fff; }
.sb-children { margin: 0 12px 4px 31px; padding-left: 0; border-left: 1px solid var(--sb-border); }
.sb-children .sb-link { width: calc(100% - 8px); margin: 1px 0 1px 8px; padding: 7px 12px; font-size: 13px; }
.sb-children .sb-link.sb-sub::before { left: -9px; }   /* la barra del activo cae sobre la linea guia */

/* 3. Pie de usuario */
.sb-foot {
    flex-shrink: 0; padding: 16px; border-top: 1px solid var(--sb-border);
    display: flex; align-items: center; gap: 12px;
}
.sb-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: var(--sb-accent); color: #fff; font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.sb-user { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sb-user-name { font-size: 12px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-role { font-size: 12px; color: var(--sb-role); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-logout {
    width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px; background: transparent; color: var(--sb-role); cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.sb-logout:hover { background: rgb(255 255 255 / .1); color: #fff; }
.sb-logout:focus-visible { outline: 2px solid var(--sb-accent); outline-offset: 1px; }
.sb-logout .lucide { width: 16px; height: 16px; }

/* Desplazamiento suave del menu al "Localizar", respetando preferencia de movimiento */
@media (prefers-reduced-motion: reduce) { .sb-link, .sb-group-btn .sb-chev { transition: none; } }

/* Subtitulos dentro de un grupo del menu (Monitores, Documentos, Configuracion...) */
.sb-children .sb-subhead { margin: 10px 0 2px 8px; padding: 0 12px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-section); }
.sb-children .sb-subhead:first-child { margin-top: 4px; }
