/* ════════════════════════════════════════════════════════════════
   pwa_sidebar.css  —  Layout global PWA + Sidebar premium
   Aplica a todos los módulos PWA. Carga DESPUÉS de basePWA.css.
   ════════════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────────── */
:root {
    --pwa-sidebar-w: 92px;
    --pwa-accent:    #3273dc;
    --pwa-hover-bg:  rgba(50, 115, 220, 0.08);
    --pwa-border:    rgba(14, 13, 13, 0.18);
}

/* ════════════════════════════════════════════════════════════════
   GRID WRAPPER
   ════════════════════════════════════════════════════════════════ */
.wrapperPWA {
    display: grid;
    grid-template-columns: var(--pwa-sidebar-w) 1fr;
    grid-gap: 0;
    height: 100vh;
    overflow: hidden;
}

/* ════════════════════════════════════════════════════════════════
   SIDEBAR
   overflow:visible → el dropdown sobresale sin cortarse
   ════════════════════════════════════════════════════════════════ */
.main-left {
    width: var(--pwa-sidebar-w);
    min-width: var(--pwa-sidebar-w);
    height: 100vh;
    background: #fff;
    border-right: 1px solid var(--pwa-border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    z-index: 100;
    overflow: visible;
    box-shadow: 2px 0 8px rgba(0, 0, 0, .06);
}

/* ════════════════════════════════════════════════════════════════
   ÁREA PRINCIPAL  —  scroll habilitado, z-index bajo
   ════════════════════════════════════════════════════════════════ */
.main-data {
    height: 100vh;
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* ════════════════════════════════════════════════════════════════
   LOGO  —  altura fija 90px = misma que topbar de Contadores
   ════════════════════════════════════════════════════════════════ */
#navbrand {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    height: 90px;
    min-height: 90px;
    max-height: 90px;
    padding: 0 !important;
    flex-shrink: 0;
    box-sizing: border-box;
    border-bottom: 1px solid #e5e5e5;
}

#navbrand > *,
#navbrand a {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
}

#navbrand img {
    display: block !important;
    max-width: 80% !important;
    max-height: 80% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* ════════════════════════════════════════════════════════════════
   MENÚ VERTICAL  —  flex column, centrado absoluto, sin margen lateral
   ════════════════════════════════════════════════════════════════ */
.vertical-menu {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: visible;
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
    align-items: center;
}

.vertical-menu .menu-list {
    margin: 0 !important;
    flex: 1;
    overflow: visible;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* reset browser ul default */
    padding-left: 0 !important;
}

.vertical-menu .menu-list li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ════════════════════════════════════════════════════════════════
   ÍTEM DE MENÚ  —  flex-column centrado, gap garantiza separación
   Override de alta especificidad para neutralizar Bulma .menu-list a
   ════════════════════════════════════════════════════════════════ */
.vertical-menu .menu-list a.pwa-menu-item,
.pwa-menu-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px 0 !important;
    text-decoration: none !important;
    color: #4a5a72 !important;
    border-radius: 0;
    transition: all 0.3s ease;
    width: 100%;
    min-width: 0;
    cursor: pointer;
    box-sizing: border-box;
    gap: 8px;
    /* reset Bulma .menu-list a padding */
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    margin-top: 0 !important;
}

.vertical-menu .menu-list a.pwa-menu-item:hover,
.pwa-menu-item:hover {
    background: var(--pwa-hover-bg);
    color: var(--pwa-accent) !important;
    border-radius: 0 !important;
    margin-top: 0 !important;
}

/* Icono: tamaño fijo, centrado absoluto */
.pwa-menu-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    width: 20px;
    height: 20px;
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
    margin: 0 !important;
    text-align: center;
}

/* Fuerza centrado sobre el elemento <i> o <svg> del icono */
.pwa-menu-icon i,
.pwa-menu-icon svg {
    display: block !important;
    margin: 0 !important;
    align-self: center;
    line-height: 1;
}

/* Texto: tipografía premium, gap lo separa del icono */
.pwa-menu-label {
    display: block !important;
    margin-top: 0;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    letter-spacing: 0.01em;
    max-width: 100%;
    color: inherit;
}

/* ════════════════════════════════════════════════════════════════
   USUARIO INFERIOR
   ════════════════════════════════════════════════════════════════ */
#navLogin {
    margin-top: auto;
    padding: 0 0.35rem 24px;
    position: relative;
    overflow: visible;
    display: flex;
    justify-content: center;
}

/* Contenedor del trigger + dropdown */
.pwa-user-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* ── Botón trigger: icono usuario + chevron en fila ── */
.pwa-user-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px;
    padding: 8px 12px;
    border: none;
    border-radius: 22px;
    background: rgba(50, 115, 220, 0.06);
    cursor: pointer;
    transition: background 0.15s ease;
    outline: none;
}

.pwa-user-btn:hover,
.pwa-user-btn:focus {
    background: var(--pwa-hover-bg);
}

.pwa-user-icon {
    font-size: 1.2rem;
    color: #444;
}

.pwa-user-chevron {
    font-size: 0.65rem;
    color: #888;
    transition: transform 0.2s ease;
    margin-top: 1px;
}

/* Rotar chevron cuando el menú está abierto */
.pwa-user-btn[aria-expanded="true"] .pwa-user-chevron {
    transform: rotate(180deg);
}

/* ── Dropdown del usuario ─────────────────────────────────────── */
.pwa-user-dropdown {
    display: none;
    position: fixed;
    bottom: 16px;
    left: calc(var(--pwa-sidebar-w) + 6px);
    top: auto;
    min-width: 210px;
    background: #fff;
    border: 1px solid #dbdbdb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    z-index: 9999;
    overflow: hidden;
}

.pwa-user-dropdown.is-open {
    display: block !important;
}

/* Nombre del usuario — cabecera del dropdown */
.pwa-dropdown-name {
    display: block;
    padding: 10px 14px 9px;
    font-weight: 700;
    font-size: 0.78rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 210px;
    cursor: default;
}

/* Ítems del dropdown */
.pwa-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #363636;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s ease;
    white-space: nowrap;
}

.pwa-dropdown-item:hover {
    background: #f5f5f5;
    color: var(--pwa-accent);
    text-decoration: none;
}

/* ════════════════════════════════════════════════════════════════
   BULMA RESET  —  eliminar completamente herencia de .navbar
   ════════════════════════════════════════════════════════════════ */
.main-left .navbar-item.has-dropdown .navbar-dropdown,
.main-left .navbar-item.has-dropdown.is-hoverable:hover .navbar-dropdown {
    display: none !important;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVO MÓVIL — navbrand simétrico con topbar (70px)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    #navbrand {
        height: 70px;
        min-height: 70px;
        max-height: 70px;
    }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVO  —  sidebar mini en pantallas muy pequeñas
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 380px) {
    :root { --pwa-sidebar-w: 54px; }

    .pwa-menu-label { display: none !important; }
    .pwa-menu-item  { min-height: 44px; }
    .pwa-user-dropdown { left: calc(var(--pwa-sidebar-w) + 4px); }
}
