/* ==========================================================================
   SENKU — Layout: Barra Lateral Pizarra y Contenedor Principal
   ========================================================================== */

.app-contenedor {
    display: flex;
    min-height: 100vh;
    background-color: var(--color-fondo);
}

/* Sidebar en Pizarra (#22303F) - 20% en la paleta de marca */
.app-sidebar {
    width: var(--sidebar-ancho);
    background-color: var(--sidebar-fondo);
    color: var(--sidebar-texto);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
    z-index: 1000;
    border-right: 1px solid rgba(0, 0, 0, 0.15);
}

.sidebar-header {
    padding: var(--espacio-md) var(--espacio-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 64px;
    display: flex;
    align-items: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--espacio-sm);
    text-decoration: none;
    color: #ffffff;
}

.sidebar-brand:hover {
    color: #ffffff;
    text-decoration: none;
}

.sidebar-logo-img {
    height: 32px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
    display: block;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--espacio-md) 0;
}

.nav-seccion-titulo {
    font-family: var(--senku-font-titulos);
    font-size: 0.70rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(196, 209, 219, 0.55);
    padding: var(--espacio-sm) var(--espacio-md);
    font-weight: 700;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px var(--espacio-md);
    color: var(--sidebar-texto);
    font-size: 0.90rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
}

.nav-item-link i {
    font-size: 1.05rem;
    opacity: 0.85;
    transition: transform 0.15s ease, color 0.15s ease;
}

.nav-item-link:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
    text-decoration: none;
}

.nav-item-link:hover i {
    transform: translateX(1px);
    opacity: 1;
}

.nav-item-link.activo {
    background-color: var(--sidebar-activo);
    color: #ffffff;
    font-weight: 600;
    border-left-color: var(--sidebar-activo-borde);
}

.nav-item-link.activo i {
    color: var(--senku-lima);
    opacity: 1;
}

.sidebar-footer {
    padding: var(--espacio-md);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(0, 0, 0, 0.22);
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
    background-color: var(--color-fondo);
}

.app-topbar {
    background-color: var(--color-superficie);
    border-bottom: 1px solid var(--color-borde);
    padding: var(--espacio-sm) var(--espacio-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    box-shadow: 0 1px 2px rgba(34, 48, 63, 0.02);
}

.app-contenido {
    flex: 1;
    padding: var(--espacio-lg);
    background-color: var(--color-fondo);
}

/* Backdrop para oscurecer el fondo cuando se abre el sidebar en móvil */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(34, 48, 63, 0.7);
    backdrop-filter: blur(2px);
    z-index: 1040;
}

.input-busqueda-topbar {
    min-width: 220px;
    background-color: var(--senku-niebla);
    border-color: var(--color-borde);
}

.input-busqueda-topbar:focus {
    background-color: #ffffff;
}

/* Reglas Responsivas para Móviles y Tablets */
@media (max-width: 991.98px) {
    .app-contenedor {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        min-height: 100vh !important;
        overflow-x: hidden !important;
    }

    .app-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 1050 !important;
        box-shadow: none !important;
    }

    .app-contenedor.sidebar-abierto .app-sidebar {
        transform: translateX(0) !important;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5) !important;
    }

    .app-contenedor.sidebar-abierto .sidebar-backdrop {
        display: block !important;
    }

    .app-main {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .app-topbar {
        padding: var(--espacio-sm) var(--espacio-md) !important;
    }

    .app-contenido {
        padding: var(--espacio-md) !important;
    }
}

@media (max-width: 575.98px) {
    .input-busqueda-topbar {
        min-width: 120px;
    }

    .btn-anotar-flotante {
        bottom: 18px;
        right: 18px;
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    .app-topbar {
        min-height: 56px;
    }
}
