/* ──────────────────────────────────────────────────────────────────────
   Sidebar de la Oficina Virtual.
   Global (no scoped) porque los <NavLink> renderizan <a> que no heredan
   el atributo de aislamiento de Blazor.
   ────────────────────────────────────────────────────────────────────── */

.ov-sidebar {
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top right, rgba(20, 184, 166, 0.12), transparent 18rem),
        linear-gradient(180deg, #07111f 0%, #0f172a 50%, #0a2725 100%);
    color: var(--ov-ink-200);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: var(--ov-z-sidebar);
    overflow: hidden;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 8px 0 28px rgba(15, 23, 42, 0.08);
}

.ov-sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: var(--ov-topbar-height);
    padding: 0 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    flex-shrink: 0;
}

.ov-sidebar__brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    font-size: 17px;
    min-width: 0;
}

.ov-sidebar__brand-mark {
    color: var(--ov-brand-300);
    display: inline-flex;
    filter: drop-shadow(0 0 12px rgba(94, 234, 212, 0.32));
}

.ov-sidebar__brand-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Sora', var(--ov-font);
    font-weight: 500;
    letter-spacing: -0.01em;
}

.ov-sidebar__brand-name strong { font-weight: 700; color: white; }

.ov-sidebar__collapse-btn {
    background: rgba(255, 255, 255, 0.04);
    color: var(--ov-ink-400);
    border: 1px solid rgba(255, 255, 255, 0.06);
    width: 28px;
    height: 28px;
    border-radius: var(--ov-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--ov-transition);
    flex-shrink: 0;
}

.ov-sidebar__collapse-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.14);
}

.ov-sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}

.ov-sidebar__nav::-webkit-scrollbar { width: 6px; }
.ov-sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.ov-sidebar__section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(204, 251, 241, 0.45);
    padding: 18px 12px 6px;
    font-weight: 700;
}

/* ── Items de navegación (a.NavLink) ───────────────────────────────── */
.ov-sidebar__item {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--ov-radius-md);
    color: rgba(226, 232, 240, 0.78) !important;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none !important;
    transition: background var(--ov-transition), color var(--ov-transition), transform var(--ov-transition);
    white-space: nowrap;
    position: relative;
    border: 1px solid transparent;
}

.ov-sidebar__item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white !important;
    text-decoration: none !important;
}

.ov-sidebar__item--active {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.92), rgba(15, 118, 110, 0.92));
    color: white !important;
    box-shadow:
        0 6px 18px rgba(13, 148, 136, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    border-color: rgba(94, 234, 212, 0.18);
}

.ov-sidebar__item--active:hover {
    background: linear-gradient(135deg, rgba(20, 184, 166, 1), rgba(15, 118, 110, 1));
    color: white !important;
}

.ov-sidebar__item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    opacity: 0.85;
}

.ov-sidebar__item--active .ov-sidebar__item-icon { opacity: 1; }

.ov-sidebar__item-label { flex: 1; }

.ov-sidebar__item-badge {
    background: var(--ov-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.5);
}

/* ── Footer ──────────────────────────────────────────────────────── */
.ov-sidebar__footer {
    padding: 10px 12px 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    flex-shrink: 0;
}

.ov-sidebar__footer-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    color: var(--ov-ink-400) !important;
    font-size: 12.5px;
    text-decoration: none !important;
    padding: 8px 12px;
    border-radius: var(--ov-radius-sm);
    transition: color var(--ov-transition), background var(--ov-transition);
}

.ov-sidebar__footer-link:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none !important;
}

/* Sidebar colapsado: ocultar labels/section titles */
.ov-shell--collapsed .ov-sidebar__brand-name,
.ov-shell--collapsed .ov-sidebar__section-title,
.ov-shell--collapsed .ov-sidebar__item-label,
.ov-shell--collapsed .ov-sidebar__footer-link span {
    display: none;
}

.ov-shell--collapsed .ov-sidebar__item,
.ov-shell--collapsed .ov-sidebar__footer-link {
    justify-content: center;
    padding: 10px 0;
}

/* ── Cerrar drawer (sólo visible en mobile) ─────────────────────────────
   Botón "X" arriba del sidebar. En desktop está oculto porque el sidebar
   vive siempre visible y no hay nada que cerrar. */
.ov-sidebar__close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ov-ink-300);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 34px;
    height: 34px;
    border-radius: var(--ov-radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--ov-transition), color var(--ov-transition);
}

.ov-sidebar__close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

/* ── Mobile (<768px): sidebar como drawer ────────────────────────────────
   Estas reglas viven en sidebar.css (no en layout.css) porque sidebar.css
   define position: sticky por default y se carga después de layout.css —
   si las reglas mobile estuvieran en layout.css, la regla "position: sticky"
   ganaría por orden de origen y el drawer quedaría roto.

   Acá las reglas mobile pisan a las default del mismo archivo, así que
   el orden y la especificidad se respetan correctamente. */
@media (max-width: 768px) {
    .ov-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh; /* iOS Safari: descuenta la barra de URL dinámica */
        width: 280px;
        max-width: 84vw;
        transform: translateX(-100%);
        transition: transform var(--ov-transition);
        z-index: calc(var(--ov-z-topbar) + 6);
        box-shadow: 12px 0 32px rgba(15, 23, 42, 0.32);
    }

    .ov-shell--drawer-open .ov-sidebar {
        transform: translateX(0);
    }

    .ov-sidebar__close-btn { display: inline-flex; }
}
