/* Shell de la aplicación: topbar + bottom nav en móvil; sidebar en escritorio */

.app-shell {
    min-height: 100dvh;
}

/* ---- Topbar (móvil) ---- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: var(--topbar-height);
    padding: 0 var(--space-4);
    background: var(--color-brand-darker);
}

.topbar-logo {
    height: 22px;
    width: auto;
    flex-shrink: 0;
}

.topbar-title {
    font-weight: 700;
    font-size: var(--text-md);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #F0EAE3;
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    font-size: var(--text-xs);
    text-decoration: none;
}

/* ---- Contenido ---- */
.content {
    padding: var(--space-4);
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-5));
}

/* ---- Sidebar (oculta en móvil) ---- */
.sidebar {
    display: none;
}

/* ---- Bottom nav (móvil) ---- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    background: var(--color-surface);
    border-top: 1px solid var(--color-line);
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
    flex: 1;
    min-height: var(--touch-target);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--space-2) var(--space-1);
    text-decoration: none;
    color: var(--color-ink-faint);
    font-size: var(--text-xs);
    font-weight: 600;
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
}

.bottom-nav-item.is-active {
    color: var(--color-brand);
}

.bottom-nav-upload {
    color: var(--color-brand);
    font-weight: 700;
}

/* ---- Escritorio ---- */
@media (min-width: 900px) {
    .app-shell {
        display: grid;
        grid-template-columns: var(--sidebar-width) 1fr;
    }

    /* Permitir que la columna de contenido encoja (evita scroll horizontal) */
    .app-main {
        min-width: 0;
    }

    .topbar,
    .bottom-nav {
        display: none;
    }

    .sidebar {
        display: flex;
        flex-direction: column;
        position: sticky;
        top: 0;
        height: 100dvh;
        background: var(--color-brand-darker);
        color: #F0EAE3;
        overflow-y: auto;
    }

    .sidebar-brand {
        padding: var(--space-5) var(--space-4) var(--space-4);
        display: flex;
        justify-content: center;
    }

    .brand-link {
        display: inline-flex;
        align-items: center;
        text-decoration: none;
    }

    .brand-logo {
        display: block;
        width: 168px;
        height: auto;
    }

    .brand-name {
        font-size: var(--text-lg);
        font-weight: 800;
        letter-spacing: -0.02em;
    }

    .brand-name small {
        display: block;
        font-size: var(--text-xs);
        font-weight: 500;
        color: rgba(240, 234, 227, 0.65);
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .sidebar-nav {
        flex: 1;
        padding: var(--space-2) var(--space-3);
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .nav-section {
        display: block;
        font-size: var(--text-xs);
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: rgba(240, 234, 227, 0.5);
        padding: var(--space-4) var(--space-3) var(--space-1);
    }

    .nav-link {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-3);
        border-radius: var(--radius-sm);
        text-decoration: none;
        color: rgba(240, 234, 227, 0.82);
        font-weight: 500;
    }

    .nav-link svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
    }

    .nav-link.is-active {
        background: var(--color-brand);
        color: #fff;
    }

    .sidebar-footer {
        padding: var(--space-3);
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .user-chip {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-2) var(--space-3) var(--space-3);
    }

    .user-chip-info {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .user-chip-name {
        font-weight: 600;
        font-size: var(--text-sm);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-chip-role {
        font-size: var(--text-xs);
        color: rgba(240, 234, 227, 0.6);
    }

    .logout-form .btn {
        color: rgba(240, 234, 227, 0.82);
    }

    .logout-form .btn:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
    }

    .content {
        padding: var(--space-6);
    }
}
